// Error: Type '"Byron"' is not assignable to type '"Ada"'.// Error: Type '"Byron"' is not assignable to type '"Ada"'.
let someString = ""; // 타입: string
specificallyAda = someString;
//~~~~~~~~~~~~~//~~~~~~~~~~~~~
// Error: Type 'string' is not assignable to type '"Ada"'.// Error: Type 'string' is not assignable to type '"Ada"'.
그러나 리터럴 타입은 그 값이 해당하는 원시 타입에 할당할 수 있습니다. 모든 특정 리터럴 문
자열은 여전히
string
타입이기 때문입니다.
다음 예제 코드에서, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.