From a582dacffb8820108e4f5e2468b760b38ccfc1f5 Mon Sep 17 00:00:00 2001 From: Karin Agan Date: Mon, 16 Sep 2019 20:21:56 +0300 Subject: [PATCH] Add support for generic type - function type --- lib/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/index.ts b/lib/index.ts index 06573a1..81d780b 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -177,6 +177,7 @@ export interface FunctionType { kind: "function-type"; parameters: Parameter[]; returnType: Type; + typeParameters: TypeParameter[]; } export interface TypeAliasDeclaration extends DeclarationBase { @@ -354,6 +355,7 @@ export const create = { functionType(parameters: Parameter[], returnType: Type): FunctionType { return { kind: "function-type", + typeParameters: [], parameters, returnType }; }, @@ -958,6 +960,7 @@ export function emit(rootDecl: TopLevelDeclaration, { rootFlags = ContextFlags.N } function writeFunctionType(f: FunctionType) { + writeTypeParameters(f.typeParameters); print('('); writeDelimited(f.parameters, ', ', writeParameter); print(')');