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

TypeScript: Unable to override the id accessor of a Component with string #456

Closed
frank-weindel opened this issue Feb 22, 2023 · 0 comments · Fixed by #457 or #474
Closed

TypeScript: Unable to override the id accessor of a Component with string #456

frank-weindel opened this issue Feb 22, 2023 · 0 comments · Fixed by #457 or #474
Assignees

Comments

@frank-weindel
Copy link
Contributor

frank-weindel commented Feb 22, 2023

A user on our forums made a post reporting that when they add a get accessor for the property id to a Component class like so...

class MyComponent extends Lightning.Component {
  get id() {
    return 'BrowsePage'
  }
}

...it triggers the following TypeScript errors:

Property ‘id’ in type ‘Item’ is not assignable to the same property in base type ‘Component<ItemTemplateSpec, TypeConfig>’.
  Type ‘string’ is not assignable to type ‘number’.
‘id’ is defined as a property in class ‘Component<ItemTemplateSpec, TypeConfig>’, but is overridden here in ‘Item’ as an accessor.

The user, as well as another user who chimed in, both implied that they use the id property override to inform the HTML tag that is produced by the Lightning Inspector. The IDs in these HTML elements are then used in Cypress testing for QA validation.

@frank-weindel frank-weindel changed the title TypeScript: Unable to override the id accessor of a Component TypeScript: Unable to override the id accessor of a Component with string Feb 22, 2023
@frank-weindel frank-weindel self-assigned this Feb 27, 2023
@uguraslan uguraslan added the bug label Mar 13, 2023
@uguraslan uguraslan added the fixed label Apr 3, 2023
@uguraslan uguraslan added this to the Lightning v2.10.0 milestone Apr 13, 2023
@uguraslan uguraslan mentioned this issue Apr 14, 2023
2 tasks
@uguraslan uguraslan linked a pull request Apr 17, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment