Definitelytyped: Invalid 'reference' directive syntax

Created on 13 Jul 2016  ·  26Comments  ·  Source: DefinitelyTyped/DefinitelyTyped

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?

Most helpful comment

Getting the same exception.

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

syntax
Type script version:
"typescript": "2.8.3"

Issue solved by updating typescript version to

"typescript": "3.5.1"

All 26 comments

Use [email protected] or later to build.

Solved it for me.
@sanex3339 can you close this issue if your problem is fixed as well?

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

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

ERROR in [default] xxx/node_modules/metismenu/types/metismenu.d.ts:6:0
Invalid 'reference' directive syntax.

ERROR in [default] xxx/metismenu/types/metismenu.d.ts:24:55
Cannot find name 'JQueryEventObject'.

ERROR in [default] xxx/src/vendor.browser.ts:4:7
Exported external package typings file 'xxx/node_modules/metismenu/types/metismenu.d.ts' is not a module. Please contact the package author to update the package definition.

I met this problem, too.
And my typescrpit is Version 2.9.1.

Getting the same exception.

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

syntax
Type script version:
"typescript": "2.8.3"

Issue solved by updating typescript version to

"typescript": "3.5.1"

Th

Getting the same exception.

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

syntax
Type script version:
"typescript": "2.8.3"

Any help to solve this is highly appreciated.

The same error too... help please...

Eating my time with this
ERROR in node_modules/@types/pdfjs-dist/index.d.ts(7,1): error TS1084: Invalid 'reference' directive syntax.
current typescript version: 2.4.2

after upgrading to typescript v 3.1.6
Could not find local "typescript" package.The "@ngtools/webpack" package requires a local "typescript@^2.0.2" package to be installed.Error

*Your help is most precious.

Having the same error here. :( nothing yet?
Error Typescript Error
Invalid 'reference' directive syntax.
node_modules/@types/pdfjs-dist/index.d.ts

Typescript Error
Type 'CustomEvent' is not generic.
node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.component.d.ts

current typescript version: 2.6.2

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

Tried various typescript version.....but in vain. Please help

¿Cómo puedo arreglar eso?
///

solición
en el node_modules\@types\pdfjs-dist\index.d.ts

linea 7
cambiar el los 3 /// por 2 //

I had the same issue as https://github.com/DefinitelyTyped/DefinitelyTyped/issues/10097#issuecomment-499826179

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!!!

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!!!

I confirm that works. Thanks

An other solution is to use the verision "typescript": "3.5.1" and not other :(

the modification is to do in package.json file in the bloc: "devDependencies": {}

Removing a slash from the triple slash makes it a normal comment. Just remove it in that case. If you can still compile, it probably wasn't needed anymore.

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!!!

I confirm that works. Thanks

An other solution is to use the verision "typescript": "3.5.1" and not other :(

the modification is to do in package.json file in the bloc: "devDependencies": {}

Confirm resolve using "typescript": "3.5.1".

use command "npm i [email protected]"

use command "npm i [email protected]"

Best solution so you don't need to change your package.json, Especially if you are using version control.

I 've had the same issue and updating to typescript 3.5.1 was not an option.
What I've done is using the version for pdfjs-dist that match with my typescript version and so the matching version for ng2-pdf-viewer.
Here are the different version I used :
Typescript @2.7.2
ng2-pdf-viewer @5.2.4
@types/pdfjs-dist @0.1.2

Removal of one / from /// at line no 7 works
my ts was 2.7.2

Hey guys!

This worked for me:

npm i [email protected] --save
npm i [email protected] --save

This is due to on my end,

💬-> npm ls typescript
├─┬ @ionic/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] 

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.

Hey guys!

This worked for me:

npm i [email protected] --save
npm i [email protected] --save

This is due to on my end,

💬-> npm ls typescript
├─┬ @ionic/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] 

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.

It's worked for me too. Thanks!!!

I modified any line in index.d.ts file, save my changes, and compile, my change was a space

use command "npm i [email protected]"

Worked for me

use "npm i [email protected]" |
Worked for mee

I had the same issue while building package "nest-schedule/0.6.4".
Installing typescript v3 with npm install [email protected] solved it.

Thanks a lot for that help here.

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

Removing extra '/' helps to remove error : "Invalid 'reference' directive syntax. webpack : Failed to Compile."
Thank you.

Was this page helpful?
0 / 5 - 0 ratings