npm run watch does not work on node 12. node_modules/ava/index.d.ts:5:10 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.
samirspatel opened this issue · 6 comments
-
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project -
Summary
I get this error message after runningnpm run watch
node_modules/ava/index.d.ts:5:10 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.
I ran npx typescript-starter to install the project and got the error right after that
npxversion6.10.0nodeversionv12.7.0Ubuntuversion18.04
node_modules/ava/index.d.ts:5:10 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.
As seen abow Error is generated by AVA. Here is the related issue: avajs/ava#2151
Extending SymbolConstructor fixes the issue
declare global { interface SymbolConstructor { readonly observable: symbol; } }
I fixed it by creating a new file 'src/types/ava.d.ts' with the following content:
export {};
declare global {
interface SymbolConstructor {
readonly observable: symbol;
}
}See https://stackoverflow.com/a/59499895/1008341 regarding the first line here.
I am not too sure if this is a correct file placement and naming, though.
A simpler src/types/ava.d.ts:
interface SymbolConstructor {
readonly observable: symbol;
}You don't need to import that definition anywhere so it doesn't necessarily need to be a module (i.e. export {}). Now you can ignore global because, as it's not a module anymore, "everything in such a file is in the global scope anyways".
Hey all – sorry to keep you waiting on this!
The latest version of typescript-starter now upgrades all dependencies, so this issue should be fixed. 🚀
There are a few new improvements 🚀
- migrated from
tslint(deprecated) toeslint - added optional support for
cspellchecking - switch to AVA's new built-in debugging mode (for easier debugging in vscode)
Please open an issue if you notice any problems!