I am currently developing a mapper that will facilitate the translation between a serialized entity state and a form state.
In the context of two given interfaces A and B, I am exploring ways to derive a third interface C that includes properties present in A but not in B. How can I achieve this?
interface A {
name: string;
age: number;
id: string;
version: number;
}
// Potentially defined as interface B extends Omit<A, "version" | "id"> {}
interface B {
name: string;
age: number;
}
interface PropertiesPresentInADeficientInB {
// ???
}
// Here is an illustration of my mapper interface for this use case
interface IEntityFormStateMapper<
E extends Entity<A>,
FS extends B,
OP extends PropertiesPresentInADeficientInB
> {
toEntity: (formState: FS, omittedEntityProps: OP) => Result<Error, E>;
toFormState: (entity?: E) => Result<Error, [FS, OP]>;
}