All Tracks/workshop shape manager/
Đang tải...
Hướng dẫn thử thách
1 / 51

Step 11

You have a working circle area calculation logic now. You can type in a radius and see the area update instantly. However, if you continue writing this way for rectangles and triangles, things will become a clutter of loose variables and repeated logic. To prevent this, you can structure the data using **interfaces**, and create a function that handles all area calculation cases. An interface defines the structure of an object by specifying its property types. Here's what an interface looks like in TypeScript. ```ts interface Footballer { name: string; age: number; isCaptain: boolean; } ``` Create a base interface named `Shape`. Inside it, set `type` to `string`.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.ts
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.