Skip to content

Commit b689469

Browse files
committed
feat: add type parameter handling to angular output plugin
1 parent 14881b4 commit b689469

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

packages/angular-output-target/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@angular/forms": "8.2.14"
4040
},
4141
"peerDependencies": {
42-
"@stencil/core": "^2.9.0"
42+
"@stencil/core": "^2.17.2"
4343
},
4444
"jest": {
4545
"transform": {

packages/angular-output-target/src/generate-angular-component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const createComponentDefinition = (
3030
}
3131

3232
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
33+
const classTypeParams =
34+
cmpMeta.componentClassTypeParameters.length > 0
35+
? `<${cmpMeta.componentClassTypeParameters.join(',')}>`
36+
: '';
3337

3438
const outputsInterface: Set<string> = new Set();
3539
const outputReferenceRemap: { [p: string]: string } = {};
@@ -90,7 +94,7 @@ export const createComponentDefinition = (
9094
const lines = [
9195
'', // Empty first line
9296
`${[...outputsInterface].join('\n')}
93-
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {${componentEvents.length > 1 ? componentEvents.join('\n') : ''}}
97+
export declare interface ${tagNameAsPascal}${classTypeParams} extends Components.${tagNameAsPascal}${classTypeParams} {${componentEvents.length > 1 ? componentEvents.join('\n') : ''}}
9498
9599
${getProxyCmp(
96100
cmpMeta.tagName,
@@ -101,7 +105,7 @@ ${getProxyCmp(
101105
@Component({
102106
${directiveOpts.join(',\n ')}
103107
})
104-
export class ${tagNameAsPascal} {`,
108+
export class ${tagNameAsPascal}${classTypeParams} {`,
105109
];
106110

107111
lines.push(' protected el: HTMLElement;');

0 commit comments

Comments
 (0)