InversifyJS icon indicating copy to clipboard operation
InversifyJS copied to clipboard

Error after adding inversify in project node_modules/inversify/lib/annotation/injectable.d.ts

Open AdieOlami opened this issue 4 years ago • 6 comments

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)

  1. 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

AdieOlami avatar Feb 22 '22 04:02 AdieOlami

I've had similar issue with typescript 4.3.5 globally installed. After upgrading to 4.4.4 everything went fine.

rafal-dudzik-ttpsc avatar Mar 22 '22 23:03 rafal-dudzik-ttpsc

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 avatar Apr 04 '22 07:04 anna-sala07

@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.

shuvo009 avatar Apr 13 '22 07:04 shuvo009

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.

yog27ray avatar Jun 06 '22 13:06 yog27ray

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

anna-sala07 avatar Jun 07 '22 06:06 anna-sala07

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

PodaruDragos avatar Jun 07 '22 06:06 PodaruDragos