I think it’s best to explain with an example: I’m working with winston and are facing this type:
interface LeveledLogMethod {
(message: string, callback: LogCallback): Logger;
(message: string, meta: any, callback: LogCallback): Logger;
(message: string, ...meta: any[]): Logger;
(message: any): Logger;
(infoObject: object): Logger;
}
Now, I want to get the type of meta
in (message: string, ...meta: any[]): Logger
.
The only thing I could come up with is Parameters<LeveledLogMethod>
, which gives me the type [infoObject: object]
(i.e. the parameters of the last signature declared there).
Is there a way to get the parameters of (message: string, ...meta: any[]): Logger
instead?
2