-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
why is type T = (x: T) => void valid whereas T = T isnt? #12525
Comments
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#310-type-aliases
|
The restriction that a type alias can't be referenced by itself at the top level has been the behavior since we implemented type aliases; however, you might recall that a while back, we started allowing type aliases to be referenced from within an object type. If we desugar type T = {
(value: T) => void
}; Overall this is actually pretty reasonable - even Haskell can't express something like this: type Wat = Wat
However, it has no problem provided that the type can be expanded, or "unrolled" one level at a time. In other words, as long as you have some sort of box-y thing containing the type: newtype Box a = Box a the type system will be okay. |
is there any chance for recursive types in unions?
|
tracked by #6230 |
nightly build Nov 27, 2016:
The text was updated successfully, but these errors were encountered: