fixes for TypeScript 5.0

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-03-25 15:30:22 +01:00
parent cc0e135cb9
commit 2898b6c8d5
22 changed files with 72 additions and 45 deletions
@@ -101,7 +101,9 @@ export class MockStorageApi implements StorageApi {
});
}
observe$<T>(key: string): Observable<StorageValueSnapshot<T>> {
observe$<T extends JsonValue>(
key: string,
): Observable<StorageValueSnapshot<T>> {
return this.observable.filter(({ key: messageKey }) => messageKey === key);
}
@@ -109,7 +111,7 @@ export class MockStorageApi implements StorageApi {
return `${this.namespace}/${encodeURIComponent(key)}`;
}
private notifyChanges<T>(message: StorageValueSnapshot<T>) {
private notifyChanges<T extends JsonValue>(message: StorageValueSnapshot<T>) {
for (const subscription of this.subscribers) {
subscription.next(message);
}
@@ -208,7 +208,7 @@ export function wrapInTestApp(
let wrappedElement: React.ReactElement;
if (Component instanceof Function) {
wrappedElement = <Component />;
wrappedElement = React.createElement(Component as ComponentType);
} else {
wrappedElement = Component as React.ReactElement;
}
@@ -233,7 +233,7 @@ export async function renderInTestApp(
): Promise<RenderResult> {
let wrappedElement: React.ReactElement;
if (Component instanceof Function) {
wrappedElement = <Component />;
wrappedElement = React.createElement(Component as ComponentType);
} else {
wrappedElement = Component as React.ReactElement;
}