I generated a typescript-node client of an API and I have something like this:
export declare class Api {
getUser(username: string, email: string, idType: '1298' | '2309' | '7801')
}
I want to get the type of the third parameter in order to not have to recreate a type '1298' | '2309' | '7801' in my application.
I managed to make it work by doing:
type idType = Parameters<Api['getUser']>[2];
I'm not really satisfied by this solution, I would like to use key 'idType' and not his parameter's position.
How can I do this ?
Thanks.
getUser({idType: '1298' | '2309' | '7801'})