jest-community / jest-editor-support

A module for handling editor to jest integration
MIT License
28 stars 21 forks source link

fix dep type errors #101

Closed connectdotz closed 1 year ago

connectdotz commented 1 year ago

v31.0.0 had 2 problem when trying to integrate:

  1. typescript tsc compile problem
    
    node_modules/jest-editor-support/build/parsers/index.d.ts:8:29 - error TS7016: Could not find a declaration file for module './parser_nodes'. '/Users/vsun/github/open-source/sandbox/vscode-jest-2023-01-13/node_modules/jest-editor-support/build/parsers/parser_nodes.js' implicitly has an 'any' type.

8 import { ParseResult } from './parser_nodes';



Found 1 error in node_modules/jest-editor-support/build/parsers/index.d.ts:8
```
This is fixed by modifying `index.d.ts` 

2. type error when importing from `jest-editor-support`: `TypeError: defineType is not a function` 
This one is baffling. Some how `jest-editor-support` and its dependencies have problem finding the `@babel/traverse`. I had to lock the version down (in package.json) to make sure it can be located regardless of the client env. For future updates, it will be better to resolve the root cause; otherwise we have to continue this hack...

Also added a typescript flag `"importsNotUsedAsValues": "error"` so we can be more precise to import type vs. value. Fixed the import code accordingly.

Bump version to 31.0.1.