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

Proposal: isTuple #156

Closed
younho9 opened this issue Jan 28, 2022 · 9 comments
Closed

Proposal: isTuple #156

younho9 opened this issue Jan 28, 2022 · 9 comments

Comments

@younho9
Copy link

younho9 commented Jan 28, 2022

I don't know if this could be added to is, but it could be useful to infer typescript tuple type value.

declare const value: unknown;

if(isTuple(value, [is.number, is.string])) {
	value //=> [number, string]
}
@jonahsnider
Copy link

Seems out of scope for this library.

@younho9
Copy link
Author

younho9 commented Jan 29, 2022

Can this issue be suggested for is?

@sindresorhus sindresorhus transferred this issue from sindresorhus/ts-extras Jan 31, 2022
@sindresorhus
Copy link
Owner

Can this issue be suggested for is?

Yes, I moved the issue.

@tommy-mitchell
Copy link

How should this work with ES Tuples (#133)? Maybe is.tsTuple? is.TupleLike? I know the proposal is still a while out from shipping, but it’s worth future-proofing against.

@gioragutt
Copy link
Collaborator

I feel is.tupleLike feels fine, since it caters to the ts-tuple, and leaves is.tuple for when the tc39 proposal is closer

@sindresorhus your thoughts?

@sindresorhus
Copy link
Owner

is.tupleLike sounds good.

@Myfeetarefreezing
Copy link
Contributor

I'll take a shot at this

@Myfeetarefreezing
Copy link
Contributor

closed :)

@tommy-mitchell
Copy link

@sindresorhus friendly bump that this can be closed :)

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

No branches or pull requests

6 participants