TypeScript 5.x 새로운 기능들 정리
TypeScript 5.x는 개발 경험을 크게 개선하는 여러 기능을 도입했습니다.
const Type Parameters
function identity<const T>(value: T): T {
return value;
}
const result = identity({ name: "devlog" });
// result.name 타입이 string이 아닌 "devlog"로 추론됩니다Decorators (표준)
TC39 데코레이터 제안이 드디어 TypeScript 5.0에 도입되었습니다.
@logged
class Service {
@validate
greet(name: string) {
return `Hello, ${name}`;
}
}
0개의 댓글