marcalexiei / vitest-typechecking-playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vitest typechecking playground

Finding a way to perform typecheck on vitest using --typecheck flag:

Setup information

Path Has type error is source file Has type error inside test file
src/doSomething
src/doSomethingWithTypeError.ts

Learned things

How to get typechecking on both tests and source files

Include:

  test: {
    typecheck: {
      tsconfig: './tsconfig.test.json',
      include: ['**/tests/**/*.spec.ts(x)?'],
    },
  },

in `vite.config.js``

Can't run js and ts check at the same time

When running with typecheck vitest doesn't perform runtime check and vice versa.

To solve the issue I used 2 separate workspaces:

workspace std

The result is what you see in the next image:

error std

About


Languages

Language:TypeScript 100.0%