I am looking to define a unique type that must be a function which, when executed, will always produce an object containing the property type: string
. The input parameters for this function are of no concern.
For instance:
foo(1, 'bar'); // results in { type: '', etc: 1 }
baz('bar', new Date()); // yields { type: '', xyz: 2 }
bar(); // generates { type: '', etc: 3, so: 10 }
All these scenarios should align with the desired type. What matters is that the output contains the property type: string
upon execution, regardless of the parameters passed into the function.
How would I go about defining such a type?