ava: Typings error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'
Description
When compiling with TypeScript there is a typings error which makes the TypeScript compiler exit with exit code 2. The code still gets compiled but my build CI fails because of the exit code. This happens on the latest AVA version if AVA is being compiled at all by TSC.
Error Message & Stack Trace
node_modules/ava/index.d.ts:5:10 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'
5 [Symbol.observable](): ObservableLike;
Command-Line Arguments
Run this to compile my example repo.
tsc index.ts
Relevant Links
- Minimal repo is here, just clone, npm install, and run
tsc index.ts
Environment
TypeScript v3.7.4 Node.js v12.14.0 linux 4.4.0-18362-Microsoft AVA v2.4.0 npm v6.13.4
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 15 (10 by maintainers)
Commits related to this issue
- upgraded node types to prevent issue with ava https://github.com/avajs/ava/issues/2332 — committed to LipSurf/cli by deleted user 4 years ago
- upgraded node types to prevent issue with ava https://github.com/avajs/ava/issues/2332 — committed to LipSurf/cli by deleted user 4 years ago
npm i -D -E ava@next
will give you the next release, but I haven’t yet documented the breaking changes so use at your own peril 😉I’ve also experienced this issue. Having looked into closed tickets, this appears to have been an issue that was previously resolved.
A temporary work-around is to put this into a general “global types” file. With some tweaks, it can be placed directly in test files as well.
Got a fix for now:
tsconfig.json:
I can verify that this happens with
But does not at
It seems to be a @types/node@v13.0 update
I don’t understand this change to make sense of what is going on, but it seems adding
import Symbol_observable from 'symbol-observable';
toavajs/index.d.ts
resolves thetsc
error.For my case it seems to work, not sure if that is however a proper fix.