I am facing an issue with my code where the getter's return type is set to any
, even though the actual return type should be clear. There are certain additional functions triggering this behavior:
// This is necessary for reproduction
const wrapperFunction = <T>(obj: T) => obj;
const store = wrapperFunction({
value: 'Super max',
get simpleGetter() {
return this.value;
},
// This is necessary for reproduction
bark() {
console.log('WUF');
},
});
// This results in 'any' type
const val = store.simpleGetter;
// This will log "Super max"
console.log(val);
Here is a link to TypeScript playground for full reproduction: Full reproduction