From ddc48d88971f5ae9e56cf15f683ab66fc8403f68 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 29 Dec 2020 15:19:21 +1000 Subject: [PATCH] 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. --- ts/graphs/GraphsPage.svelte | 2 +- ts/graphs/bootstrap.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index d01c33175..47b566175 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -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; diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index d27eb0448..0884b99cc 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -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();