Skip to content
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

2759 - RequiredByKeys #32499

Open
dev-hobin opened this issue Mar 8, 2024 · 0 comments
Open

2759 - RequiredByKeys #32499

dev-hobin opened this issue Mar 8, 2024 · 0 comments
Labels
2759 answer Share answers/solutions to a question en in English

Comments

@dev-hobin
Copy link

dev-hobin commented Mar 8, 2024

type RequiredByKeys<T, K extends keyof T = keyof T> = Omit<Omit<T, K> & { [P in keyof T as P extends K ? P : never]-?: T[P] }, never>
  • Omit<T, never> 로 옵셔널 객체 속성 타입에 undefined 값 제거 가능
  • 타입스크립트 옵션으로 아예 undefined 붙여서 타입 추론해주지 않게 할 수 있다.
@dev-hobin dev-hobin added answer Share answers/solutions to a question en in English labels Mar 8, 2024
@github-actions github-actions bot added the 2759 label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2759 answer Share answers/solutions to a question en in English
Projects
None yet
Development

No branches or pull requests

1 participant