Skip to content

Commit

Permalink
chore: fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorales committed Jul 21, 2024
1 parent af408c6 commit e4d286f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,21 @@ For every case checked, `exhaustive` will narrow the type of input:
const getRoleLabel = (r: Role) =>
exhaustive(r, {
ADMIN: (role) => capitalize(role), // Admin
// ^? role is ADMIN
// ^? role is ADMIN
DEFAULT: (role) => capitalize(role), // Default
// ^? role is DEFAULT
// ^? role is DEFAULT
VIEWER: (role) => capitalize(role), // Viewer
// ^? role is VIEWER
// ^? role is VIEWER
});

const area = (s: Shape) => {
return exhaustive.tag(s, 'kind', {
square: (shape) => shape.size ** 2,
// ^? shape is Square
// ^? shape is Square
rectangle: (shape) => shape.width * shape.height,
// ^? shape is Rectangle
// ^? shape is Rectangle
circle: (shape) => Math.PI * shape.radius ** 2,
// ^? shape is Circle
// ^? shape is Circle
});
};
```
Expand Down Expand Up @@ -183,7 +183,7 @@ const getLabelForDayOfWeek = (day: Day) => {
return 'Weekend';
default:
corrupt(day);
// ^? Argument of type 'string' is not assignable to parameter of type 'never'
// ^? Argument of type 'string' is not assignable to parameter of type 'never'
}
};
```

0 comments on commit e4d286f

Please sign in to comment.