카페검색 본문
카페글 본문
-
타입스크립트에서 인터페이스 사용하기 2023.10.09해당카페글 미리보기
// 인터페이스 - type으로 처리도 가능 하지만, 인터페이스를 사용하는 것이 좋다. // 값을 담을 수 있는 껍데기 interface Named { readonly name?: string; // 읽기 전용 - 한번만 값을 할당할 수 있다. outputName?: string; // 선택적 프로퍼티...
-
타입스크립트에서 클래스 사용하기 2023.10.08해당카페글 미리보기
// 클래스 class Department { // 필드 // private readonly id: string; // private name: string; private employees: string[] = []; // 생성자 (매개변수로 선언을 대체할 수 있음) // readonly를 사용하면 생성자에서만 값을 할당할 수 있음...
-
타입스크립트에서 타입 가드와 타입 캐스팅 사용하기 2023.10.11해당카페글 미리보기
// 타입 가드 : 타입을 체크하는 함수(typeof) function add(a: Combinable, b: Combinable){ if(typeof a === 'string' || typeof b === 'string'){ return a.toString() + b.toString(); } return a + b; } type UnknownEmployee = Employee | Admin...
-
해당카페글 미리보기
-
해당카페글 미리보기
-
해당카페글 미리보기
-
타입 스크립트에서 인덱스 타입과 함수 오버로드 사용하기 2023.10.11해당카페글 미리보기
// 인덱스 타입 interface ErrorContainer { // { email: 'Not a valid email', username: 'Must start with a character!' } [prop: string]: string; // 속성이 문자열이고, 속성의 값도 문자열이다. } const errorBag: ErrorContainer = { email: 'Not...
-
~~ channelled by Marta. (영어스크립트, 카카오번역) 2023.09.24해당카페글 미리보기
https://youtu.be/cI56HzjbJYE?si=wxu3_KDqCmjN3gZd Greetings, my dear beloved children! 안녕, 내 사랑하는 자녀들아! Today we move on to the subject of the Dragon reptiles that are a step down in the Dark Forces hierarchy. They are gene...
-
타입스크립트에서 제네릭 사용하기 2023.10.12해당카페글 미리보기
// Generic Types const names: Array = []; // string[] const promise: Promise = new Promise((resolve, reject) => { setTimeout(() => { resolve('This is done!'); }, 2000); }); promise.then((data) => { data.split(' '); });
-
타입스크립트에서 교차 타입 사용하기 2023.10.10해당카페글 미리보기
// 교차 타입 type Admin = { name: string; privileges: string[]; }; type Employee = { name: string; startDate: Date; }; type ElevatedEmployee = Admin & Employee; // 교차 타입 const e1: ElevatedEmployee = { name: 'Max', privileges...