Imed Jaberi 28908902ce
Improve the questions sub-folders names (#8850)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-04-19 12:04:56 +08:00

1.6 KiB

Fill medium #tuple

by キリサメ qianxi @qianxi0410

Take the Challenge

Fill, a common JavaScript function, now let us implement it with types. Fill<T, N, Start?, End?>, as you can see,Fill accepts four types of parameters, of which T and N are required parameters, and Start and End are optional parameters. The requirements for these parameters are: T must be a tuple, N can be any type of value, Start and End must be integers greater than or equal to 0.

type exp = Fill<[1, 2, 3], 0> // expected to be [0, 0, 0]

In order to simulate the real function, the test may contain some boundary conditions, I hope you can enjoy it :)


Back Share your Solutions Check out Solutions