Skip to content

Commit a3ecb45

Browse files
committed
grpc-js: Return never from functions that always throw
1 parent c1d68a0 commit a3ecb45

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/grpc-js/src/channel-credentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class InsecureChannelCredentialsImpl extends ChannelCredentials {
173173
super(callCredentials);
174174
}
175175

176-
compose(callCredentials: CallCredentials): ChannelCredentials {
176+
compose(callCredentials: CallCredentials): never {
177177
throw new Error('Cannot compose insecure credentials');
178178
}
179179

packages/grpc-js/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ export type Call =
207207

208208
/* eslint-disable @typescript-eslint/no-explicit-any */
209209

210-
export const loadObject = (value: any, options: any) => {
210+
export const loadObject = (value: any, options: any): never => {
211211
throw new Error(
212212
'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'
213213
);
214214
};
215215

216-
export const load = (filename: any, format: any, options: any) => {
216+
export const load = (filename: any, format: any, options: any): never => {
217217
throw new Error(
218218
'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'
219219
);

packages/grpc-js/src/resolving-load-balancer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export class ResolvingLoadBalancer implements LoadBalancer {
312312
updateAddressList(
313313
addressList: SubchannelAddress[],
314314
lbConfig: LoadBalancingConfig | null
315-
) {
315+
): never {
316316
throw new Error('updateAddressList not supported on ResolvingLoadBalancer');
317317
}
318318

packages/grpc-js/src/server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class Server {
231231
}
232232

233233

234-
addProtoService(): void {
234+
addProtoService(): never {
235235
throw new Error('Not implemented. Use addService() instead');
236236
}
237237

@@ -311,7 +311,7 @@ export class Server {
311311
});
312312
}
313313

314-
bind(port: string, creds: ServerCredentials): void {
314+
bind(port: string, creds: ServerCredentials): never {
315315
throw new Error('Not implemented. Use bindAsync() instead');
316316
}
317317

@@ -696,7 +696,7 @@ export class Server {
696696
}
697697
}
698698

699-
addHttp2Port(): void {
699+
addHttp2Port(): never {
700700
throw new Error('Not yet implemented');
701701
}
702702

0 commit comments

Comments
 (0)