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 is not possible when defining abstract method. #6832

Closed
fphh opened this issue Feb 2, 2016 · 6 comments
Closed

Type alias is not possible when defining abstract method. #6832

fphh opened this issue Feb 2, 2016 · 6 comments
Labels
Duplicate An existing issue was already created

Comments

@fphh
Copy link

fphh commented Feb 2, 2016

This gives an compile error:


type t = () => void;

abstract class A {
   abstract f : t
}

This compiles:


abstract class A {
  abstract f () : void; 
}

Shouldn't both be possible if we support type aliases?

I used Typescript 1.7.5.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 2, 2016

looks like a duplicate of #4669

@mhegazy mhegazy closed this as completed Feb 2, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Feb 2, 2016
@fphh
Copy link
Author

fphh commented Feb 3, 2016

I don't see that #4669 has to do with type aliases. Actually, I think that, if my first example does not compile, this means type aliasing is not fully implemented or broken.

@kbtz
Copy link

kbtz commented Feb 3, 2016

Please reopen this one.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 3, 2016

abstract properties are not legal in TS today. #4669 tracks enabling it. This has nothing to do with type aliases.. abstract class C { abstract c: number; } still does not compiler.

@fphh
Copy link
Author

fphh commented Feb 4, 2016

If we had abstract properties, then my first example would compile? Note, that by type f is still a method, not an property (even if it looks syntactically like a property).

@mhegazy
Copy link
Contributor

mhegazy commented Feb 4, 2016

If we had abstract properties, then my first example would compile?

yes. this is #4669

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants