Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
β Coding devil/8: Utility Types
πDescription
keyof
keyof
ν€μλλ₯Ό μ¬μ©ν΄μ ν€ κ°λ€μ union ννλ‘ λ°μ μ μλ€.Partial<T>
optional
λ‘ λ³κ²½ν΄μ€λ€.Required<T>
Partial
κ³Ό λ°λλλ κ°λ μ΄λ€.Readonly<T>
Record<K,T>
Pick<T, K>
Omit<T,K>
Pick
κ³Ό λ°λλλ κ°λ μ΄λ€.Exclude<T1, T2>
Omit
κ³Ό νΌλν μ μμ§λ§Omit
μ νλ‘νΌν°λ₯Ό μ κ±°νλ κ²μ΄κ³ Excludeλ νμ μ μ κ±°νλ κ²μ΄λ€.NonNullable<Type>
Null
κ³Όundefind
λ₯Ό μ μΈν νμ μ μμ±νλ€.πSummary
keyof
: κ°μ²΄ νμ μ ν€λ€μ μ λμ¨ νμ μΌλ‘ λ°νPartial<T>
: νμT
μ λͺ¨λ νλ‘νΌν°λ₯Ό optionalλ‘ λ³κ²½ν΄μ£Όλ μ νΈλ¦¬ν° νμRequired<T>
: νμT
μ λͺ¨λ νλ‘νΌν°λ₯Ό νμλ‘ μ€μ νμ¬, λͺ¨λ μμ±μ λ°λμ μ¬μ©νκ² ν¨Readonly<T>
: νμT
μ λͺ¨λ νλ‘νΌν°λ₯Ό μ½κΈ° μ μ©μΌλ‘ μ€μ νμ¬ μμ λΆκ°λ₯νκ² ν¨Record<K, T>
:K
λ ν€ νμ ,T
λ κ° νμ μΌλ‘, ν€μ κ°μ νμ μ μ§μ νμ¬ κ°μ²΄λ₯Ό μμ±ν μ μμPick<T, K>
: νμT
μμ νΉμ ν€ Kλ§ μ νν΄μ μ¬μ©ν μ μκ² ν¨Omit<T, K>
: νμT
μμ νΉμ ν€ Kλ§ μ μΈνκ³ μ¬μ©ν μ μκ² ν¨.Exclude<T1, T2>
: νμT1
μμ νμ T2λ₯Ό μ μΈνκ³ λ¨μ νμ μ λ°νNonNullable<Type>
:null
κ³Όundefined
λ₯Ό μ μΈν νμ μ μμ±