Is there a way to modify an interface by making optional properties required?
Consider the following interface:
interface Foo {
test1: string;
test2?: string;
}
I want to create a new interface based on this, with the optional property now being required:
interface FooDefaults {
test2: string;
}
This new interface can be used for setting default values like so:
const defaults: FooDefaults = {
test2: 'bar'
}