jest-community / jest-extended

Additional Jest matchers 🃏💪
https://jest-extended.jestcommunity.dev/
MIT License
2.3k stars 214 forks source link

Simplify typescript recommendations #685

Open silverwind opened 1 month ago

silverwind commented 1 month ago

The docs currently seem to recommend adding .d.ts files:

I had success by just adding to compilerOptions.types in tsconfig.json. Maybe that's all that is needed?

  "compilerOptions": {
    "types": [
      "jest-extended",
    ],
  },

In case vitest globals are in use, one can add vitest/globals to that array.

keeganwitt commented 1 month ago

Those recommendations were so you could get autocomplete working in things like VS Code IIRC.

silverwind commented 1 month ago

I got autocomplete working with above in Sublime Text LSP-typescript:

image
silverwind commented 1 month ago

Edited above, it appears VSCode uses a different LSP called tsserver, but I can't imagine that one failing on those types, but I will test it later.

dudeofawesome commented 2 weeks ago

Can confirm, using the types array work in VS Code.