
Project Drag & Drop 1๏ธโฃ ! & as TypeScript์์ DOM ์กฐ์ํ ๋ ์ค๋ฅ ํด๊ฒฐํ๊ธฐ class ProjectInput { templateElement: HTMLTemplateElement; hostElement: HTMLDivElement; constructor() { this.templateElement = document.getElementById( 'project-input' )! as HTMLTemplateElement; this.hostElement = document.getElementById('app')! as HTMLDivElement; } } document.getElementById('id');์์ !๋ฅผ ์ถ๊ฐํ๋ ์ด์ ๋ TypeScript๊ฐ ์ด๊ฒ์ด null์ผ์..

Decorators 3๏ธโฃ Validation decorator ํ๋กํผํฐ ๋ฐ์ฝ๋ ์ดํฐ ์์ class Course { title: string; price: number; constructor(t: string, p: number) { this.title = t; this.price = p; } } const courseForm = document.querySelector('form')!; courseForm.addEventListener('submit', event => { event.preventDefault(); const titleEl = document.getElementById('title') as HTMLInputElement; const priceEl = document.getElementB..

Decorators 1๏ธโฃ What is Decorators? ํด๋์ค, ํ๋กํผํฐ, ์ก์ธ์, ๋ฉ์๋, ํ๋ผ๋ฏธํฐ์ ์ฒจ๋ถํ ์ ์๋ ํน๋ณํ ํจ์์ด๋ค. ๋ฐ์ฝ๋ ์ดํฐ๊ฐ ๋ถ์ ํด๋์ค ๋ฑ๋ฑ ์์๋ ๋ฐ์ฝ๋ ์ดํฐ์์ ์ ์๋ ๊ธฐ๋ฅ์ด ๋์ํ๋ค. ์ ์ํ ๋ฐ์ฝ๋ ์ดํฐ ํจ์๋ฅผ @ ๊ธฐํธ๋ฅผ ๋ถ์ฌ ์คํํ ์ ์๋ค. function ClassDeco(constructor: Function) { console.log('Logging...'); console.log(constructor); } @ClassDeco class Person { name = 'Shou'; constructor() { console.log('Creating person object...'); } } /* Logging... class Person { constructo..