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

Enable strict template checks #2711

Merged
merged 11 commits into from
Feb 23, 2023

Conversation

mark-drastrup
Copy link
Contributor

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?

  • Yes
  • No

Are there any additional context?

In the "describe the solution you'd like" section in the issue it says

Change the enum to a string union-type or a union of strings and the specific size/themecolor enums that already exist.
Beware of breaking changes in this regard.

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

  • Make sure you have implemented tests following the guidelines in: "The good: Test".
  • Make sure you have updated the cookbook with examples and showcases (for bug fixes, enhancements & new components).

Review

  • Determine if your changes are a fix, feature or breaking-change, and add the matching label to your PR. If it is tooling, dependency updates or similar, add ignore-for-release.
  • Do a self-review.
  • Request that the changes are code-reviewed
  • Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be merged to develop by Team Kirby.

@mark-drastrup mark-drastrup added the ignore-for-release Housekeeping, tooling etc. that have no relevance for consumers of Kirby label Jan 2, 2023
@github-actions github-actions bot temporarily deployed to pr-1985-enable-strict-template-checks January 2, 2023 14:41 Inactive
@@ -12,7 +12,8 @@
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictTemplates": true,
"strictDomEventTypes": false,
Copy link
Contributor Author

@mark-drastrup mark-drastrup Jan 2, 2023

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.

@github-actions github-actions bot temporarily deployed to pr-1985-enable-strict-template-checks January 17, 2023 09:44 Inactive
@kodeaben
Copy link
Contributor

In the issue, Rasmus wrote " be aware of brekaing changes" did you nit find any?

@github-actions github-actions bot temporarily deployed to pr-1985-enable-strict-template-checks February 1, 2023 15:10 Inactive
@github-actions github-actions bot temporarily deployed to pr-1985-enable-strict-template-checks February 1, 2023 15:16 Inactive
@mictro mictro requested review from mictro and removed request for jkaltoft February 20, 2023 12:39
mictro
mictro previously approved these changes Feb 22, 2023
Copy link
Contributor

@mictro mictro left a 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 :)

Copy link
Contributor

@mictro mictro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goood...

@mark-drastrup mark-drastrup merged commit eeb1c70 into develop Feb 23, 2023
@mark-drastrup mark-drastrup deleted the enhancement/1985-enable-strict-template-checks branch February 23, 2023 07:53
SigurdVilstrup pushed a commit that referenced this pull request Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release Housekeeping, tooling etc. that have no relevance for consumers of Kirby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Enable strictTemplate checks
3 participants