Skip to content

[no-unsafe-member-access] Namespaces trigger error #1868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mf-pherlihy opened this issue Apr 8, 2020 · 8 comments
Closed

[no-unsafe-member-access] Namespaces trigger error #1868

mf-pherlihy opened this issue Apr 8, 2020 · 8 comments
Assignees
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@mf-pherlihy
Copy link

Repro

{
  "rules": {
    "@typescript-eslint/no-unsafe-member-access": 2
  }
}
// some-definition.d.ts
declare class SomeClass extends NodeJS.EventEmitter {
 //
}

Expected Result

No error

Actual Result

eslint: error
@typescript-eslint/no-unsafe-member-access - Unsafe member access .EventEmitter on an any value

Additional Info

Pretty simple to reproduce, just create a definition file and have a class that extends the NodeJS.EventEmitter class.

Versions

package version
@typescript-eslint/eslint-plugin 2.27.0
@typescript-eslint/parser 2.27.0
TypeScript 3.8.3
ESLint 6.8.0
node 10.18.1
npm 6.13.4
@mf-pherlihy mf-pherlihy added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Apr 8, 2020
@bradzacher
Copy link
Member

Could you please create a repro repo for this?
I am unable to repro this against master.

I suspect that there is an issue with your config.

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Apr 8, 2020
@mf-pherlihy
Copy link
Author

mf-pherlihy commented Apr 8, 2020

@bradzacher Please see: https://github.com/mf-pherlihy/typescript-eslint-no-unsafe-member-access

> eslint src/test.d.ts

/src/test.d.ts
  2:33  error  Unsafe member access .EventEmitter on an any value  @typescript-eslint/no-unsafe-member-access

✖ 1 problem (1 error, 0 warnings)

@bradzacher
Copy link
Member

interesting. It looks like it's an error due to v13.11.1 of @types/node.
I can't repro it against master, because we have 12.12.7 installed, which is working fine.

I'm not sure what is happening.

@bradzacher
Copy link
Member

doing a pseudo-bisect shows that this is broken from v13.1.0 onwards of @types/node, with v12.12.35 (the latest v12 release at the time) working fine.

@bradzacher
Copy link
Member

I have a repro without any of our packages, so I'm not sure what the problem is. I'll need to keep looking
https://github.com/bradzacher/types-node-any-repro

@bradzacher bradzacher added bug Something isn't working and removed awaiting response Issues waiting for a reply from the OP or another party labels Apr 9, 2020
@bradzacher bradzacher self-assigned this Apr 9, 2020
@bradzacher
Copy link
Member

Looks like you stumbled upon a bug in typescript!

microsoft/TypeScript#37901

@tao-cumplido
Copy link

I can still reproduce this with

  • eslint 7.12.1
  • @typescript-eslint/eslint-plugin 4.6.0
  • typescript 4.0.5

the linked issue is supposedly fixed since typescript 4.0.1

namespace A {
	export interface B {}
}

export interface C extends A.B {} // Unsafe member access .B on an any value. eslint(@typescript-eslint/no-unsafe-member-access)

@bradzacher
Copy link
Member

bradzacher commented Oct 30, 2020

that bug is unrelated to this bug - please file a new issue.
that bug is related to the parser.

This bug is fixed in TS 4.0.1+

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants