Background
So I have a problem getting specific Parameters from a function which is overloaded. For example:
// someLib.d.ts
type Component<T> = {};
type A = {};
type B = {};
type C = {};
type Opts = {};
type ModernOpts = {};
export declare function mount(component: A, options: Opts): Component<A>;
export declare function mount(component: B, options: Opts): Component<B>;
export declare function mount(component: C, options: ModernOpts): Component<C>;
The problem is, somehow if I do this on another file:
import { mount } from 'someLib';
type specificMountParams = Parameters<typeof mount>;
The param I get is [C, ModernOpts]
, and it seems like there's no way to get the parameter of [A, Opts]
, or [B, Opts]
.
Question
Is there any way to retrieve specific parameter from overloaded functions? (So I can get [A, Opts]
parameter)
Limitation and Info
Those types (A, B, Opts)
are not exported by the library, and I need to create a function that needs such type to do something similar.