When Create Custom Type?
- Program has complex data structures
- Basic tyeps (primitive types) don't describe completely the data structures I'm using
- When creating Library
- Cooperation with others and needing define new class, interface etc..
How To Make Custom Type Syntax?
Use `type` keyword!

How to use it smartly?
보통 `types.d.ts` 파일로 타입을 정의하는 것이 국룰이다.
1. *.d.ts 타입 정의
2. import {타입명} from '*.d.ts'
🔗 Reference
How To Create Custom Types in TypeScript | DigitalOcean
Though the basic types in TypeScript will cover many use cases, creating your own custom types based on these basic types will allow you to ensure the type checker validates the data structures specific to your project. This tutorial will show you how
www.digitalocean.com
Typescript Custom 모듈 정의
기억하기 위해 기록합니다.
oowgnoj.dev
'Web > Nodejs' 카테고리의 다른 글
| node_modules 와 package.json (0) | 2021.12.08 |
|---|---|
| [Node.js] 로컬에 설치된 패키지 명령어(CLI)로 실행하기 (0) | 2021.07.27 |
| imagemagick module PDF->png 권한 설정 Error (0) | 2020.02.06 |
| Error: Cannot find module (0) | 2020.01.15 |
| 단방향 해쉬함수 'bcrypt' Module (0) | 2020.01.07 |