Fix some more type errors and turn on TS strict mode
Possible now that svelte2tsx has fixed a few bugs!
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => $contextStore.register(id));
|
onMount(() => $contextStore?.register(id));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p {...$$restProps} {...$contextStore?.props} {id}>
|
<p {...$$restProps} {...$contextStore?.props} {id}>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
$: {
|
$: {
|
||||||
open =
|
open =
|
||||||
open === undefined && openClosedState !== undefined
|
open === undefined && openClosedState !== undefined
|
||||||
? match($openClosedState, {
|
? match($openClosedState!, {
|
||||||
[State.Open]: true,
|
[State.Open]: true,
|
||||||
[State.Closed]: false,
|
[State.Closed]: false,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => $contextStore.register(id));
|
onMount(() => $contextStore!.register(id));
|
||||||
|
|
||||||
let allProps = { ...$$restProps, ...$contextStore.props, id };
|
let allProps = { ...$$restProps, ...$contextStore!.props, id } as any;
|
||||||
if (passive) delete allProps["onClick"];
|
if (passive) delete allProps["onClick"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
export function portal(element: HTMLElement, target: HTMLElement) {
|
export function portal(element: HTMLElement, target: HTMLElement | null | undefined) {
|
||||||
target.append(element);
|
if (target) {
|
||||||
|
target.append(element);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
update(newTarget: HTMLElement) {
|
update(newTarget: HTMLElement) {
|
||||||
target = newTarget;
|
target = newTarget;
|
||||||
newTarget.append(element);
|
newTarget.append(element);
|
||||||
},
|
},
|
||||||
destroy() {
|
destroy() {
|
||||||
if (target.childNodes.length <= 0) {
|
if (target && target.childNodes.length <= 0) {
|
||||||
target.parentElement?.removeChild(target);
|
target.parentElement?.removeChild(target);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"module": "es2020",
|
"module": "es2020",
|
||||||
"lib": ["es2020", "DOM"],
|
"lib": ["es2020", "DOM"],
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
|
"strict": true,
|
||||||
/**
|
/**
|
||||||
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
|
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
|
||||||
to enforce using \`import type\` instead of \`import\` for Types.
|
to enforce using \`import type\` instead of \`import\` for Types.
|
||||||
|
|||||||
Reference in New Issue
Block a user