[Typescript] Creating Custom Types

2021. 6. 21. 15:54·Web/Nodejs

 

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
'Web/Nodejs' 카테고리의 다른 글
  • node_modules 와 package.json
  • [Node.js] 로컬에 설치된 패키지 명령어(CLI)로 실행하기
  • imagemagick module PDF->png 권한 설정 Error
  • Error: Cannot find module
M_Falcon
M_Falcon
  • M_Falcon
    Falcon
    M_Falcon
  • 전체
    오늘
    어제
    • 분류 전체보기 (432)
      • Web (16)
        • Nodejs (14)
        • Javascript (23)
        • FrontEnd (4)
      • DataBase (39)
        • Fundamental (1)
        • Redis (4)
        • PostgreSQL (10)
        • NoSQL (4)
        • MySQL (9)
        • MSSQL (3)
        • Error (4)
      • Algorithm (79)
        • Algorithm (문제풀이) (56)
        • Algorithm (이론) (23)
      • JVM (65)
        • Spring (13)
        • JPA (5)
        • Kotlin (13)
        • Java (24)
        • Error (7)
      • 기타 (70)
        • Kafka (3)
        • Kubernetes (3)
        • Docker (13)
        • git (19)
        • 잡동사니 (27)
      • 재테크 (11)
        • 세무 (4)
        • 투자 (3)
        • 보험 (0)
      • BlockChain (2)
        • BitCoin (0)
      • C (32)
        • C (10)
        • C++ (17)
        • Error (3)
      • Low Level (8)
        • OS (3)
        • 시스템 보안 (5)
      • 네트워크 (3)
      • LINUX (30)
        • Linux (26)
        • Error (4)
      • 저작권과 스마트폰의 이해 (0)
      • 생각 뭉치 (6)
      • 궁금증 (2)
      • Private (4)
        • 이직 경험 (0)
        • 꿈을 찾아서 (1)
      • Android (21)
        • OS (4)
  • 블로그 메뉴

    • 홈
    • WEB
    • 알고리즘
    • DataBase
    • Linux
    • Mobile
    • C
    • 방명록
  • 링크

    • github
  • 공지사항

  • 인기 글

  • 태그

    database
    JPA
    Bitcoin
    PostgreSQL
    백준
    Kotlin
    ubuntu
    알고리즘
    Git
    Programmers
    javascript
    java
    Spring
    linux
    android
    프로그래머스
    C++
    docker
    algorithm
    kafka
  • hELLO· Designed By정상우.v4.10.3
M_Falcon
[Typescript] Creating Custom Types
상단으로

티스토리툴바