-
-
Notifications
You must be signed in to change notification settings - Fork 912
Description
Hi there,
while upgrading a project using Shoelace (latest version) from Typescript 5.8 to 5.9.2 i noticed there are multiple components that throw errors with the latest stable ts version. The errors can be traced back to the implementation of the property autocorrect, that is defined as string for example in SlInput. Typescripts lib.dom.d.ts defines the property as autocorrect: boolean. Typescript 5.9 seems to be more strict (it seems that 5.8 also defines it this way) and is not able to compile anymore.
You may try the following example for this (taken from a vite sample and shortened for brevity here):
import * as sl from '@shoelace-style/shoelace';
// This is just done to create an easily reproducible example.
// It does not matter what you do with SlInput, when you use it,
// it will crash
class MyInput extends sl.SlInput {
render() {
return super.render();
}
}
customElements.define('ts59broken-input', MyInput);The code leads to the following compiler error in TS5.9:
src/main.ts:23:36 - error TS2345: Argument of type 'typeof MyInput' is not assignable to parameter of type 'CustomElementConstructor'.
Construct signature return types 'MyInput' and 'HTMLElement' are incompatible.
The types of 'autocorrect' are incompatible between these types.
Type 'string' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
23 customElements.define('ts59broken-input', MyInput);As the lib.dom.d.ts was not changed, I assume it is some heuristic in Typescript itself that is now way stricter checking. It basically happens because ShoelaceElements extend LitElement that extends HTMLElement from lib.dom.d.ts, which has the boolean value in it.
It may very well be that this also affects WebAwesome, too.