Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode/eslint complaining Parsing error: Only declares and type imports are allowed inside declare module

I have the following index.d.ts file:

declare module 'mytypes' {
  interface Constructor<T> {
    new (...args: any[]): T;
  }

  //etc.

VSCode highlights the interface keyword:

enter image description here

Parsing error: Only declares and type imports are allowed inside declare module

  1 | declare module 'someproject' {
> 2 |   interface Constructor<T> {
    |   ^
  3 |     new (...args: any[]): T;
  4 |   }
  5 |eslint

Looks like an eslint error but I cannot tell which from the error message

like image 937
dagda1 Avatar asked May 05 '19 07:05

dagda1


1 Answers

You can add .eslintignore

/**/*.d.ts

The eslint rule mistakenly treats d.ts as js

like image 154
Sunday9787 Avatar answered Oct 19 '22 00:10

Sunday9787