jest-extended icon indicating copy to clipboard operation
jest-extended copied to clipboard

Simplify typescript recommendations

Open silverwind opened this issue 1 year ago • 4 comments

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

  • https://jest-extended.jestcommunity.dev/docs/getting-started/typescript
  • https://jest-extended.jestcommunity.dev/docs/getting-started/setup#vitest-typescript-types-setup

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.

silverwind avatar Apr 08 '24 15:04 silverwind

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

keeganwitt avatar Apr 08 '24 15:04 keeganwitt

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

image

silverwind avatar Apr 08 '24 16:04 silverwind

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.

silverwind avatar Apr 08 '24 16:04 silverwind

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

dudeofawesome avatar May 14 '24 20:05 dudeofawesome