From 2fae44156825d080a78ad262a15cde24683d1c57 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Wed, 4 May 2022 23:14:09 +0800 Subject: [PATCH 1/2] fix: `waitUntil` and `transaction` type --- baselines/dom.generated.d.ts | 6 +++++- baselines/dom.iterable.generated.d.ts | 2 +- baselines/serviceworker.generated.d.ts | 8 ++++++-- baselines/serviceworker.iterable.generated.d.ts | 2 +- baselines/sharedworker.generated.d.ts | 6 +++++- baselines/sharedworker.iterable.generated.d.ts | 2 +- baselines/webworker.generated.d.ts | 8 ++++++-- baselines/webworker.iterable.generated.d.ts | 2 +- inputfiles/removedTypes.jsonc | 13 ------------- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index d71a8ac85..cad4f11ff 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -570,6 +570,10 @@ interface IDBObjectStoreParameters { keyPath?: string | string[] | null; } +interface IDBTransactionOptions { + durability?: IDBTransactionDurability; +} + interface IDBVersionChangeEventInit extends EventInit { newVersion?: number | null; oldVersion?: number; @@ -8495,7 +8499,7 @@ interface IDBDatabase extends EventTarget { */ deleteObjectStore(name: string): void; /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | string[], mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | EventListenerOptions): void; diff --git a/baselines/dom.iterable.generated.d.ts b/baselines/dom.iterable.generated.d.ts index 5f0e58220..73b88ad29 100644 --- a/baselines/dom.iterable.generated.d.ts +++ b/baselines/dom.iterable.generated.d.ts @@ -101,7 +101,7 @@ interface Headers { interface IDBDatabase { /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | Iterable, mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | Iterable, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; } interface IDBObjectStore { diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index a3375c2ca..1a0a79f0d 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -251,6 +251,10 @@ interface IDBObjectStoreParameters { keyPath?: string | string[] | null; } +interface IDBTransactionOptions { + durability?: IDBTransactionDurability; +} + interface IDBVersionChangeEventInit extends EventInit { newVersion?: number | null; oldVersion?: number; @@ -1385,7 +1389,7 @@ declare var EventTarget: { /** Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. */ interface ExtendableEvent extends Event { - waitUntil(f: any): void; + waitUntil(f: Promise): void; } declare var ExtendableEvent: { @@ -1706,7 +1710,7 @@ interface IDBDatabase extends EventTarget { */ deleteObjectStore(name: string): void; /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | string[], mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | EventListenerOptions): void; diff --git a/baselines/serviceworker.iterable.generated.d.ts b/baselines/serviceworker.iterable.generated.d.ts index fcff319ed..b1289117b 100644 --- a/baselines/serviceworker.iterable.generated.d.ts +++ b/baselines/serviceworker.iterable.generated.d.ts @@ -39,7 +39,7 @@ interface Headers { interface IDBDatabase { /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | Iterable, mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | Iterable, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; } interface IDBObjectStore { diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 2108a6006..fe9307b2d 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -226,6 +226,10 @@ interface IDBObjectStoreParameters { keyPath?: string | string[] | null; } +interface IDBTransactionOptions { + durability?: IDBTransactionDurability; +} + interface IDBVersionChangeEventInit extends EventInit { newVersion?: number | null; oldVersion?: number; @@ -1625,7 +1629,7 @@ interface IDBDatabase extends EventTarget { */ deleteObjectStore(name: string): void; /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | string[], mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | EventListenerOptions): void; diff --git a/baselines/sharedworker.iterable.generated.d.ts b/baselines/sharedworker.iterable.generated.d.ts index ae27bf742..44d6328bd 100644 --- a/baselines/sharedworker.iterable.generated.d.ts +++ b/baselines/sharedworker.iterable.generated.d.ts @@ -39,7 +39,7 @@ interface Headers { interface IDBDatabase { /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | Iterable, mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | Iterable, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; } interface IDBObjectStore { diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index bb6814a2f..63a02b060 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -251,6 +251,10 @@ interface IDBObjectStoreParameters { keyPath?: string | string[] | null; } +interface IDBTransactionOptions { + durability?: IDBTransactionDurability; +} + interface IDBVersionChangeEventInit extends EventInit { newVersion?: number | null; oldVersion?: number; @@ -1446,7 +1450,7 @@ declare var EventTarget: { /** Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. */ interface ExtendableEvent extends Event { - waitUntil(f: any): void; + waitUntil(f: Promise): void; } declare var ExtendableEvent: { @@ -1781,7 +1785,7 @@ interface IDBDatabase extends EventTarget { */ deleteObjectStore(name: string): void; /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | string[], mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | EventListenerOptions): void; diff --git a/baselines/webworker.iterable.generated.d.ts b/baselines/webworker.iterable.generated.d.ts index dac1b87d1..9c0d32794 100644 --- a/baselines/webworker.iterable.generated.d.ts +++ b/baselines/webworker.iterable.generated.d.ts @@ -39,7 +39,7 @@ interface Headers { interface IDBDatabase { /** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */ - transaction(storeNames: string | Iterable, mode?: IDBTransactionMode): IDBTransaction; + transaction(storeNames: string | Iterable, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction; } interface IDBObjectStore { diff --git a/inputfiles/removedTypes.jsonc b/inputfiles/removedTypes.jsonc index 4d02a4f67..73c49c904 100644 --- a/inputfiles/removedTypes.jsonc +++ b/inputfiles/removedTypes.jsonc @@ -59,19 +59,6 @@ "Element": { "implements": ["GeometryUtils", "Region"] }, - "IDBDatabase": { - "methods": { - "method": { - "transaction": { - "signature": { - "0": { - "param": ["options"] - } - } - } - } - } - }, "Navigator": { "implements": [ "NavigatorBadge", From 2ec43e1e825ab4cd5bee4f2315b9d919a22f6df1 Mon Sep 17 00:00:00 2001 From: susiwen8 Date: Thu, 5 May 2022 00:36:53 +0800 Subject: [PATCH 2/2] fix: `waitUntil` type --- inputfiles/overridingTypes.jsonc | 36 +++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 314a930c4..2d52dcf90 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -2010,7 +2010,23 @@ "name": "push", "type": "PushEvent" } - ] + ], + "methods": { + "method": { + "waitUntil": { + "signature": { + "0": { + "param": [ + { + "name": "f", + "overrideType": "Promise" + } + ] + } + } + } + } + } } }, "Cache": { @@ -2688,6 +2704,24 @@ } } }, + "ExtendableEvent": { + "methods": { + "method": { + "waitUntil": { + "signature": { + "0": { + "param": [ + { + "name": "f", + "overrideType": "Promise" + } + ] + } + } + } + } + } + }, "EventTarget": { "methods": { "method": {