You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to use polytype in my angular9/typescript project
Consider the following code for single class inheritance in typescript:
export class AbstractBaseComponent{
form: FormGroup
}
@Component ({
selector: 'pim'
template: `
<form [formGroup] = 'form'>
</form>
`
})
export class PimComponent extends AbstractBaseComponent {
// the form of the template is referenced by the form of the Abstract
BaseComponent as expected
}
For polytype multi-inheritance
@Component ({
selector: 'pim'
template: `
<form [formGroup] = 'form'>
</form>
`
})
export class PimComponent extends classes(AbstractBaseComponent) {
// the form of the template is NOT referenced by the form of the AbstractBaseComponent as expected
}
What am I doing incorrectly. My Webstorm IDE flag the template form as error (Is this IDE failure or polytype failure?)
Thanks for your help
The text was updated successfully, but these errors were encountered:
I'm having a problem trying to reproduce this on my machine. The sample code doesn't compile because of a missing comma after selector: 'pim'. After fixing that, Angular complains about the unknown property formGroup in the inline template.
This is what I did: first I set up an Angular 9 project from the command line.
npm i -g @angular/cling new test --interactive=falsecd testnpm i polytypeng generate component pim --inline-template
Then I edited src/app/pim/pim.component.ts ending up with this code:
import{Component}from'@angular/core';import{FormGroup}from'@angular/forms';import{classes}from'polytype';exportclassAbstractBaseComponent{form: FormGroup}
@Component({selector: 'pim',template: ` <form [formGroup] = 'form'> </form>`})exportclassPimComponentextendsclasses(AbstractBaseComponent){// the form of the template is NOT referenced by the form of the AbstractBaseComponent as expected}
When I run ng build, this is what I'm getting:
ERROR in src/app/pim/pim.component.ts:13:8 - error NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'.
13 <form [formGroup] = 'form'>
~~~~~~~~~~~~~~~~~~~~
This is obviously not related to Polytype.
And in fact, replacing classes(AbstractBaseComponent) with AbstractBaseComponent doesn't make a difference.
It would be helpful if you could post a reproducible example, so I can check why the code in your first snippet is not producing the same error I'm getting here in the first place.
Hi,
I am trying to use polytype in my angular9/typescript project
Consider the following code for single class inheritance in typescript:
For polytype multi-inheritance
What am I doing incorrectly. My Webstorm IDE flag the template form as error (Is this IDE failure or polytype failure?)
Thanks for your help
The text was updated successfully, but these errors were encountered: