diff --git a/src/generator.ts b/src/generator.ts index 0f3c1407..f0e6df46 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -363,10 +363,9 @@ function generateStandaloneInterface(ast: TNamedInterface, options: Options): st function generateStandaloneType(ast: ASTWithStandaloneName, options: Options): string { return ( (hasComment(ast) ? generateComment(ast.comment) + '\n' : '') + - `export type ${toSafeString(ast.standaloneName)} = ${generateType( - omit(ast, 'standaloneName') as AST /* TODO */, - options - )}` + `export type ${toSafeString(ast.standaloneName)}` + + (ast.tsGenericParams ? `<${ast.tsGenericParams.join(', ')}>` : '') + + ` = ${generateType(omit(ast, 'standaloneName') as AST /* TODO */, options)}` ) } diff --git a/src/types/AST.ts b/src/types/AST.ts index 0bcb7bff..44a3cb68 100644 --- a/src/types/AST.ts +++ b/src/types/AST.ts @@ -15,7 +15,10 @@ export interface AbstractAST { export type ASTWithComment = AST & { comment: string } export type ASTWithName = AST & { keyName: string } -export type ASTWithStandaloneName = AST & { standaloneName: string } +export type ASTWithStandaloneName = AST & { + standaloneName: string, + tsGenericParams?: string[], +} export function hasComment(ast: AST): ast is ASTWithComment { return 'comment' in ast && ast.comment != null && ast.comment !== ''