SolvedDefinitelyTyped Invalid 'reference' directive syntax

I want to make PR to types-2.0 branch which change commander definitions.

When i run npm test i got an error

commander/index.d.ts(6,1): error TS1084: Invalid 'reference' directive syntax.
/// <reference types="node" />

How can i fix that?

28 Answers

βœ”οΈAccepted Answer

Getting the same exception.

ERROR in node_modules/@types/pdfjs-dist/index.d.ts(7,1): error TS1084: Invalid 'reference' directive

Type script version:
"typescript": "2.8.3"

Issue solved by updating typescript version to

"typescript": "3.5.1"

Other Answers:

I had the same issue as #10097 (comment)

Temporary solution for this
Remove one / from /// on line number 7 in file node_modules/@types/pdfjs-dist/index.d.ts

Hope this issue is solved ASAP!!!

use command "npm i typescript@3.5.1"

I'm using typescrpit version 2.7, and I still encounter this error for the following:

/// <reference types="angular" />

Hey guys!

This worked for me:

npm i pdfjs-dist@2.0.943 --save
npm i ng2-pdf-viewer@5.2.3 --save

This is due to on my end,

πŸ’¬-> npm ls typescript
β”œβ”€β”¬ @ionic/app-scripts@3.2.0
β”‚ └─┬ @angular-devkit/build-optimizer@0.0.35
β”‚   └── typescript@2.6.2 

Typescript is forced to 2.6.2 max due to the dependencies as shown.

You may have different issues depending on your npm ls typescript adventure.

Don't forget to restart ionic serve or something similar.

More Issues: