"children" fabric causes TypeScript error
Qsppl opened this issue · 4 comments
Qsppl commented
import { children, define } from "https://esm.sh/hybrids@8.2.11"
export interface IFirstComponent extends HTMLElement {
prop2: number
}
const FirstComponent = define<IFirstComponent>({
tag: "a-first",
prop2: 0
})
export interface ISecondComponent extends HTMLElement {
prop1: number
childСomponents: IFirstComponent[]
}
export default define<ISecondComponent>({
tag: "a-second",
prop1: 0,
childСomponents: children(FirstComponent)
})
message:
Type 'Descriptor<ISecondComponent, IFirstComponent>' is not assignable to type 'Property<ISecondComponent, IFirstComponent[]>'.
Type 'Descriptor<ISecondComponent, IFirstComponent>' is not assignable to type 'Descriptor<ISecondComponent, IFirstComponent[]>'.
Types of property 'value' are incompatible.
Type 'IFirstComponent | undefined' is not assignable to type 'IFirstComponent[] | undefined'.
Type 'IFirstComponent' is not assignable to type 'IFirstComponent[]'.
tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"strict": true,
"baseUrl": "./web",
"paths": {
// "/" is not "C:/", but is "./web"
"/*": [ "*" ],
// from module to their declaration
"/modules/fingerprintjsv3.js": ["../node_modules/@fingerprintjs/fingerprintjs/dist/fp"],
"https://esm.sh/mitt@3.0.1": ["../node_modules/mitt/index"],
"https://esm.sh/just-intersect@4.3.0": [ "../node_modules/just-intersect/index" ],
"https://esm.sh/bootstrap@5.3.2": ["../node_modules/@types/bootstrap/index"],
"https://esm.sh/hybrids@8.2.11": ["@types/hybrids"],
"https://esm.sh/colorjs.io@0.4.5": ["../node_modules/colorjs.io/types/src/index"],
"https://esm.sh/ts-debounce@4.0.0": ["../node_modules/ts-debounce/dist/src/index"],
"https://esm.sh/mezr@1.1.0": ["../node_modules/mezr/dist/esm/index"]
},
"skipLibCheck": true
},
"include": [ "./web" ]
}
typescript version: "5.1.6"
smalluban commented
I don't have time to check every TS error (from all of your issues) - can you confirm if the problem is solved by using TS v4
?
FYI: #236 (comment)
Qsppl commented
Typescript version: 4.9.5 did not solve these problems. This appears to be a typo in the types.
smalluban commented
You're right, fixed in f29902f
I'll wait for the bumping version until tomorrow if there will be other things related to TS.
Qsppl commented
Thanks, this solved the problem