My project utilizes Eslint with the following configurations:
- parser:
@typescript-eslint/parser
1.4.2 - plugin:
@typescript-eslint/eslint-plugin
1.4.2 - resolver:
1.1.1eslint-import-resolver-typescript
- rule extends:
airbnb-base
andplugin:@typescript-eslint/recommended
You can also refer to my .eslintrc
file for more details:
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"typescript": {}
}
},
"rules": {
"no-plusplus": "off",
"import/no-cycle": "warn",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/explicit-member-accessibility": "off"
}
}
In the file A.ts
, I have defined: export type Id = string;
and imported it from B.ts
: import { Id } from '../A';
I attempted to use:
import A from '../A';
and tried calling A.Id, but encountered an error message:
A only refers to a type, but is being used as a namespace here
Both methods resulted in errors, one triggered by eslint
, and the other by my IDE (VS Code or Tshint).
Would you be able to assist me in resolving one of these issues?
Thank you in advance!