-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 zero-valent tuple type #13239
Comments
What exactly is the structural distinction between an empty tuple and |
the |
@chicoxyzzy https://homotopytypetheory.org/2011/04/18/whats-special-about-identity-types/ still confused? |
@Aleksey-Bykov TBH I don't understand the use case for such unit type. |
also |
as i said it could have been yet another unit type in addition to
|
If |
whereas
|
In that way |
well it was never said that
does the official TS guideline look counterintuitive to you? yet you can find https://www.typescriptlang.org/docs/handbook/interfaces.html |
The counterintuitive part is that |
Also as you mentioned you can declare your array unit as const arrayUnit: ReadonlyArray<any> = []; |
again, i don't care what here i was trying to talk about a different type which i called
no, i cannot declare it like that because i need it to be nonassignable from |
and this is why:
|
const empty: ReadonlyArray<any> = [];
empty.push(0); // error
empty = [1, 2, 3]; // error |
|
This is strange when you assign non-empty array to a constant variable named |
easily
someone renamed
|
closed in favor of #13126 |
the
{}
type is allowed, while[]
is not allowed, which is a sad news because i was planning to use it as a unit type distinct fromnull
andundefined
which have their own meaning alreadyconsider allowing the empty tuple type
The text was updated successfully, but these errors were encountered: