typescript 3.4
에서 부터 컴파일러가 자동으로 타입을 추론해줌.
let title = "typescript"
-> title의 type을 자동으로 string으로 추론함
const title = "typescript";
-> title의 type을 "typescript"로 추론함
as const
이용 let title = "typescript" as const
-> title 의 type이 "typescript" 로 지정됨.
const Colors = {
red: "#FF0000",
blue: "#0000FF",
green: "#008000"
}
const Colors = {
red: "#FF0000",
blue: "#0000FF",
green: "#008000"
} as const