Skip to content

Commit 1281416

Browse files
committed
refactor: Expand Types
1 parent 882212e commit 1281416

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/auth/authclient.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Gaxios, GaxiosOptions, GaxiosPromise, GaxiosResponse} from 'gaxios';
1717

1818
import {DefaultTransporter, Transporter} from '../transporters';
1919
import {Credentials} from './credentials';
20-
import {Headers} from './oauth2client';
20+
import {GetAccessTokenResponse, Headers} from './oauth2client';
2121
import {OriginalAndCamel, originalOrCamelOptions} from '../util';
2222

2323
/**
@@ -128,10 +128,7 @@ export interface CredentialsClient {
128128
* @return A promise that resolves with the current GCP access token
129129
* response. If the current credential is expired, a new one is retrieved.
130130
*/
131-
getAccessToken(): Promise<{
132-
token?: string | null;
133-
res?: GaxiosResponse | null;
134-
}>;
131+
getAccessToken(): Promise<GetAccessTokenResponse>;
135132

136133
/**
137134
* The main authentication interface. It takes an optional url which when

src/auth/passthrough.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import {GaxiosOptions} from 'gaxios';
1616
import {AuthClient} from './authclient';
17+
import {GetAccessTokenResponse, Headers} from './oauth2client';
1718

1819
/**
1920
* An AuthClient without any Authentication information. Useful for:
@@ -44,7 +45,7 @@ export class PassThroughClient extends AuthClient {
4445
*
4546
* @returns {}
4647
*/
47-
async getAccessToken() {
48+
async getAccessToken(): Promise<GetAccessTokenResponse> {
4849
return {};
4950
}
5051

@@ -54,7 +55,11 @@ export class PassThroughClient extends AuthClient {
5455
*
5556
* @returns {}
5657
*/
57-
async getRequestHeaders() {
58+
async getRequestHeaders(): Promise<Headers> {
5859
return {};
5960
}
6061
}
62+
63+
const a = new PassThroughClient();
64+
65+
a.getAccessToken();

0 commit comments

Comments
 (0)