Skip to main content
2 of 3
added 69 characters in body
noodle person
  • 12.6k
  • 1
  • 31
  • 90

TypeScript’s Type System, 62 bytes

type U<N,L extends 1[]=[]>=L extends{length:N}?L:U<N,[...L,1]> 

Try it at the TypeScript Playground!

Type definition taking a generic integer type and recursively appending 1 to a tuple type until it’s length is the integer type.

noodle person
  • 12.6k
  • 1
  • 31
  • 90