ConstructorParameters is already a TypeScript builtin

This commit is contained in:
Michael Lumish 2020-09-02 13:35:43 -07:00
parent 2d1cb15dec
commit 677741d442
2 changed files with 2 additions and 4 deletions

View File

@ -604,9 +604,8 @@ function generateRootFile(formatter: TextFormatter, root: Protobuf.Root, options
generateServiceImports(formatter, root, options);
formatter.writeLine('');
formatter.writeLine('type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;');
formatter.writeLine('type SubtypeConstructor<Constructor, Subtype> = {');
formatter.writeLine(' new(...args: ConstructorArguments<Constructor>): Subtype;');
formatter.writeLine(' new(...args: ConstructorParameters<Constructor>): Subtype;');
formatter.writeLine('};');
formatter.writeLine('');

View File

@ -4,9 +4,8 @@ import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@g
import { OperationsClient as _google_longrunning_OperationsClient } from './google/longrunning/Operations';
import { EchoClient as _google_showcase_v1beta1_EchoClient } from './google/showcase/v1beta1/Echo';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
new(...args: ConstructorParameters<Constructor>): Subtype;
};
export interface ProtoGrpcType {