tsdjs / tsd

Check TypeScript type definitions
MIT License
2.36k stars 68 forks source link

Intellisense/tsc: missed errors in union types #200

Open mmkal opened 9 months ago

mmkal commented 9 months ago

The following seems like it passes when using tsc or in an IDE, when it (correctly) fails running tsd via CLI:

import { expectType } from 'tsd'

expectType<number | null>(1)

playground (strict mode enabled)

Given the docs say:

Asserts that the type of expression is identical to type T.

for expectType<T>(expression), this seems confusing. This behaves as expected in expect-type (playground)