← 문제 목록
중급 TypeScript 50P

맵드 타입 readonly 위반

다음 TypeScript 코드에서 버그를 찾으세요:
TYPESCRIPT
type Immutable<T> = {
    readonly [K in keyof T]: T[K];
};

interface Config {
    host: string;
    port: number;
}

const config: Immutable<Config> = {
    host: "localhost",
    port: 3000
};

config.port = 8080;

답변

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