I'm new to typescript and I'm struggling with some basic syntax questions. Probably these are so basic that I wasn't able to find a good guide / tutorial that explains the stuff.
Here is the code:
export const createEntity = async <T extends EntityConstructor>(
Constructor: T,
input: Partial<InstanceType<T>>,
): Promise<InstanceType<T>> => {
const instance = Constructor.create(input);
return validateAndSaveEntity(instance as InstanceType<T>);
};
- what does
< >do after theasynckeyword? - I see that the code in
( )after the< >keyword specify input variables and their types. - what does
< >do inPromise< >?