Error after adding inversify in project node_modules/inversify/lib/annotation/injectable.d.ts
Expected Behavior
To run yarn watch and have no error
Current Behavior
`node_modules/inversify/lib/annotation/injectable.d.ts:1:52 - error TS1005: ',' expected.
1 declare function injectable(): <T extends abstract new (...args: never) => unknown>(target: T) => T; ~~~
node_modules/inversify/lib/annotation/injectable.d.ts:1:83 - error TS1144: '{' or ';' expected.
1 declare function injectable(): <T extends abstract new (...args: never) => unknown>(target: T) => T; ~
node_modules/inversify/lib/annotation/injectable.d.ts:1:91 - error TS1005: ')' expected.
1 declare function injectable(): <T extends abstract new (...args: never) => unknown>(target: T) => T; ~
node_modules/inversify/lib/annotation/injectable.d.ts:1:94 - error TS1005: ';' expected.
1 declare function injectable(): <T extends abstract new (...args: never) => unknown>(target: T) => T; ~
node_modules/inversify/lib/annotation/injectable.d.ts:1:96 - error TS1128: Declaration or statement expected.
1 declare function injectable(): <T extends abstract new (...args: never) => unknown>(target: T) => T;`
Possible Solution
Steps to Reproduce (for bugs)
- yarn add inversify inversify-express-utils reflect-metadata
Context
Your Environment
- Version used: 6.0.1
- Environment name and version (e.g. Chrome 39, node.js 5.4): Node -v v14.17.0
- Operating System and version (desktop or mobile): Mac
- Link to your project:
Stack trace
I've had similar issue with typescript 4.3.5 globally installed. After upgrading to 4.4.4 everything went fine.
Hello AdieOlami I am having the exact same issue and I have typescript Version 4.6.3 installed globally. Node v16.14.2. Did you find a solution for this?
@anna-sala07 I am having the exact same issue. my global typescript Version was 4.6.3 but my local one is 3.9.4. After upgrading local one to 4.6.3 everything went fine.
I am also facing the same issue. I don't have a global installation of typescript but the local one is typescript is 4.1.5.
Thank you @shuvo009 ! For some reason my Typescript local was not upgrading when I told it to use the latest version. once my local version was upgraded it started working fine
Hello guys, this had been answered before. The only solution to fix this problem is to update typescript to at least 4.4.4, as the fact that inversify itself is running on a typescript > 4.4.4. There is always the possibility of downgrading inversify to before v6