← 문제 목록
중급
TypeScript
50P
조건부 타입 실수
다음 TypeScript 코드에서 버그를 찾으세요:
TYPESCRIPT
type IsArray<T> = T extends any[] ? "array" : "not-array";
type Test1 = IsArray<string[]>; // "array"
type Test2 = IsArray<string>; // "not-array"
type Test3 = IsArray<string | number[]>; // 기대: "not-array" | "array"
const val: Test3 = "array";
console.log(val);
0명 풀이 · 정답률 0%