From e838cdc3121356ba1c4e11033cdd966d39bd887b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 18 Dec 2023 16:25:51 -0500 Subject: [PATCH] Default typescript templates to unknown --- types/ext/anki-templates-internal.d.ts | 2 +- types/ext/api.d.ts | 2 +- types/ext/cache-map.d.ts | 2 +- types/ext/core.d.ts | 2 +- types/ext/dictionary-data-util.d.ts | 2 +- types/ext/dictionary-database.d.ts | 6 +++--- types/ext/dictionary-worker.d.ts | 6 +++--- types/ext/dom-data-binder.d.ts | 18 +++++++++--------- types/ext/dynamic-property.d.ts | 2 +- types/ext/selector-observer.d.ts | 12 ++++++------ types/ext/task-accumulator.d.ts | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/types/ext/anki-templates-internal.d.ts b/types/ext/anki-templates-internal.d.ts index 4cb500501e..2842765d33 100644 --- a/types/ext/anki-templates-internal.d.ts +++ b/types/ext/anki-templates-internal.d.ts @@ -53,7 +53,7 @@ export type CreateDetails = { media?: AnkiTemplates.Media; }; -export type CachedValue = { +export type CachedValue = { getter: () => T; hasValue: boolean; value: T | undefined; diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 2d78cc06e1..41d3a96dbf 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -34,7 +34,7 @@ import type * as Translator from './translator'; // Generic -export type Handler = ( +export type Handler = ( details: TDetails, sender: (THasSender extends true ? chrome.runtime.MessageSender : void) ) => (TResult | Promise); diff --git a/types/ext/cache-map.d.ts b/types/ext/cache-map.d.ts index 0af7109a4c..fcf969e833 100644 --- a/types/ext/cache-map.d.ts +++ b/types/ext/cache-map.d.ts @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -export type Node = { +export type Node = { key: K | null; value: V | null; previous: Node | null; diff --git a/types/ext/core.d.ts b/types/ext/core.d.ts index b83e6a74ae..d1a4ef8f03 100644 --- a/types/ext/core.d.ts +++ b/types/ext/core.d.ts @@ -41,7 +41,7 @@ export type TokenString = string; export type TokenObject = Record; -export type DeferredPromiseDetails = { +export type DeferredPromiseDetails = { promise: Promise; resolve: (value: T) => void; reject: (reason?: RejectionReason) => void; diff --git a/types/ext/dictionary-data-util.d.ts b/types/ext/dictionary-data-util.d.ts index 751283680d..b78e643956 100644 --- a/types/ext/dictionary-data-util.d.ts +++ b/types/ext/dictionary-data-util.d.ts @@ -45,7 +45,7 @@ export type KanjiFrequenciesMap2Data = { export type TermFrequenciesMap3 = Map; -export type DictionaryFrequency = { +export type DictionaryFrequency = { dictionary: string; frequencies: T[]; }; diff --git a/types/ext/dictionary-database.d.ts b/types/ext/dictionary-database.d.ts index 6569f76bf5..3202ef6017 100644 --- a/types/ext/dictionary-database.d.ts +++ b/types/ext/dictionary-database.d.ts @@ -230,11 +230,11 @@ export type FindMultiBulkData = { indexIndex: number; }; -export type CreateQuery = (item: TItem) => (IDBValidKey | IDBKeyRange | null); +export type CreateQuery = (item: TItem) => (IDBValidKey | IDBKeyRange | null); -export type FindPredicate = (row: TRow, item: TItem) => boolean; +export type FindPredicate = (row: TRow, item: TItem) => boolean; -export type CreateResult = (row: TRow, data: FindMultiBulkData) => TResult; +export type CreateResult = (row: TRow, data: FindMultiBulkData) => TResult; export type DictionarySet = { has(value: string): boolean; diff --git a/types/ext/dictionary-worker.d.ts b/types/ext/dictionary-worker.d.ts index 17030691ee..ac076ab8e6 100644 --- a/types/ext/dictionary-worker.d.ts +++ b/types/ext/dictionary-worker.d.ts @@ -29,7 +29,7 @@ export type InvokeDetails = { formatResult: ((result: TResponseRaw) => TResponse) | null; }; -export type MessageCompleteData = { +export type MessageCompleteData = { action: 'complete'; params: MessageCompleteParams; }; @@ -44,7 +44,7 @@ export type MessageGetImageDetailsData = { params: MessageGetImageDetailsParams; }; -export type MessageCompleteParams = Core.Response; +export type MessageCompleteParams = Core.Response; export type MessageProgressParams = { args: unknown[]; @@ -56,7 +56,7 @@ export type MessageGetImageDetailsParams = { mediaType: string; }; -export type MessageData = MessageCompleteData | MessageProgressData | MessageGetImageDetailsData; +export type MessageData = MessageCompleteData | MessageProgressData | MessageGetImageDetailsData; export type MessageCompleteResultSerialized = { result: DictionaryImporter.Summary; diff --git a/types/ext/dom-data-binder.d.ts b/types/ext/dom-data-binder.d.ts index ca0036c3e6..621ed3d915 100644 --- a/types/ext/dom-data-binder.d.ts +++ b/types/ext/dom-data-binder.d.ts @@ -17,28 +17,28 @@ import type * as TaskAccumulator from './task-accumulator'; -export type CreateElementMetadataCallback = (element: Element) => T | undefined; +export type CreateElementMetadataCallback = (element: Element) => T | undefined; -export type CompareElementMetadataCallback = (metadata1: T, metadata2: T) => boolean; +export type CompareElementMetadataCallback = (metadata1: T, metadata2: T) => boolean; -export type GetValuesCallback = (args: GetValuesDetails[]) => Promise; +export type GetValuesCallback = (args: GetValuesDetails[]) => Promise; -export type SetValuesCallback = (args: SetValuesDetails[]) => Promise; +export type SetValuesCallback = (args: SetValuesDetails[]) => Promise; -export type GetValuesDetails = { +export type GetValuesDetails = { element: Element; metadata: T; }; -export type SetValuesDetails = { +export type SetValuesDetails = { element: Element; metadata: T; value: ValueType; }; -export type OnErrorCallback = (error: Error, stale: boolean, element: Element, metadata: T) => void; +export type OnErrorCallback = (error: Error, stale: boolean, element: Element, metadata: T) => void; -export type ConstructorDetails = { +export type ConstructorDetails = { selector: string; createElementMetadata: CreateElementMetadataCallback; compareElementMetadata: CompareElementMetadataCallback; @@ -47,7 +47,7 @@ export type ConstructorDetails = { onError?: OnErrorCallback | null; }; -export type ElementObserver = { +export type ElementObserver = { element: Element; type: NormalizedElementType; value: unknown; diff --git a/types/ext/dynamic-property.d.ts b/types/ext/dynamic-property.d.ts index 5ec886d27c..ba15257ae6 100644 --- a/types/ext/dynamic-property.d.ts +++ b/types/ext/dynamic-property.d.ts @@ -17,6 +17,6 @@ export type EventType = 'change'; -export type ChangeEventDetails = { +export type ChangeEventDetails = { value: T; }; diff --git a/types/ext/selector-observer.d.ts b/types/ext/selector-observer.d.ts index a84b2addd8..2b3e9381b3 100644 --- a/types/ext/selector-observer.d.ts +++ b/types/ext/selector-observer.d.ts @@ -15,15 +15,15 @@ * along with this program. If not, see . */ -export type OnAddedCallback = (element: Element) => T | undefined; +export type OnAddedCallback = (element: Element) => T | undefined; -export type OnRemovedCallback = (element: Element, data: T) => void; +export type OnRemovedCallback = (element: Element, data: T) => void; -export type OnChildrenUpdatedCallback = (element: Element, data: T) => void; +export type OnChildrenUpdatedCallback = (element: Element, data: T) => void; -export type IsStaleCallback = (element: Element, data: T) => boolean; +export type IsStaleCallback = (element: Element, data: T) => boolean; -export type ConstructorDetails = { +export type ConstructorDetails = { /** A string CSS selector used to find elements. */ selector: string; /** A string CSS selector used to filter elements, or `null` for no filtering. */ @@ -48,7 +48,7 @@ export type MutationRecordLike = { target: Node; }; -export type Observer = { +export type Observer = { element: Element; ancestors: Node[]; data: T; diff --git a/types/ext/task-accumulator.d.ts b/types/ext/task-accumulator.d.ts index f02d449b84..e96ba6a609 100644 --- a/types/ext/task-accumulator.d.ts +++ b/types/ext/task-accumulator.d.ts @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -export type Task = { +export type Task = { data: V; stale: boolean; };