controller should be marked nullable

While 'SvelteComponent | null' seems to make it into the .tsx file
created by svelte2tsx, the subsequent tsc call seems to discard the
'| null' part when creating the .d.ts file. Hack around it with a cast
for now; this may be fixed if we move to ts_project in the future.
This commit is contained in:
Damien Elmes 2020-12-29 15:19:21 +10:00
parent e948544b59
commit ddc48d8897
2 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,7 @@
export let search: string;
export let days: number;
export let controller: SvelteComponent;
export let controller: SvelteComponent | null;
let active = false;
let sourceData: pb.BackendProto.GraphsOut | null = null;

View File

@ -1,6 +1,10 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/* eslint
@typescript-eslint/no-explicit-any: "off",
*/
import type { SvelteComponent } from "svelte/internal";
import { setupI18n } from "anki/i18n";
@ -24,7 +28,7 @@ export { RevlogRange } from "./graph-helpers";
export function graphs(
target: HTMLDivElement,
graphs: SvelteComponent[],
{ search = "deck:current", days = 365, controller = null } = {}
{ search = "deck:current", days = 365, controller = null as any } = {}
): void {
const nightMode = checkNightMode();