The object looks like this
export const templates = {
[EventType.EventType1 + OutputSources.Email]: (params: { documentName: string; link: string }) => {
return "some html data";
},
[EventType.EventType2 + OutputSources.Email]: (params: { documentName: string }) => {
return "some html data";
},
[EventType.EventType1 + OutputSources.Notification]: (params: { documentName: string }) => {
return "some html data";
},
} as const;
I want to have a type that contains parameters of each of these function as a union, for example the result for above will look like.
type possibleFunctionArgs = {documentName:string,link:string} | {documentName:string}
What I’ve already tried and failed
type lastFailingAttemptToGetTypes = Parameters<typeof templates[keyof typeof templates]>
For the above code I’m always getting only {documentName:string,link:string} , always getting the one with highest number of parameters