I have an interface in my application:
interface Asset {
id: string;
internal_id: string;
usage: number;
}
that is part of a post interface:
interface Post {
asset: Asset;
}
I also have an interface that is for a post draft, where the asset object might only be partially constructed
interface PostDraft {
asset: Asset;
}
I want to allow a PostDraft
object to have a partial asset object while still checking types on the properties that are there (so I don't want to just swap it out with any
).
I basically want a way to be able to generate the following:
interface AssetDraft {
id?: string;
internal_id?: string;
usage?: number;
}
without entirely re-defining the Asset
interface. Is there a way to do this? If not, what would the smart way to arrange my types in this situation be?