본문 바로가기 메뉴 바로가기

AI Platform / Web

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

AI Platform / Web

검색하기 폼
  • 분류 전체보기 (374)
    • 알고리즘 (56)
      • 알고리즘 종류 (20)
      • 백준 (1)
      • sw (30)
    • Web (206)
      • HTML (10)
      • CSS (6)
      • Bootstrap (2)
      • Django (63)
      • JAVASCRIPT (22)
      • typescript (2)
      • Vue.js (10)
      • SQL (2)
      • git (2)
      • 프로젝트구현 (21)
      • React (42)
      • php (2)
      • nodejs (3)
      • nextjs (12)
    • Database (0)
      • MongoDB (0)
    • 빅데이터 (8)
    • 인공지능(Artificial Intelligenc.. (64)
      • python (23)
      • 자연어 처리(natural language pro.. (16)
      • Linear algebra (1)
      • Algorithm (2)
      • Tensorflow (8)
      • speech recongnition (0)
      • 머신러닝 (4)
      • 딥러닝(Deep Learning) (2)
      • CNN (4)
      • RNN (1)
    • 데이터분석 (9)
    • Platform (12)
      • spring boot (9)
    • 라즈베리파이 (5)
    • github (1)
    • 오픈소스 (1)
  • 방명록

AssertionError (1)
[typescript] assert 로 타입 보장하기

타입스크립트를 사용하면 기본적으로 타입 추론과 체크를 진행한다. 하지만 부분적으로 타입 보장이 안되는 경우가 있다. 왜냐하면 느슨하게 타입을 확인하기 때문이다. 1. nodejs에서 타입 단언 시키기 assert를 활용해서 type을 단언하여 함수를 만들어 보자. assert() 함수는 런타임 시 불변 조건(invariant)를 검사하는 함수이다. const assert = require('assert') function add(x, y) { assert(typeof x === 'number') assert(typeof y === 'number') return x * y // number * number } add(1, 1) // 2 add('1', 1) // AssertionError [ERR_ASSE..

Web/typescript 2023. 1. 30. 10:14
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • useState
  • nodejs
  • react autoFocus
  • 자연어처리
  • Python
  • TensorFlow
  • Express
  • pandas
  • mongoDB
  • BFS
  • read_csv
  • error:0308010C:digital envelope routines::unsupported
  • 클라우데라
  • useHistory 안됨
  • django
  • vuejs
  • logout
  • UserCreationForm
  • Deque
  • nextjs autoFocus
  • 자료구조
  • DFS
  • react
  • next.config.js
  • NextJS
  • typescript
  • JavaScript
  • Queue
  • login
  • Vue
more
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바