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

tuple type spread #17884

Closed

Conversation

KiaraGrouwstra
Copy link
Contributor

@KiaraGrouwstra KiaraGrouwstra commented Aug 18, 2017

This tuple type spread is part of my attempt at tackling #5453 following the tuple-flavored variant of the proposal laid out by @Artazor.

It adds a new spread node as a type-level equivalent of the one for the expression level. This could potentially be reused for another part of #5453 that'd require #6606, spreads in type-level function 'application' e.g. Fn(...Args).

Progress: evaluation with generics delayed too much.

type a = [1, ...[2]];
>a : [1, 2]
type Combine<Head, Tail extends any[]> = [Head, ...Tail];
>Combine : [Head, ...Tail]
type b = Combine<1, [2, 3]>;
>b : [1, ...Tail] 

@KiaraGrouwstra
Copy link
Contributor Author

KiaraGrouwstra commented Aug 21, 2017

The challenge I'm facing here is re-evaluating the parent tuple after generics are known, so I could spread out the generic's tuple over the parent tuple. I've yet to really figure this out.

KiaraGrouwstra added a commit to KiaraGrouwstra/TypeScript that referenced this pull request Aug 24, 2017
Fixes the third part of microsoft#5453, needed to effectively type `bind` (Function.prototype), `curry` and `compose`. Depends on microsoft#17961 type calls, microsoft#17884 type spread and microsoft#18004 tuple spread. The first 2/3 are included, so changes will look more cluttered here though new changes just span 10 lines over 2 functions. Will properly test this when those are ready -- now still broken.
@KiaraGrouwstra KiaraGrouwstra changed the title WIP: tuple type spread tuple type spread Sep 21, 2017
@typescript-bot
Copy link
Collaborator

Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it.

@KiaraGrouwstra
Copy link
Contributor Author

For posterity, #24897 (comment) offers an alternative we can use today.

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

Successfully merging this pull request may close these issues.

4 participants