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