Giter Club home page Giter Club logo

typescript-oop-study's Introduction

TYPESCRIPT

타입스크립트란?

자바스크립트 기반의 언어로 자바스크립트 문법에 타입이 추가된 언어이다.


자바스크립트 VS 타입스크립트

  • 자바스크립트는 클라이언트 측 스크립팅 언어(인터프리터), 타입스크립트는 객체 지향 컴파일 언어

    인터프리터

    • 각각의 명령어를 한번에 한개씩 번역하고 처리 (그래서 실행시간이 느림)
    • 중간 객체 코드가 생성되지 않아 메모리 사용이 효율
    • 하나씩 순서대로 번역하기 때문에 발생하는 오류를 바로 발견 가능 (디버깅이 쉬움)
    • ex) Python, Ruby, Javascript, SQL, HTML 등

    컴파일러

    • 전체 프로그램을 스캔해서 기계어로 한 번에 번역
    • 코드 분석 시간은 오래 걸리지만 실행시간은 빠름.
    • 연결을 위한 중간 객체 코드를 생성하기 때문에 더 많은 메모리가 필요함.
    • 전체 프로그램 스캔 후 오류 메세지를 생성하기 때문에 디버깅이 어려움.
    • ex) C, C++, C#, Java, TypeScript

  • 이러한 컴파일 언어를 동적 타입언어라고 하며 타입스크립트는 엄격한 타입 체크를 지원함.

  • 자바스크립트의 경우 타입을 엄격하게 체크하지 않기 때문에 자유도, 유연성이 크지만 규모가 큰 프로젝트의 경우 위험성이 커질 수 있음. (버그, 오류가 생길 확률이 높음)

  • 타입스크립트는 엄격한 타입 체크로 에러 메세지를 개발 하는 동시에 바로 확인이 가능하다는 장점이 있음.


Install and Execute

타입스크립트 설치

npm install -g typescript

컴파일러 실행

tsc

컴파일과 실행을 한번에

npm install -g ts-node
  • .ts 파일을 .js로 컴파일 후 실행.
  • 컴파일 과정을 거친 후 실행되기 때문에 주로 개발 환경에서 사용함.
  • 운영환경에서는 모든 작업 파일을 js로 변경한 후 js를 실행하는 방식을 이용함.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.