type NullAbleType<T> = {[K in keyof T]: T[K] | null}
type Option = { money: number, fn: (...arg: any[])=> void}
type User = {name: string, age: number}
type UserWithOPtionNullAble = User & NullAbleType<Partial<Option>>
// const obj:UserWithOPtionNullAble = {name: "kenji", age: 99, money: 222, fn: ()=>{}}
const obj = {} as UserWithOPtionNullAble
obj.age = 99
obj.name = "kenji"
Created
August 24, 2019 02:55
-
-
Save kenmori/bda57da1ac6804b2c30b8e9cf9d16dbd to your computer and use it in GitHub Desktop.
Separate optional and required types that can have null types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment