-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[조익준]TS Todo Refactor 과제 #6
base: choikjun
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정합성 체크도 하시고 배포까지 .. ! 역시 익준님 👍👍
타입관련되서 궁금증이 좀 많아졌는데, 익준님의 답변두 궁금하고 같이 고민할만한 것들은 내일 더 얘기해봅시다 !!
수고하셨어요 !!
export const $app: QuerySelectType<HTMLElement> = | ||
document.querySelector('.app'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 왜 export 하셨나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이건 아래 쪽에서 new APP
컴포넌트를 생성할 때 $target: $app
타겟으로 해당 $app
요소와 타입을 동시에 넘겨줘야 해서 export 했습니다.
Todo-ts/src/components/Header.ts
Outdated
const $header: QuerySelectType<HTMLHeadingElement> = | ||
document.createElement('h1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const $header: HTMLHeadingElement = document.createElement("h1");
와 뭐가 다를까요 ??
저는 const $header = document.createElement('h1'); $target && $target.appendChild($header);
이렇게 참 검사를 통한 내로잉 을 주로 사용했는데 , 어떤 방식이 더 나을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 createElement에 대해서도 제가 잘못 타입을 지정한 거 같네요! 굳이 타입을 지정하지 않아도 HTMLHeadingElement 타입이 추론되는 거 같습니다.
📌 설명
VanillaJS 3주차 과제 Todo App을 TypeScript로 변환
🚀배포 링크
https://fedc-5-learning-ts-study.vercel.app/
✅ PR 포인트 & 궁금한 점
this: any
와 new 생성자를 통해 생성할 때as any
로 단언하여 임시 해결globalTypes
라고 명명했습니다.따로 정해져 있는 관례가 있을까요?