After generating a client for an API using typescript-node, I encountered the following code:
export declare class Api {
getUser(username: string, email: string, idType: '1298' | '2309' | '7801')
}
I need to access the type of the third parameter without having to define '1298' | '2309' | '7801' again in my application.
To achieve this, I used the following approach:
type idType = Parameters<Api['getUser']>[2];
However, I am not completely satisfied with this solution and would prefer to use the key 'idType' instead of its position as a parameter. Is there a way to accomplish this?
Any help or insights on this matter would be greatly appreciated. Thank you.