length
[ TypeScript ] type-challenges-00018-easy-tuple-length
00018-easy-tuple-length [ 문제 설명 ] For given a tuple, you need create a generic `Length`, pick the length of the tuple [ 문제 ] type Length = any [ 예시 ] type tesla = ['tesla', 'model 3', 'model X', 'model Y'] type spaceX = ['FALCON 9', 'FALCON HEAVY', 'DRAGON', 'STARSHIP', 'HUMAN SPACEFLIGHT'] type teslaLength = Length // expected 4 type spaceXLength = Length // expected 5 튜플(readonly 배열) 타입의 길이를 ..
[ TypeScript ] type-challenges - 00014-easy-first
00014-easy-first [ 문제 설명 ] Implement a generic `First` that takes an Array `T` and returns its first element's type. [ 문제 ] type First = any [ 예시 ] type arr1 = ['a', 'b', 'c'] type arr2 = [3, 2, 1] type head1 = First // expected to be 'a' type head2 = First // expected to be 3 타입의 맨 첫 번째 원소를 가져올 수 있는 First 타입을 정의하는 문제입니다. ( First 타입은 유틸리티 타입처럼 이미 정의된 타입이 아니라서 사용자가 직접 작성해서 사용해요 ! ) 배열의 길이 구하기 보..
![[ TypeScript ] type-challenges - 00014-easy-first](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbtD2Rh%2Fbtsoxracc7R%2FAAAAAAAAAAAAAAAAAAAAAMUVHcUniE_uTg6rbPDVki-RTgWkWMapfd4NG3EZHB4T%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DXV9HuGK%252BcRFXgca8bbfXX1imm0o%253D)