Skip to content

Typing varying typed rest parameters #201

Answered by millsp
xeptore asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it is possible with overloads. So it's not real variation support - it's painful - but works!

https://github.com/millsp/ts-toolbelt/blob/master/sources/Function/Pipe/List/Sync.ts
https://github.com/millsp/ts-toolbelt/blob/master/sources/Function/Pipe/Multi/Async.ts

(While it works, it is not possible to generalize this from a single type. You will need to type these overloads. If you wanted to type no overloads, you'd need something to keep track of your generics while passing them around microsoft/TypeScript#1213 (comment))

So yes, typing Promise.all is certainly possible - given the two links I have give you above.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@xeptore
Comment options

@millsp
Comment options

@xeptore
Comment options

Answer selected by xeptore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants