# TypeScript를 배울 때 알았으면 좋을 트릭들

> Clean Markdown view of GeekNews topic #5221. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=5221](https://news.hada.io/topic?id=5221)
- GeekNews Markdown: [https://news.hada.io/topic/5221.md](https://news.hada.io/topic/5221.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-10-19T09:37:01+09:00
- Updated: 2021-10-19T09:37:01+09:00
- Original source: [cstrnt.dev](https://www.cstrnt.dev/blog/three-typescript-tricks)
- Points: 15
- Comments: 1

## Topic Body

- Readonly<T>

ㅤ→ JS의 Array와 Object는 Reference라서 수정이 가능. 사이드 이펙트 줄이기

- Any vs Unknown

ㅤ→ 컴파일할 때 모르는 타입에 대한 강제 체크가 가능하게 any 대신 Unknown 사용하기

- Record로 객체 Typing 하기

ㅤ→ interface 대신 Record를 이용

## Comments



### Comment 7299

- Author: xguru
- Created: 2021-10-19T09:38:01+09:00
- Points: 1

HN 댓글에 추가로 나온 것들 https://news.ycombinator.com/item?id=28837181

- Utility Type 에 대해 알기

ㅤ→ https://www.typescriptlang.org/docs/handbook/utility-types.html

ㅤ→ 한국어 https://typescript-kr.github.io/pages/utility-types.html

- 함수에서 Sometype|undefined 대신 Sometype|null 리턴하기

- Indexed Access Types https://www.typescriptlang.org/docs/handbook/2/indexed-access-types.html
