Skip to content

Commit

Permalink
Experiment: Convert Promise<void> to Promise<undefined>
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Jul 20, 2023
1 parent 2623fe7 commit 8139c3c
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 93 deletions.
124 changes: 62 additions & 62 deletions src/lib/dom.generated.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib/dom.iterable.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface CSSUnparsedValue {

interface Cache {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) */
addAll(requests: Iterable<RequestInfo>): Promise<void>;
addAll(requests: Iterable<RequestInfo>): Promise<undefined>;
}

interface CanvasPath {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/es2015.promise.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface PromiseConstructor {
* Creates a new resolved promise.
* @returns A resolved promise.
*/
resolve(): Promise<void>;
resolve(): Promise<undefined>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/esnext.disposable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ interface AsyncDisposableStack {
/**
* Disposes each resource in the stack in the reverse order that they were added.
*/
disposeAsync(): Promise<void>;
disposeAsync(): Promise<undefined>;
/**
* Adds a disposable resource to the stack, returning the resource.
* @param value The resource to add. `null` and `undefined` will not be added, but will be returned.
Expand Down Expand Up @@ -156,7 +156,7 @@ interface AsyncDisposableStack {
* ```
*/
move(): AsyncDisposableStack;
[Symbol.asyncDispose](): Promise<void>;
[Symbol.asyncDispose](): Promise<undefined>;
readonly [Symbol.toStringTag]: string;
}

Expand Down
52 changes: 26 additions & 26 deletions src/lib/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1423,9 +1423,9 @@ declare var CSSVariableReferenceValue: {
*/
interface Cache {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/add) */
add(request: RequestInfo | URL): Promise<void>;
add(request: RequestInfo | URL): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) */
addAll(requests: RequestInfo[]): Promise<void>;
addAll(requests: RequestInfo[]): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/delete) */
delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/keys) */
Expand All @@ -1435,7 +1435,7 @@ interface Cache {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/matchAll) */
matchAll(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise<ReadonlyArray<Response>>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/put) */
put(request: RequestInfo | URL, response: Response): Promise<void>;
put(request: RequestInfo | URL, response: Response): Promise<undefined>;
}

declare var Cache: {
Expand Down Expand Up @@ -1719,7 +1719,7 @@ declare var Client: {
*/
interface Clients {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clients/claim) */
claim(): Promise<void>;
claim(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clients/get) */
get(id: string): Promise<Client | undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clients/matchAll) */
Expand Down Expand Up @@ -2825,7 +2825,7 @@ interface FileSystemDirectoryHandle extends FileSystemHandle {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle) */
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry) */
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve) */
resolve(possibleDescendant: FileSystemHandle): Promise<string[] | null>;
}
Expand Down Expand Up @@ -2906,11 +2906,11 @@ declare var FileSystemSyncAccessHandle: {
*/
interface FileSystemWritableFileStream extends WritableStream {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/seek) */
seek(position: number): Promise<void>;
seek(position: number): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/truncate) */
truncate(size: number): Promise<void>;
truncate(size: number): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/write) */
write(data: FileSystemWriteChunkType): Promise<void>;
write(data: FileSystemWriteChunkType): Promise<undefined>;
}

declare var FileSystemWritableFileStream: {
Expand Down Expand Up @@ -4005,13 +4005,13 @@ declare var MessagePort: {
*/
interface NavigationPreloadManager {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager/disable) */
disable(): Promise<void>;
disable(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager/enable) */
enable(): Promise<void>;
enable(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager/getState) */
getState(): Promise<NavigationPreloadState>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager/setHeaderValue) */
setHeaderValue(value: string): Promise<void>;
setHeaderValue(value: string): Promise<undefined>;
}

declare var NavigationPreloadManager: {
Expand All @@ -4022,9 +4022,9 @@ declare var NavigationPreloadManager: {
/** Available only in secure contexts. */
interface NavigatorBadge {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Navigator/clearAppBadge) */
clearAppBadge(): Promise<void>;
clearAppBadge(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Navigator/setAppBadge) */
setAppBadge(contents?: number): Promise<void>;
setAppBadge(contents?: number): Promise<undefined>;
}

interface NavigatorConcurrentHardware {
Expand Down Expand Up @@ -4771,15 +4771,15 @@ interface ReadableStream<R = any> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
readonly locked: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
cancel(reason?: any): Promise<void>;
cancel(reason?: any): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
getReader(): ReadableStreamDefaultReader<R>;
getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
tee(): [ReadableStream<R>, ReadableStream<R>];
}
Expand Down Expand Up @@ -4853,7 +4853,7 @@ interface ReadableStreamGenericReader {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/closed) */
readonly closed: Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/cancel) */
cancel(reason?: any): Promise<void>;
cancel(reason?: any): Promise<undefined>;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Report) */
Expand Down Expand Up @@ -5176,7 +5176,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
readonly registration: ServiceWorkerRegistration;
readonly serviceWorker: ServiceWorker;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting) */
skipWaiting(): Promise<void>;
skipWaiting(): Promise<undefined>;
addEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand Down Expand Up @@ -5218,11 +5218,11 @@ interface ServiceWorkerRegistration extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/getNotifications) */
getNotifications(filter?: GetNotificationOptions): Promise<Notification[]>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/showNotification) */
showNotification(title: string, options?: NotificationOptions): Promise<void>;
showNotification(title: string, options?: NotificationOptions): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/unregister) */
unregister(): Promise<boolean>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/update) */
update(): Promise<void>;
update(): Promise<undefined>;
addEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand Down Expand Up @@ -5674,7 +5674,7 @@ interface VideoDecoder extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/decode) */
decode(chunk: EncodedVideoChunk): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/flush) */
flush(): Promise<void>;
flush(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/reset) */
reset(): void;
addEventListener<K extends keyof VideoDecoderEventMap>(type: K, listener: (this: VideoDecoder, ev: VideoDecoderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -5710,7 +5710,7 @@ interface VideoEncoder extends EventTarget {
configure(config: VideoEncoderConfig): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/encode) */
encode(frame: VideoFrame, options?: VideoEncoderEncodeOptions): void;
flush(): Promise<void>;
flush(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/reset) */
reset(): void;
addEventListener<K extends keyof VideoEncoderEventMap>(type: K, listener: (this: VideoEncoder, ev: VideoEncoderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -8527,9 +8527,9 @@ interface WritableStream<W = any> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
readonly locked: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
abort(reason?: any): Promise<void>;
abort(reason?: any): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
close(): Promise<void>;
close(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
getWriter(): WritableStreamDefaultWriter<W>;
}
Expand Down Expand Up @@ -8569,13 +8569,13 @@ interface WritableStreamDefaultWriter<W = any> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
readonly ready: Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
abort(reason?: any): Promise<void>;
abort(reason?: any): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
close(): Promise<void>;
close(): Promise<undefined>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
releaseLock(): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
write(chunk?: W): Promise<void>;
write(chunk?: W): Promise<undefined>;
}

declare var WritableStreamDefaultWriter: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/webworker.iterable.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface CSSUnparsedValue {

interface Cache {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) */
addAll(requests: Iterable<RequestInfo>): Promise<void>;
addAll(requests: Iterable<RequestInfo>): Promise<undefined>;
}

interface CanvasPath {
Expand Down

0 comments on commit 8139c3c

Please sign in to comment.