Created
February 11, 2024 12:01
-
-
Save turbod/ba2f56dcd67739b89b11411d1d85c95d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type RgbTuple = Tuple<3, number>; | |
// ^? type RgbTuple = readonly [number, number, number] | |
const red: RgbTuple = [255, 0, 0]; | |
type Tuple<Length, Type, Acc extends Type[] = []> = Acc["length"] extends Length | |
? Readonly<Acc> | |
: Tuple<Length, Type, [...Acc, Type]>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment