You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My test code is written in TypeScript but the type declarations cannot be found when using ava version 4. With ava version 3 it seems to work. This is probably due to the missing index.js file in the ava package?
Test file: tests/my.test.ts
importtestfrom'ava';
run:
node ./node_modules/.bin/tsc
output:
tests/my.test.ts:1:18 - error TS7016: Could not find a declaration file for module 'ava'. 'node_modules/ava/entrypoints/main.mjs' implicitly has an 'any' type.
Try `npm i --save-dev @types/ava`if it exists or add a new declaration (.d.ts) file containing `declare module 'ava';`
1 import test from 'ava';~~~~~
Found 1 error in tests/my.test.ts:1
With typescript 4.7 release seems like it's still an issue when the project has "type": "module" and tsconfig's "module": "NodeNext" (well, and strict mode, otherwise it will just warn and doesn't give any autocomplete info)
Uncaught exception in tests\sample.test.ts
tests/sample.test.ts(1,18): error TS7016: Could not find a declaration file for module 'ava'. '.../ava-ts-module/node_modules/ava/entrypoints/main.cjs' implicitly has an 'any' type. Try `npm i --save-dev @types/ava` if it exists or add a new declaration (.d.ts) file containing `declare module 'ava';`
tests/sample.test.ts(3,18): error TS7006: Parameter 't' implicitly has an 'any' type.
My test code is written in TypeScript but the type declarations cannot be found when using ava version 4. With ava version 3 it seems to work. This is probably due to the missing index.js file in the ava package?
Test file:
tests/my.test.ts
run:
output:
package.json
ava.config.js
tsconfig.json
Maybe i'm missing something. I'm happy to provide a repo for reproducing the problem.
The text was updated successfully, but these errors were encountered: