Skip to content

Commit

Permalink
feat: add type parameter handling to angular output plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
deleonio committed Jul 26, 2022
1 parent 14881b4 commit b689469
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/angular-output-target/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@angular/forms": "8.2.14"
},
"peerDependencies": {
"@stencil/core": "^2.9.0"
"@stencil/core": "^2.17.2"
},
"jest": {
"transform": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const createComponentDefinition = (
}

const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName);
const classTypeParams =
cmpMeta.componentClassTypeParameters.length > 0
? `<${cmpMeta.componentClassTypeParameters.join(',')}>`
: '';

const outputsInterface: Set<string> = new Set();
const outputReferenceRemap: { [p: string]: string } = {};
Expand Down Expand Up @@ -90,7 +94,7 @@ export const createComponentDefinition = (
const lines = [
'', // Empty first line
`${[...outputsInterface].join('\n')}
export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {${componentEvents.length > 1 ? componentEvents.join('\n') : ''}}
export declare interface ${tagNameAsPascal}${classTypeParams} extends Components.${tagNameAsPascal}${classTypeParams} {${componentEvents.length > 1 ? componentEvents.join('\n') : ''}}
${getProxyCmp(
cmpMeta.tagName,
Expand All @@ -101,7 +105,7 @@ ${getProxyCmp(
@Component({
${directiveOpts.join(',\n ')}
})
export class ${tagNameAsPascal} {`,
export class ${tagNameAsPascal}${classTypeParams} {`,
];

lines.push(' protected el: HTMLElement;');
Expand Down

0 comments on commit b689469

Please sign in to comment.