is icon indicating copy to clipboard operation
is copied to clipboard

Proposal: `isTuple`

Open younho9 opened this issue 4 years ago • 3 comments

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]
}

younho9 avatar Jan 28 '22 14:01 younho9

Seems out of scope for this library.

jonahsnider avatar Jan 28 '22 22:01 jonahsnider

Can this issue be suggested for is?

younho9 avatar Jan 29 '22 00:01 younho9

Can this issue be suggested for is?

Yes, I moved the issue.

sindresorhus avatar Jan 31 '22 17:01 sindresorhus

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.

tommy-mitchell avatar Apr 03 '23 07:04 tommy-mitchell

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?

gioragutt avatar Apr 15 '23 21:04 gioragutt

is.tupleLike sounds good.

sindresorhus avatar Apr 16 '23 03:04 sindresorhus

I'll take a shot at this

Myfeetarefreezing avatar Jun 30 '23 15:06 Myfeetarefreezing

closed :)

Myfeetarefreezing avatar Jul 25 '23 08:07 Myfeetarefreezing

@sindresorhus friendly bump that this can be closed :)

tommy-mitchell avatar Jan 28 '24 18:01 tommy-mitchell