When attempting to infer the type of Data based on input parameters, it correctly infers when the data is an object type; however, it defaults to 'unknown' when the data is a function type. https://i.sstatic.net/wkuQa.png
declare function getTypeOf<Data>(options: { data: Data }): any;
getTypeOf({
data() {
return {
name: "123",
age: 1,
};
},
getData() {
return {
name: 123,
};
},
});
It seems that changing the data to an object or including getData in the type parameters resolves this issue. Still, I'm looking for documentation explaining why this behavior occurs. https://i.sstatic.net/6H39d.png
Any insights or documentation references would be greatly appreciated.