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

Add better localize keys typings for config pages #17815

Merged
merged 10 commits into from
Sep 5, 2023

Conversation

piitaya
Copy link
Member

@piitaya piitaya commented Sep 4, 2023

Proposed change

Improve typings for come config pages :

  • automation
  • info
  • scene
  • lovelace

I also dropped thingtalk unused files and removed some not needed localize exclusions.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@piitaya piitaya changed the title Localize keys typings Better localize keys typings for config pages Sep 4, 2023
@piitaya piitaya changed the title Better localize keys typings for config pages Add better localize keys typings for config pages Sep 4, 2023
…er-calendar.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
@@ -59,7 +68,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
"ui.panel.config.lovelace.dashboards.picker.headers.icon"
),
type: "icon",
template: (icon, dashboard) =>
template: (icon: DataTableItem["icon"], dashboard: DataTableItem) =>
Copy link
Member

Choose a reason for hiding this comment

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

Instead, set the type of columns to DataTableColumnContainer<DataTableItem>, it makes the extra typing of dashboard unneeded

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to infer the first parameter by improving the DataTableColumnContainer type but I did not succeed because we can have custom key and this parameter can be undefined. I wonder if we can just drop the first one and keep the second one only (DataTableItem). I will be less confusing to use.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, agree

@bramkragten bramkragten merged commit f7f1a0c into dev Sep 5, 2023
9 checks passed
@bramkragten bramkragten deleted the localize_keys_typings branch September 5, 2023 09:39
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants