Open sculove opened 7 years ago
https://github.com/studye/typescript/issues/6 으로 인한 오류를 방지하기 위해서는 에라 모르겠다 any 타입
any
var complextType: any = { name : "son", isOld: false }; complextType = { isOld: true, name: "song" }; // ok complextType = { name: "byun" }; // any 니깐 ok complextType = { isOld: false, name: "park", national: "korea" }; // any 니깐 ok
<타입>변환할변수으로 변환한다. 변환할변수 as 타입으로도 변환이 가능하다.
<타입>변환할변수
변환할변수 as 타입
var complextType = { name : "son", isOld: false }; complextType = { isOld: true, name: "song" }; // ok complextType = <any>{ name: "byun" }; // any 니깐 ok complextType = <any>{ isOld: false, name: "park", national: "korea" }; // any 니깐 ok complextType = { name: "byun" } as any; // any 니깐 ok complextType = { isOld: false, name: "park", national: "korea" } as any; // any 니깐 ok
any types
https://github.com/studye/typescript/issues/6 으로 인한 오류를 방지하기 위해서는 에라 모르겠다
any
타입형 변환
<타입>변환할변수
으로 변환한다.변환할변수 as 타입
으로도 변환이 가능하다.