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

Allow variables and types with same name #359

Closed
spencerhakim opened this issue Aug 16, 2017 · 3 comments
Closed

Allow variables and types with same name #359

spencerhakim opened this issue Aug 16, 2017 · 3 comments
Labels

Comments

@spencerhakim
Copy link

What version of TypeScript are you using?
2.4.2

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

What code were you trying to parse?

class MyFoo {}
export const Foo = MyFoo;
export type Foo = MyFoo;

What did you expect to happen?
No warnings/errors, this is valid TS.

What happened?
The no-redeclare rule was triggered since Foo had already been defined once.

@JamesHenry
Copy link
Member

Thanks a lot for your patience on this @spencerhakim!

This is down to the way in which we currently handle type declarations.

@JamesHenry JamesHenry added bug and removed triage labels Oct 22, 2017
@j-f1
Copy link
Contributor

j-f1 commented Oct 23, 2017

As a workaround, you can do

class MyFoo {}

export { MyFoo as Foo }

@JamesHenry
Copy link
Member

Closing in favour of a single issue here: #414

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

4 participants