Skip to content

Commit a0af727

Browse files
committed
update docusaurus
1 parent 91a3ff3 commit a0af727

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

website/src/pages/index.mdx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,14 @@ Discriminated unions advantages:
216216

217217
// TypeScript warns us with errors in calculateArea function
218218
const calculateArea = (shape: Shape) => {
219-
// Error - Switch is not exhaustive. Cases not matched: "triangle"
220-
switch (shape.kind) {
221-
case 'circle':
222-
return Math.PI _ shape.radius \*\* 2;
223-
case 'square':
224-
return shape.size _ shape.width; // Error - Property 'width' does not exist on type 'square'
225-
}
219+
// Error - Switch is not exhaustive. Cases not matched: "triangle"
220+
switch (shape.kind) {
221+
case 'circle':
222+
return Math.PI * shape.radius ** 2;
223+
case 'square':
224+
return shape.size * shape.width; // Error - Property 'width' does not exist on type 'square'
225+
}
226226
};
227-
228-
```
229-
230-
```
231-
232227
```
233228

234229
- Avoid code complexity introduced by [flag variables](#type-union--boolean-flags).

0 commit comments

Comments
 (0)