Workers Types Diff

2022-01-31

Below is the change introduced in this compatibility date:

===================================================================
--- 2021-11-03
+++ 2022-01-31
@@ -454,31 +454,21 @@
   blobs?: ((ArrayBuffer | string) | null)[];
 }
 declare class Event {
   constructor(type: string, init?: EventInit);
-  /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
-  readonly type: string;
-  /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
-  readonly eventPhase: number;
-  /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */
-  readonly composed: boolean;
-  /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */
-  readonly bubbles: boolean;
-  /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */
-  readonly cancelable: boolean;
-  /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
-  readonly defaultPrevented: boolean;
-  /** @deprecated */
-  readonly returnValue: boolean;
-  /** Returns the object whose event listener's callback is currently being invoked. */
-  readonly currentTarget?: EventTarget;
-  /** @deprecated */
-  readonly srcElement?: EventTarget;
-  /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
-  readonly timeStamp: number;
-  /** Returns true if event was dispatched by the user agent, and false otherwise. */
-  readonly isTrusted: boolean;
-  cancelBubble: boolean;
+  get type(): string;
+  get eventPhase(): number;
+  get composed(): boolean;
+  get bubbles(): boolean;
+  get cancelable(): boolean;
+  get defaultPrevented(): boolean;
+  get returnValue(): boolean;
+  get currentTarget(): EventTarget | undefined;
+  get srcElement(): EventTarget | undefined;
+  get timeStamp(): number;
+  get isTrusted(): boolean;
+  get cancelBubble(): boolean;
+  set cancelBubble(value: boolean);
   stopImmediatePropagation(): void;
   preventDefault(): void;
   stopPropagation(): void;
   composedPath(): EventTarget[];
@@ -530,18 +520,16 @@
   handleEvent: (event: Event) => any | undefined;
 }
 declare class AbortController {
   constructor();
-  /** Returns the AbortSignal object associated with this object. */
-  readonly signal: AbortSignal;
+  get signal(): AbortSignal;
   abort(reason?: any): void;
 }
 declare abstract class AbortSignal extends EventTarget {
   static abort(reason?: any): AbortSignal;
   static timeout(delay: number): AbortSignal;
-  /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
-  readonly aborted: boolean;
-  readonly reason: any;
+  get aborted(): boolean;
+  get reason(): any;
   throwIfAborted(): void;
 }
 declare interface Scheduler {
   wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
@@ -556,10 +544,10 @@
   constructor(
     bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
     options?: BlobOptions
   );
-  readonly size: number;
-  readonly type: string;
+  get size(): number;
+  get type(): string;
   slice(start?: number, end?: number, type?: string): Blob;
   arrayBuffer(): Promise<ArrayBuffer>;
   text(): Promise<string>;
   stream(): ReadableStream;
@@ -572,10 +560,10 @@
     bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
     name: string,
     options?: FileOptions
   );
-  readonly name: string;
-  readonly lastModified: number;
+  get name(): string;
+  get lastModified(): number;
 }
 declare interface FileOptions {
   type?: string;
   lastModified?: number;
@@ -595,10 +583,9 @@
 declare interface CacheQueryOptions {
   ignoreMethod?: boolean;
 }
 declare abstract class Crypto {
-  /** Available only in secure contexts. */
-  readonly subtle: SubtleCrypto;
+  get subtle(): SubtleCrypto;
   getRandomValues<
     T extends
       | Int8Array
       | Uint8Array
@@ -796,25 +783,25 @@
 declare class DigestStream extends WritableStream<
   ArrayBuffer | ArrayBufferView
 > {
   constructor(algorithm: string | SubtleCryptoHashAlgorithm);
-  readonly digest: Promise<ArrayBuffer>;
+  get digest(): Promise<ArrayBuffer>;
 }
 declare class TextDecoder {
   constructor(decoder?: string, options?: TextDecoderConstructorOptions);
   decode(
     input?: ArrayBuffer | ArrayBufferView,
     options?: TextDecoderDecodeOptions
   ): string;
-  readonly encoding: string;
-  readonly fatal: boolean;
-  readonly ignoreBOM: boolean;
+  get encoding(): string;
+  get fatal(): boolean;
+  get ignoreBOM(): boolean;
 }
 declare class TextEncoder {
   constructor();
   encode(input?: string): Uint8Array;
   encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
-  readonly encoding: string;
+  get encoding(): string;
 }
 declare interface TextDecoderConstructorOptions {
   fatal: boolean;
   ignoreBOM: boolean;
@@ -957,10 +944,10 @@
   | Blob
   | URLSearchParams
   | FormData;
 declare abstract class Body {
-  readonly body: ReadableStream | null;
-  readonly bodyUsed: boolean;
+  get body(): ReadableStream | null;
+  get bodyUsed(): boolean;
   arrayBuffer(): Promise<ArrayBuffer>;
   text(): Promise<string>;
   json<T>(): Promise<T>;
   formData(): Promise<FormData>;
@@ -970,16 +957,16 @@
   constructor(body?: BodyInit | null, init?: ResponseInit);
   static redirect(url: string, status?: number): Response;
   static json(any: any, maybeInit?: ResponseInit | Response): Response;
   clone(): Response;
-  readonly status: number;
-  readonly statusText: string;
-  readonly headers: Headers;
-  readonly ok: boolean;
-  readonly redirected: boolean;
-  readonly url: string;
-  readonly webSocket: WebSocket | null;
-  readonly cf?: any;
+  get status(): number;
+  get statusText(): string;
+  get headers(): Headers;
+  get ok(): boolean;
+  get redirected(): boolean;
+  get url(): string;
+  get webSocket(): WebSocket | null;
+  get cf(): any | undefined;
 }
 declare interface ResponseInit {
   status?: number;
   statusText?: string;
@@ -991,20 +978,15 @@
 declare type RequestInfo = Request | string | URL;
 declare class Request<CfHostMetadata = unknown> extends Body {
   constructor(input: RequestInfo, init?: RequestInit);
   clone(): Request<CfHostMetadata>;
-  /** Returns request's HTTP method, which is "GET" by default. */
-  readonly method: string;
-  /** Returns the URL of request as a string. */
-  readonly url: string;
-  /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */
-  readonly headers: Headers;
-  /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */
-  readonly redirect: string;
-  readonly fetcher: Fetcher | null;
-  /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
-  readonly signal: AbortSignal;
-  readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
+  get method(): string;
+  get url(): string;
+  get headers(): Headers;
+  get redirect(): string;
+  get fetcher(): Fetcher | null;
+  get signal(): AbortSignal;
+  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
 }
 declare interface RequestInit<
   CfType = IncomingRequestCfProperties | RequestInitCfProperties
 > {
@@ -1382,9 +1364,9 @@
       value?: undefined;
     };
 /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
 declare interface ReadableStream<R = any> {
-  readonly locked: boolean;
+  get locked(): boolean;
   cancel(reason?: any): Promise<void>;
   getReader(): ReadableStreamDefaultReader<R>;
   getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
   pipeThrough<T>(
@@ -1413,16 +1395,16 @@
   ): ReadableStream<R>;
 };
 declare class ReadableStreamDefaultReader<R = any> {
   constructor(stream: ReadableStream);
-  readonly closed: Promise<void>;
+  get closed(): Promise<void>;
   cancel(reason?: any): Promise<void>;
   read(): Promise<ReadableStreamReadResult<R>>;
   releaseLock(): void;
 }
 declare class ReadableStreamBYOBReader {
   constructor(stream: ReadableStream);
-  readonly closed: Promise<void>;
+  get closed(): Promise<void>;
   cancel(reason?: any): Promise<void>;
   read<T extends ArrayBufferView>(
     view: T
   ): Promise<ReadableStreamReadResult<T>>;
@@ -1478,18 +1460,18 @@
   constructor(
     underlyingSink?: UnderlyingSink,
     queuingStrategy?: QueuingStrategy
   );
-  readonly locked: boolean;
+  get locked(): boolean;
   abort(reason?: any): Promise<void>;
   close(): Promise<void>;
   getWriter(): WritableStreamDefaultWriter<W>;
 }
 declare class WritableStreamDefaultWriter<W = any> {
   constructor(stream: WritableStream);
-  readonly closed: Promise<void>;
-  readonly ready: Promise<void>;
-  readonly desiredSize: number | null;
+  get closed(): Promise<void>;
+  get ready(): Promise<void>;
+  get desiredSize(): number | null;
   abort(reason?: any): Promise<void>;
   close(): Promise<void>;
   write(chunk?: W): Promise<void>;
   releaseLock(): void;
@@ -1499,10 +1481,10 @@
     transformer?: Transformer<I, O>,
     writableStrategy?: QueuingStrategy<I>,
     readableStrategy?: QueuingStrategy<O>
   );
-  readonly readable: ReadableStream<O>;
-  readonly writable: WritableStream<I>;
+  get readable(): ReadableStream<O>;
+  get writable(): WritableStream<I>;
 }
 declare class FixedLengthStream extends IdentityTransformStream {
   constructor(expectedLength: number | bigint);
 }
@@ -1630,20 +1612,30 @@
   fromTrace(item: TraceItem): TraceMetrics;
 }
 declare class URL {
   constructor(url: string | URL, base?: string | URL);
-  href: string;
-  readonly origin: string;
-  protocol: string;
-  username: string;
-  password: string;
-  host: string;
-  hostname: string;
-  port: string;
-  pathname: string;
-  search: string;
-  readonly searchParams: URLSearchParams;
-  hash: string;
+  get href(): string;
+  set href(value: string);
+  get origin(): string;
+  get protocol(): string;
+  set protocol(value: string);
+  get username(): string;
+  set username(value: string);
+  get password(): string;
+  set password(value: string);
+  get host(): string;
+  set host(value: string);
+  get hostname(): string;
+  set hostname(value: string);
+  get port(): string;
+  set port(value: string);
+  get pathname(): string;
+  set pathname(value: string);
+  get search(): string;
+  set search(value: string);
+  get searchParams(): URLSearchParams;
+  get hash(): string;
+  set hash(value: string);
   toString(): string;
   toJSON(): string;
 }
 declare class URLSearchParams {
@@ -1761,16 +1753,12 @@
   static readonly READY_STATE_CONNECTING: number;
   static readonly READY_STATE_OPEN: number;
   static readonly READY_STATE_CLOSING: number;
   static readonly READY_STATE_CLOSED: number;
-  /** Returns the state of the WebSocket object's connection. It can have the values described below. */
-  readonly readyState: number;
-  /** Returns the URL that was used to establish the WebSocket connection. */
-  readonly url: string | null;
-  /** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */
-  readonly protocol: string | null;
-  /** Returns the extensions selected by the server, if any. */
-  readonly extensions: string | null;
+  get readyState(): number;
+  get url(): string | null;
+  get protocol(): string | null;
+  get extensions(): string | null;
 }
 declare const WebSocketPair: {
   new (): {
     0: WebSocket;