Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 1.6 KB

File metadata and controls

13 lines (9 loc) · 1.6 KB

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