Last active
March 19, 2022 11:41
-
-
Save Codennnn/4c5439aa1f2043a7490a67eb5c928797 to your computer and use it in GitHub Desktop.
只对某些属性设置为可选
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>> | |
// usage: | |
interface A { | |
requireX: string | |
requireY: string | |
requireZ: string | |
} | |
const v: PartialBy<A, 'requireY' | 'requireZ'> = { requireX: 'x' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment