How can I have type annotations to an import using the require() function? For instance I have this authenticate function from GCP Auth service:
const {authenticate} = require('@google-cloud/local-auth');
I see in the node_modules there's a index.d.ts file with type annotations for it:
import { OAuth2Client } from 'google-auth-library';
export interface LocalAuthOptions {
keyfilePath: string;
scopes: string[] | string;
}
export declare function authenticate(options: LocalAuthOptions): Promise<OAuth2Client>;
But when I try to use the functions it shows as type any.
How can I add the type annotations to it?