Typescript(2)
-
Typescript 문법 class/extends/function/Literal types/Union types/intersection types/Generics)
1. class 정의 클래스는 implements 를 사용한다 interface Car{ color:string; // 타입이 string인 함수 wheels:number; // 타입이 number인 함수 start():void; // return 값이 없는 함수 } class Bmw implements Car{ color;// 멤버 변수 wheels=4; // js 와 다르게 class 의 멤머변수를 설정할 때 constructor 외부에서도 변수선언을 해주어야 한다 constructor(c:string){ // 생성자 함수 this.color=c; } start():void{// 멤버 함수 console.log('go....!'); } } const car1 = new Bmw('green'); con..
2022.11.03 -
Typescript 초기 세팅 / 이론 / 문법
https://www.typescriptlang.org/ JavaScript With Syntax For Types. TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes before you even run your code. www.typescriptlang.org 2012년 마이크로소프트가 발표한 타입스크립트(TypeScript)는 자바스크립트(JavaScript)를 기반으로 정적 타입 문법을 추가한 프로그래밍 언어 1.컴파일 언어, 정적 타입 언어 자바스크립트는 동적 타입의 인터프리터 ..
2022.11.02