Can I accomplish this with TypeScript? Here is the source code I currently have:
interface FormStore<T> {
type: T;
}
interface Form<T> extends FormStore<T> {
email: T;
phone: T;
password: T;
}
interface FormState<R> {
form: Form<string>;
validate: Form<boolean>;
}
I am looking to reuse the type FormState<R>
and create a new one with a different argument. Essentially, replacing Form
with R
:
// This example doesn't work, just for demonstration purposes
interface FormState<R> {
form: R<string>;
validate: R<boolean>;
}
// another file
FormState<CustomForm>