Consider the following code snippet:
interface Foo{
one?: string;
two?: string;
}
type Foo2 = {
[P in keyof Foo]: number;
}
It is expected that the type of Foo2
would be { one: number; two: number; }
. However, it appears to retain the optional modifier as { one?: number; two?: number; }
.
Is there a way to eliminate the optional modifier when using mapped types?