I’ve been trying to test my lightning application(typescript) with cypress. According to the documentation adding the below code should set the id on the HTML element.
get id() {
return 'BrowsePage'
}
Error -
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.
@jps@Ben Indeed this was a miss! Thanks for letting us know. I’ve created an Issue + PR for this. It will likely land in our next monthly release. In the mean time, you may add something like this above it to ignore the error:
// @ts-expect-error This version of Lightning's TS definitions do not support overriding this getter with a string.
When you finally upgrade to the the fixed Lightning version, TypeScript will let you know, via errors, that you can remove those directive comments.