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

type alias in declaration file #110

Closed
fdecampredon opened this issue Nov 23, 2014 · 2 comments
Closed

type alias in declaration file #110

fdecampredon opened this issue Nov 23, 2014 · 2 comments

Comments

@fdecampredon
Copy link

Currently the compiler seems not to allow type alias inside a declaration, this force us to do a lot of boilerplate ...

declare module 'test' {
  declare function doSomething(obj: { foo: string}): void;
  declare function doSomethingElse(obj: { foo: string}): void;
}

I would like to be able to write something like :

declare module 'test' {
  type MyObj =  { foo: string};
  declare function doSomething(obj: MyObj): void;
  declare function doSomethingElse(obj: MyObj): void;
}
@avikchaudhuri
Copy link
Contributor

This looks like an omission. Will fix. Meanwhile, you can pull MyObj outside declare module, should work.

jeffmo pushed a commit to jeffmo/flow that referenced this issue Jul 31, 2015
@samwgoldman
Copy link
Member

This has been implemented (declare type). Please re-open if the implementation doesn't satisfy your use case.

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

No branches or pull requests

3 participants