Skip to content

Commit

Permalink
docs(readme): update exclusive instanced typing section according to …
Browse files Browse the repository at this point in the history
…feature schedule
  • Loading branch information
inhibitor1217 committed Dec 11, 2021
1 parent 1dc01d3 commit c8d4d5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ expect(Animal.Cat !== Animal.Dog).toBe(false);

- The enum type itself becomes the union of all the values. The values of enums does not overlap another.

> The type guard of `is` and `is.not` is not supported yet

> The exhuastive typing of union is not supported yet
```typescript
function f(animal: Animal): void {
// Produces type error:
// This condition will always return 'false' since the types 'Animal.Cat' and 'Animal.Dog' have no overlap.
if (animal.is(Animal.Cat) && animal.is(Animal.Dog)) {
...
type T1 = typeof animal; // never
}
}

Expand All @@ -76,6 +81,7 @@ function g(animal: Animal): void {
break
default:
// TypeScript compiler detects it is unreachable here
type T2 = typeof animal; // never
}
```
Expand Down

0 comments on commit c8d4d5e

Please sign in to comment.