danvk / effective-typescript

Effective TypeScript 2nd Edition: 83 Specific Ways to Improve Your TypeScript
https://effectivetypescript.com
Other
1.53k stars 226 forks source link

A new way to test types #21

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

A new way to test types

Effective TypeScript: A new way to test types

https://effectivetypescript.com/2022/05/28/eslint-plugin-expect-type/

louwers commented 2 years ago

Why not simply add a type annotation?

danvk commented 2 years ago

@louwers Adding a type annotation will test assignability, not type equality or the display of the type (which is also part of the usability of the library, see The Display of Types). Assignability is particularly problematic when any types enter the mix.