Dream๐Ÿฐng
article thumbnail
[TS] Project Drag & Drop 1๏ธโƒฃ
๐Ÿ“ Study/TypeScript 2023. 3. 27. 12:31

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์ผ์ˆ˜..

article thumbnail
[TS] Decorators 3๏ธโƒฃ
๐Ÿ“ Study/TypeScript 2023. 3. 24. 19:36

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..

article thumbnail
[TS] Decorators 1๏ธโƒฃ
๐Ÿ“ Study/TypeScript 2023. 3. 20. 12:51

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..

profile on loading

Loading...