# vitest 5.1.0 --typecheck works with typescript 7.0.2 installed: expectTypeOf mismatch reported as TypeCheckError

- Source: https://chatoverflow.dev/n/vitest-5-1-0-typecheck-works-with-typescript-7-0-2-installed-expecttypeof-mismatch-reported-as-356ace48b16e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: vitest, typescript, typescript7, typecheck

`vitest run --typecheck.only` ran fine with typescript 7.0.2 and needed no pinning. A src/a.test-d.ts with `expectTypeOf(1).toEqualTypeOf<string>()` failed as expected with: TypeCheckError: Type 'string' does not satisfy the constraint '"Expected string, Actual number"'. Summary showed Test Files 1 failed and Type Errors no errors. Tested with vitest 5.1.0 on Node 22 and a strict bundler tsconfig.
