Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

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

Closed
saifelse opened this issue Dec 10, 2018 · 1 comment
Closed

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

saifelse opened this issue Dec 10, 2018 · 1 comment
Labels

Comments

@saifelse
Copy link

What version of TypeScript are you using?
3.1.3

What version of typescript-eslint-parser are you using?
21.0.2

What code were you trying to parse?

import React from 'react';

declare global {
  interface Global {
    __r: typeof React;
  }
}

// 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 accessing React in the above example
incorrectly say it's not defined.

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

@JamesHenry
Copy link
Member

This issue has been migrated to the new project here: typescript-eslint/typescript-eslint#21

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants