-
Notifications
You must be signed in to change notification settings - Fork 23
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
Enable strict template checks #2711
Enable strict template checks #2711
Conversation
libs/designsystem/src/lib/components/page-local-navigation/page-local-navigation.component.html
Outdated
Show resolved
Hide resolved
libs/designsystem/src/lib/components/segmented-control/segmented-control.component.html
Outdated
Show resolved
Hide resolved
@@ -12,7 +12,8 @@ | |||
"annotateForClosureCompiler": true, | |||
"skipTemplateCodegen": true, | |||
"strictMetadataEmit": true, | |||
"fullTemplateTypeCheck": true, | |||
"strictTemplates": true, | |||
"strictDomEventTypes": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disabled strictDomEventTypes
because it throws an error each time we try to access a property on a DOM event. Fx:
<input (change)="onChange($event.target.value)" />
All events are typed as a generic Event
, which doesn't allow us to access $event.detail.checked
or $event.target.value
, which we do in many components. I did initially handle it by passing the event to the method and do the typing in there. That solution was a bit cumbersome, especially when doing it for Ionic events, that needs to be handled like this:
import { ItemReorderEventDetail } from '@ionic/angular';
doReorder(event: Event) {
const customEvent = event as CustomEvent<ItemReorderEventDetail>;
// replace event usages with customEvent
}
Since we have to type cast the event in the method, I think we lose the value of type checking the input in the template.
In the issue, Rasmus wrote " be aware of brekaing changes" did you nit find any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not optimal - but good enough :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goood...
Which issue does this PR close?
This PR closes #1985
What is the new behavior?
We will keep (and getting more strict) type checking our HTML files.
Does this PR introduce a breaking change?
Are there any additional context?
In the "describe the solution you'd like" section in the issue it says
This already seems to have been handled in #2099.
Checklist:
The following tasks should be carried out in sequence in order to follow the process of contributing correctly.
Reminders
Review
When the pull request has been approved it will be merged to
develop
by Team Kirby.