Skip to content
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

Allow local interface definition #2148

Closed
NN--- opened this issue Feb 26, 2015 · 2 comments · Fixed by #3266
Closed

Allow local interface definition #2148

NN--- opened this issue Feb 26, 2015 · 2 comments · Fixed by #3266
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@NN---
Copy link

NN--- commented Feb 26, 2015

It is impossible to define local interface in the function, but you can do it in the module.

module A {
  interface B{} // OK 
}

(function X() {
  interface Y { } // Error
})();
@mhegazy mhegazy added the Suggestion An idea for TypeScript label Feb 26, 2015
@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus Needs More Info The issue still hasn't been fully clarified and removed In Discussion Not yet reached consensus labels Mar 4, 2015
@RyanCavanaugh
Copy link
Member

I thought we had a bug for block-level interfaces somewhere already?

Anyway some compelling examples would be useful. It's just as easy to write a var declaration with a given type and use typeof x to refer to that shape, since you're probably going to consume the type that way regardless?

@NN---
Copy link
Author

NN--- commented Mar 4, 2015

Agree, 'typeof x' is possible workaround.
I should get used to it.

@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label May 31, 2015
@ahejlsberg ahejlsberg added this to the TypeScript 1.6 milestone May 31, 2015
@RyanCavanaugh RyanCavanaugh added Committed The team has roadmapped this issue and removed Needs More Info The issue still hasn't been fully clarified labels Jun 1, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants