grpc-js: Return never from functions that always throw

This commit is contained in:
Dacio Romero 2022-03-01 14:48:25 -08:00
parent c1d68a00ac
commit a3ecb45132
4 changed files with 7 additions and 7 deletions

View File

@ -173,7 +173,7 @@ class InsecureChannelCredentialsImpl extends ChannelCredentials {
super(callCredentials);
}
compose(callCredentials: CallCredentials): ChannelCredentials {
compose(callCredentials: CallCredentials): never {
throw new Error('Cannot compose insecure credentials');
}

View File

@ -207,13 +207,13 @@ export type Call =
/* eslint-disable @typescript-eslint/no-explicit-any */
export const loadObject = (value: any, options: any) => {
export const loadObject = (value: any, options: any): never => {
throw new Error(
'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'
);
};
export const load = (filename: any, format: any, options: any) => {
export const load = (filename: any, format: any, options: any): never => {
throw new Error(
'Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'
);

View File

@ -312,7 +312,7 @@ export class ResolvingLoadBalancer implements LoadBalancer {
updateAddressList(
addressList: SubchannelAddress[],
lbConfig: LoadBalancingConfig | null
) {
): never {
throw new Error('updateAddressList not supported on ResolvingLoadBalancer');
}

View File

@ -231,7 +231,7 @@ export class Server {
}
addProtoService(): void {
addProtoService(): never {
throw new Error('Not implemented. Use addService() instead');
}
@ -311,7 +311,7 @@ export class Server {
});
}
bind(port: string, creds: ServerCredentials): void {
bind(port: string, creds: ServerCredentials): never {
throw new Error('Not implemented. Use bindAsync() instead');
}
@ -696,7 +696,7 @@ export class Server {
}
}
addHttp2Port(): void {
addHttp2Port(): never {
throw new Error('Not yet implemented');
}