-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
I wasn't able to build a repro for this issue, but it really seems like a bug.
I have the following d.ts
file on my project (I'm using namespaces to organize my types).
XXX.d.ts
declare namespace XXX {
interface Temp1 {
foo: "bar"
}
namespace WWW {
interface Temp2 {
foo: "bar"
}
}
}
So the XXX
is ambient and the WWW
namespace is nested within it.
I need to extend the Temp2
interface, that lives on the nested WWW
namespace.
So I did this:
interface Test2 extends XXX.WWW.Temp2 {}
And I got this error:
So I thought: "eslint might not be detecting the XXX namespace". But that is not true, as you can see that the following code works fine when extending Temp1
which is a direct member of the XXX namespace.
interface Test1 extends XXX.Temp1 {}
And what is even weirder is that if I use an intermediate AUX
type, it works fine:
type AUX = XXX.WWW.Temp2;
interface Test2A extends AUX {}
Expected Result
There shouldn't be any errors when extending a nested namespace.
interface Test2 extends XXX.WWW.Temp2 {}
Actual Result
The @typescript-eslint/no-unsafe-member-access
is being triggered.
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
4.22.0 |
@typescript-eslint/parser |
4.22.0 |
TypeScript |
4.2.4 |
ESLint |
7.24.0 |
node |
10.19.0 |
.eslintrc.js
const config = {
root: true,
env: {
browser : true,
commonjs: true,
es2017: true,
node: true
},
parser: "@typescript-eslint/parser",
ignorePatterns: [
".eslintrc.js",
"webpack.*.ts",
"babel.config.*.js"
],
parserOptions: {
project: "./tsconfig.json",
sourceType: "module",
},
globals: {
gtag: "readonly"
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
plugins:[
"react",
"react-hooks",
"@typescript-eslint"
],
rules: {
"semi": "error",
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-unused-vars": ["warn", {"args":"none"}],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off"
},
settings: {
"react": {
version: "detect"
}
},
overrides: [
{
files: ["*.js"],
rules: {
"@typescript-eslint/no-var-requires": 0
}
}
]
};
module.exports = config;
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"types": ["node"],
"baseUrl": ".",
"paths": {
"@app/*": ["./app/*"],
"@lib/*": ["./lib/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}