← 문제 목록
초급 TypeScript 30P

타입 가드 실수

다음 TypeScript 코드에서 버그를 찾으세요:
TYPESCRIPT
function isString(value: unknown): boolean {
    return typeof value === "string";
}

function process(input: string | number): void {
    if (isString(input)) {
        console.log(input.toUpperCase());
    }
}

답변

로그인 후 제출하기
0명 풀이 · 정답률 0%