Say I have an object like this
const someObject: SomeObject = {
someMethod: (function() {
function mainMethod(x) {return x+1}
yolo.subMethod = function(x) { return x-1 }
return mainMethod;
})()
}
I tried defining its type like this:
type SomeObject = {
someMethod: {
(x:number): number
subMethod(x:number): number
}
}
however I am getting Parameter 'x' implicitly has an 'any' type.
warnings in everything inside the IIFE, which means my type is not applied.
I have already read this similar answer however it doesn't seem to work.
I am quite new to TS, and I am not yet familiar with more intricate usecases such as this, so any help would be much appreciated.