Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

"declare global" prevents accessing parent scope (no-undef) #21

Closed
Labels
bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser
@JamesHenry

Description

@JamesHenry

This issue was initially reported here:eslint/typescript-eslint-parser#579


What version of TypeScript are you using?
3.1.3

What version oftypescript-eslint-parser are you using?
21.0.2

What code were you trying to parse?

importReactfrom'react';declare global{interfaceGlobal{__r:typeofReact;}}// To complement `global.__r = React;`

What did you expect to happen?
No lint errors

What happened?

6:18 error 'React' is not defined no-undef

typescript-eslint-parser/analyze-scope.js:Referencer.visitGlobalAugmentation seems to replace the current scope with the global one, which makes accessingReact in the above example
incorrectly say it's not defined.

@mysticatea (via#540): what case does visitGlobalAugmentation solve?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp