Repository: denoland/deno
Pull request: fix(dts): add `Uint8Array` base64/hex methods

These are enabled by default in V8 14.0.

Closes #25051.


Changed files:
filename: cli/build.rs
patch: @@ -115,11 +115,13 @@ fn compress_decls(out_dir: &Path) {
     "lib.esnext.d.ts",
     "lib.esnext.decorators.d.ts",
     "lib.esnext.disposable.d.ts",
+    "lib.esnext.error.d.ts",
     "lib.esnext.float16.d.ts",
     "lib.esnext.full.d.ts",
     "lib.esnext.intl.d.ts",
     "lib.esnext.iterator.d.ts",
     "lib.esnext.promise.d.ts",
+    "lib.esnext.sharedmemory.d.ts",
     "lib.scripthost.d.ts",
     "lib.webworker.asynciterable.d.ts",
     "lib.webworker.d.ts",

filename: cli/tsc/dts/lib.deno.unstable.d.ts
patch: @@ -6423,35 +6423,72 @@ declare namespace Intl {
  * @category Platform
  * @experimental
  */
-interface ErrorConstructor {
+interface RegExpConstructor {
   /**
-   * Indicates whether the argument provided is a built-in Error instance or not.
+   * Returns a new string in which characters that are potentially special in a
+   * regular expression pattern are replaced with escape sequences.
+   * @param string The string to escape.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape)
    */
-  isError(error: unknown): error is Error;
+  escape(string: string): string;
 }
 
 /**
  * @category Platform
  * @experimental
  */
-interface Atomics {
+interface Uint8Array {
   /**
-   * Signals to the CPU that it is running in a spin-wait loop.
-   * @param durationHint An integer that may be used to determine how many times
-   * the signal is sent.
+   * Converts this `Uint8Array` object to a base64 string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64)
+   */
+  toBase64(options?: {
+    alphabet?: "base64" | "base64url";
+    omitPadding?: boolean;
+  }): string;
+  /**
+   * Populates this `Uint8Array` object with data from a base64 string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/setFromBase64)
+   */
+  setFromBase64(string: string, options?: {
+    alphabet?: "base64" | "base64url";
+    lastChunkHandling?: "loose" | "strict" | "stop-before-partial";
+  }): { read: number; written: number };
+  /**
+   * Converts this `Uint8Array` object to a hex string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toHex)
    */
-  pause(durationHint?: number): void;
+  toHex(): string;
+  /**
+   * Populates this `Uint8Array` object with data from a hex string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/setFromHex)
+   */
+  setFromHex(string: string): { read: number; written: number };
 }
 
 /**
  * @category Platform
  * @experimental
  */
-interface RegExpConstructor {
+interface Uint8ArrayConstructor {
   /**
-   * Returns a new string in which characters that are potentially special in a
-   * regular expression pattern are replaced with escape sequences.
-   * @param string The string to escape.
+   * Creates a new `Uint8Array` object from a base64 string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64)
    */
-  escape(string: string): string;
+  fromBase64(string: string, options?: {
+    alphabet?: "base64" | "base64url";
+    lastChunkHandling?: "loose" | "strict" | "stop-before-partial";
+  }): Uint8Array<ArrayBuffer>;
+  /**
+   * Creates a new `Uint8Array` object from a hex string.
+   *
+   * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromHex)
+   */
+  fromHex(string: string): Uint8Array<ArrayBuffer>;
 }

filename: cli/tsc/mod.rs
patch: @@ -290,11 +290,13 @@ pub static LAZILY_LOADED_STATIC_ASSETS: Lazy<
     maybe_compressed_lib!("lib.esnext.d.ts"),
     maybe_compressed_lib!("lib.esnext.decorators.d.ts"),
     maybe_compressed_lib!("lib.esnext.disposable.d.ts"),
+    maybe_compressed_lib!("lib.esnext.error.d.ts"),
     maybe_compressed_lib!("lib.esnext.float16.d.ts"),
     maybe_compressed_lib!("lib.esnext.full.d.ts"),
     maybe_compressed_lib!("lib.esnext.intl.d.ts"),
     maybe_compressed_lib!("lib.esnext.iterator.d.ts"),
     maybe_compressed_lib!("lib.esnext.promise.d.ts"),
+    maybe_compressed_lib!("lib.esnext.sharedmemory.d.ts"),
     maybe_compressed_lib!("lib.scripthost.d.ts"),
     maybe_compressed_lib!("lib.webworker.asynciterable.d.ts"),
     maybe_compressed_lib!("lib.webworker.d.ts"),