How would one define the return type of the fn function below?
const fn = (propName1: string, propName2: string) => {
return {
[propName1]: () => true
[propName2]: () => 'abc'
}
}
const x = fn('customProp1', 'customProp2')
console.log(x.customProp1)
console.log(x.customProp2)
e.g.
type FN = (propName: string)=> {
[propName1]: ()=>true
[propName2]: ()=>string
}
This is for two custom methods, but ideally the solution should allow for any number of custom methods and properties.