Complete<T>
Complete<
T
>: { [P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined }
Makes optional keys required and add the the undefined type.
interface Test {
foo: number;
bar?: number;
baz: number | undefined;
}
Complete<Test> {
foo: number;
bar: number | undefined;
baz: number | undefined;
}
See https://medium.com/terria/typescript-transforming-optional-properties-to-required-properties-that-may-be-undefined-7482cb4e1585
Type Parameters
Type Parameter |
---|
T |