import Component1 from './Component1.svelte';
import Component2 from './Component2.svelte';
interface complexObject {
comp1 : Component1
comp2: Component2
}
let newComplexObj:complexObjects = {
comp1: Component1, <------ This is where error happens
comp2: Component2 <------- This is where error happens
}
Type 'typeof Component1__SvelteComponent_' is missing the following properties from type 'Component1__SvelteComponent_': $$prop_def, $$events_def, $$slot_def, $on, and 5 more.ts(2740)
These are my typescript configurations:
"compilerOptions": {
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strict": true,
"importsNotUsedAsValues": "preserve"
}
It does render correctly in browser and I get no errors during runtime, but in the IDE it shows me that error.
CodePudding user response:
You are not setting instances, you setting the constructor which is typeof
.
interface complexObject {
comp1: typeof Component1,
comp2: typeof Component2,
}
(It is part of the error message, by the way, but easy to miss in all the noise.)