Skip to content

add task solution#3324

Open
chlodav wants to merge 2 commits into
mate-academy:masterfrom
chlodav:develop
Open

add task solution#3324
chlodav wants to merge 2 commits into
mate-academy:masterfrom
chlodav:develop

Conversation

@chlodav
Copy link
Copy Markdown

@chlodav chlodav commented May 23, 2026

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

The constructors use manual property assignment instead of TypeScript parameter properties with access modifiers. Apply 'public' (or another access modifier) before each parameter in the constructor to implicitly create the properties, as this is more concise and idiomatic TypeScript.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/figuresClasses.ts Outdated
Comment on lines +26 to +42
constructor(color: FigureColor, a: number, b: number, c: number) {
validatePositiveLength(a, 'a');
validatePositiveLength(b, 'b');
validatePositiveLength(c, 'c');

const sortedSides = [a, b, c].sort((x, y) => y - x);
const longestSide = sortedSides[0];
const sumOfOtherSides = sortedSides[1] + sortedSides[2];

if (longestSide >= sumOfOtherSides) {
throw new Error(`Sides ${a}, ${b} and ${c} can't form a triangle`);
}

this.color = color;
this.a = a;
this.b = b;
this.c = c;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #4: Instead of manually assigning this.color = color, use TypeScript parameter properties by adding public (or another access modifier) before the parameter: constructor(public color: FigureColor, ...)

Comment thread src/figuresClasses.ts Outdated
Comment on lines +60 to +64
constructor(color: FigureColor, radius: number) {
validatePositiveLength(radius, 'radius');

this.color = color;
this.radius = radius;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #4: Properties are manually assigned instead of using TypeScript parameter properties. Example fix: constructor(public color: FigureColor, public radius: number)

Comment thread src/figuresClasses.ts Outdated
Comment on lines +83 to +89
constructor(color: FigureColor, width: number, height: number) {
validatePositiveLength(width, 'width');
validatePositiveLength(height, 'height');

this.color = color;
this.width = width;
this.height = height;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #4: Properties are manually assigned instead of using TypeScript parameter properties. Example fix: constructor(public color: FigureColor, public width: number, public height: number)

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your solution is approved. All task requirements have been successfully implemented: the Figure interface with proper shape and color types, the three shape classes with correct parameter properties, Heron's formula for triangles, Math.PI for circles, input validation with descriptive error messages, and the getInfo method formatting output as specified. The area calculation correctly rounds down to the hundredths place using Math.floor(area * 100) / 100. Great work on using TypeScript parameter properties with access modifiers to keep the code clean and concise!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants