Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add type parameter handling to angular output plugin #279

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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