From 2471626e035e9eaf432d8a902d836b896bd65f68 Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Mon, 12 May 2025 20:58:58 -0500 Subject: [PATCH 1/7] Add type definitions for `Uint8Array` to/from base64 methods Fixes #61695 --- src/lib/esnext.array.d.ts | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/src/lib/esnext.array.d.ts b/src/lib/esnext.array.d.ts index 91112ce421ba0..24af033406fb6 100644 --- a/src/lib/esnext.array.d.ts +++ b/src/lib/esnext.array.d.ts @@ -15,3 +15,73 @@ interface ArrayConstructor { */ fromAsync(iterableOrArrayLike: AsyncIterable | Iterable | ArrayLike, mapFn: (value: Awaited, index: number) => U, thisArg?: any): Promise[]>; } + +interface Uint8ArrayConstructor { + /** + * Creates a new `Uint8Array` from a base64-encoded string. + * @param string The base64-encoded string. + * @param options If provided, specifies the alphabet and handling of the last chunk. + * @returns A new `Uint8Array` instance. + * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last + * chunk is inconsistent with the `lastChunkHandling` option. + */ + fromBase64: ( + string: string, + options?: { + alphabet?: "base64" | "base64url"; + lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; + }, + ) => Uint8Array; + + /** + * Creates a new `Uint8Array` from a base16-encoded string. + * @returns A new `Uint8Array` instance. + */ + fromHex: ( + string: string, + ) => Uint8Array; +} + +interface Uint8Array { + /** + * Converts the `Uint8Array` to a base64-encoded string. + * @param options If provided, sets the alphabet and padding behavior used. + * @returns A base64-encoded string. + */ + toBase64: (options?: { + alphabet?: "base64" | "base64url"; + omitPadding?: boolean; + }) => string; + + /** + * Sets the `Uint8Array` from a base64-encoded string. + * @param string The base64-encoded string. + * @param options If provided, specifies the alphabet and handling of the last chunk. + * @returns An object containing the number of bytes read and written. + * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last + * chunk is inconsistent with the `lastChunkHandling` option. + */ + setFromBase64: (string: string, options?: { + alphabet?: "base64" | "base64url"; + lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; + }) => { + read: number; + written: number; + }; + + /** + * Converts the `Uint8Array` to a base16-encoded string. + * @returns A base16-encoded string. + */ + toHex: () => string; + + /** + * Sets the `Uint8Array` from a base16-encoded string. + * @param string The base16-encoded string. + * @returns An object containing the number of bytes read and written. + */ + setFromHex: (string: string) => { + read: number; + written: number; + }; +} From 09db85cd303930838d4c9fda20f7fa4b85be3c9a Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Mon, 12 May 2025 21:28:29 -0500 Subject: [PATCH 2/7] Update baselines --- tests/baselines/reference/findLast(target=esnext).symbols | 4 ++-- tests/baselines/reference/indexAt(target=esnext).symbols | 2 +- tests/baselines/reference/subclassUint8Array.symbols | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/findLast(target=esnext).symbols b/tests/baselines/reference/findLast(target=esnext).symbols index 0e47b29a2e7fa..5c5781e1ef877 100644 --- a/tests/baselines/reference/findLast(target=esnext).symbols +++ b/tests/baselines/reference/findLast(target=esnext).symbols @@ -24,7 +24,7 @@ new Int8Array().findLast((item) => item === 0); new Uint8Array().findLast((item) => item === 0); >new Uint8Array().findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >findLast : Symbol(Uint8Array.findLast, Decl(lib.es2023.array.d.ts, --, --), Decl(lib.es2023.array.d.ts, --, --)) >item : Symbol(item, Decl(findLast.ts, 3, 27)) >item : Symbol(item, Decl(findLast.ts, 3, 27)) @@ -117,7 +117,7 @@ new Int8Array().findLastIndex((item) => item === 0); new Uint8Array().findLastIndex((item) => item === 0); >new Uint8Array().findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >findLastIndex : Symbol(Uint8Array.findLastIndex, Decl(lib.es2023.array.d.ts, --, --)) >item : Symbol(item, Decl(findLast.ts, 17, 32)) >item : Symbol(item, Decl(findLast.ts, 17, 32)) diff --git a/tests/baselines/reference/indexAt(target=esnext).symbols b/tests/baselines/reference/indexAt(target=esnext).symbols index dbccd4a169ca1..d050c538d543e 100644 --- a/tests/baselines/reference/indexAt(target=esnext).symbols +++ b/tests/baselines/reference/indexAt(target=esnext).symbols @@ -16,7 +16,7 @@ new Int8Array().at(0); new Uint8Array().at(0); >new Uint8Array().at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >at : Symbol(Uint8Array.at, Decl(lib.es2022.array.d.ts, --, --)) new Uint8ClampedArray().at(0); diff --git a/tests/baselines/reference/subclassUint8Array.symbols b/tests/baselines/reference/subclassUint8Array.symbols index d94301cfecaad..da21e5af448eb 100644 --- a/tests/baselines/reference/subclassUint8Array.symbols +++ b/tests/baselines/reference/subclassUint8Array.symbols @@ -3,6 +3,6 @@ === subclassUint8Array.ts === class CustomBuffer extends Uint8Array { >CustomBuffer : Symbol(CustomBuffer, Decl(subclassUint8Array.ts, 0, 0)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) } From d5f1e1c8846a96ac8c9d30750ce69deadd7c69d6 Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Fri, 16 May 2025 12:53:19 -0500 Subject: [PATCH 3/7] Update script target features --- src/compiler/utilities.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8d2d016fe5944..94e476d236d07 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1780,6 +1780,12 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__ "toSpliced", "with", ], + esnext: [ + "toBase64", + "setFromBase64", + "toHex", + "setFromHex", + ], })), Uint8ClampedArray: new Map(Object.entries({ es2022: [ @@ -1908,6 +1914,12 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__ "cause", ], })), + Uint8Constructor: new Map(Object.entries({ + esnext: [ + "fromBase64", + "fromHex", + ], + })), })) ); From f720939cb31994914f4c1dc0e636e403e56497bc Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Fri, 16 May 2025 13:48:34 -0500 Subject: [PATCH 4/7] Add tests --- .../toFromHexBase64(target=es2024).errors.txt | 48 +++ .../toFromHexBase64(target=es2024).js | 47 +++ .../toFromHexBase64(target=es2024).symbols | 82 +++++ .../toFromHexBase64(target=es2024).types | 281 ++++++++++++++++++ .../toFromHexBase64(target=esnext).js | 47 +++ .../toFromHexBase64(target=esnext).symbols | 120 ++++++++ .../toFromHexBase64(target=esnext).types | 281 ++++++++++++++++++ .../conformance/esnext/toFromHexBase64.ts | 25 ++ 8 files changed, 931 insertions(+) create mode 100644 tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt create mode 100644 tests/baselines/reference/toFromHexBase64(target=es2024).js create mode 100644 tests/baselines/reference/toFromHexBase64(target=es2024).symbols create mode 100644 tests/baselines/reference/toFromHexBase64(target=es2024).types create mode 100644 tests/baselines/reference/toFromHexBase64(target=esnext).js create mode 100644 tests/baselines/reference/toFromHexBase64(target=esnext).symbols create mode 100644 tests/baselines/reference/toFromHexBase64(target=esnext).types create mode 100644 tests/cases/conformance/esnext/toFromHexBase64.ts diff --git a/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt b/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt new file mode 100644 index 0000000000000..5a3f8092ca7e4 --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt @@ -0,0 +1,48 @@ +toFromHexBase64.ts(1,25): error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. +toFromHexBase64.ts(2,25): error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. +toFromHexBase64.ts(3,25): error TS2339: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. +toFromHexBase64.ts(12,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +toFromHexBase64.ts(13,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +toFromHexBase64.ts(14,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +toFromHexBase64.ts(20,20): error TS2550: Property 'setFromHex' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. + + +==== toFromHexBase64.ts (7 errors) ==== + const arr1 = Uint8Array.fromBase64("AAAAAA=="); + ~~~~~~~~~~ +!!! error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. + const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); + ~~~~~~~~~~ +!!! error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. + const arr3 = Uint8Array.fromHex("000000"); + ~~~~~~~ +!!! error TS2339: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. + + const encodedBase64_1 = arr1.toBase64(); + const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); + const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); + + const encodedHex_1 = arr1.toHex(); + + const target1 = new Uint8Array(10); + const r1 = target1.setFromBase64("AAAAAA=="); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. + const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. + const r3 = target1.setFromBase64("AAAAAA", { + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" + }); + + const target2 = new Uint8Array(10); + const r4 = target2.setFromHex("000000"); + ~~~~~~~~~~ +!!! error TS2550: Property 'setFromHex' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. + + const totalWritten = r1.written + r2.written + r3.written + r4.written; + const totalRead = r1.read + r2.read + r3.read + r4.read; + \ No newline at end of file diff --git a/tests/baselines/reference/toFromHexBase64(target=es2024).js b/tests/baselines/reference/toFromHexBase64(target=es2024).js new file mode 100644 index 0000000000000..b6085d185ae45 --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=es2024).js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +//// [toFromHexBase64.ts] +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +const arr3 = Uint8Array.fromHex("000000"); + +const encodedBase64_1 = arr1.toBase64(); +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); + +const encodedHex_1 = arr1.toHex(); + +const target1 = new Uint8Array(10); +const r1 = target1.setFromBase64("AAAAAA=="); +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +const r3 = target1.setFromBase64("AAAAAA", { + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" +}); + +const target2 = new Uint8Array(10); +const r4 = target2.setFromHex("000000"); + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +const totalRead = r1.read + r2.read + r3.read + r4.read; + + +//// [toFromHexBase64.js] +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +const arr3 = Uint8Array.fromHex("000000"); +const encodedBase64_1 = arr1.toBase64(); +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +const encodedHex_1 = arr1.toHex(); +const target1 = new Uint8Array(10); +const r1 = target1.setFromBase64("AAAAAA=="); +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +const r3 = target1.setFromBase64("AAAAAA", { + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" +}); +const target2 = new Uint8Array(10); +const r4 = target2.setFromHex("000000"); +const totalWritten = r1.written + r2.written + r3.written + r4.written; +const totalRead = r1.read + r2.read + r3.read + r4.read; diff --git a/tests/baselines/reference/toFromHexBase64(target=es2024).symbols b/tests/baselines/reference/toFromHexBase64(target=es2024).symbols new file mode 100644 index 0000000000000..f94803c978c82 --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=es2024).symbols @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +=== toFromHexBase64.ts === +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) + +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +>arr2 : Symbol(arr2, Decl(toFromHexBase64.ts, 1, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 1, 46)) + +const arr3 = Uint8Array.fromHex("000000"); +>arr3 : Symbol(arr3, Decl(toFromHexBase64.ts, 2, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) + +const encodedBase64_1 = arr1.toBase64(); +>encodedBase64_1 : Symbol(encodedBase64_1, Decl(toFromHexBase64.ts, 4, 5)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) + +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +>encodedBase64_2 : Symbol(encodedBase64_2, Decl(toFromHexBase64.ts, 5, 5)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 5, 39)) + +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +>encodedBase64_3 : Symbol(encodedBase64_3, Decl(toFromHexBase64.ts, 6, 5)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 6, 39)) +>omitPadding : Symbol(omitPadding, Decl(toFromHexBase64.ts, 6, 62)) + +const encodedHex_1 = arr1.toHex(); +>encodedHex_1 : Symbol(encodedHex_1, Decl(toFromHexBase64.ts, 8, 5)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) + +const target1 = new Uint8Array(10); +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) + +const r1 = target1.setFromBase64("AAAAAA=="); +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) + +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>lastChunkHandling : Symbol(lastChunkHandling, Decl(toFromHexBase64.ts, 12, 46)) + +const r3 = target1.setFromBase64("AAAAAA", { +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) + + alphabet: "base64url", +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 13, 44)) + + lastChunkHandling: "stop-before-partial" +>lastChunkHandling : Symbol(lastChunkHandling, Decl(toFromHexBase64.ts, 14, 24)) + +}); + +const target2 = new Uint8Array(10); +>target2 : Symbol(target2, Decl(toFromHexBase64.ts, 18, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 3 more) + +const r4 = target2.setFromHex("000000"); +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) +>target2 : Symbol(target2, Decl(toFromHexBase64.ts, 18, 5)) + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +>totalWritten : Symbol(totalWritten, Decl(toFromHexBase64.ts, 21, 5)) +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) + +const totalRead = r1.read + r2.read + r3.read + r4.read; +>totalRead : Symbol(totalRead, Decl(toFromHexBase64.ts, 22, 5)) +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) + diff --git a/tests/baselines/reference/toFromHexBase64(target=es2024).types b/tests/baselines/reference/toFromHexBase64(target=es2024).types new file mode 100644 index 0000000000000..30ef4e6dd71ae --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=es2024).types @@ -0,0 +1,281 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +=== toFromHexBase64.ts === +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +>arr1 : any +> : ^^^ +>Uint8Array.fromBase64("AAAAAA==") : any +> : ^^^ +>Uint8Array.fromBase64 : any +> : ^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromBase64 : any +> : ^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ + +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +>arr2 : any +> : ^^^ +>Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }) : any +> : ^^^ +>Uint8Array.fromBase64 : any +> : ^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromBase64 : any +> : ^^^ +>"AAAAAA" : "AAAAAA" +> : ^^^^^^^^ +>{ alphabet: "base64url" } : { alphabet: string; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>alphabet : string +> : ^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ + +const arr3 = Uint8Array.fromHex("000000"); +>arr3 : any +> : ^^^ +>Uint8Array.fromHex("000000") : any +> : ^^^ +>Uint8Array.fromHex : any +> : ^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromHex : any +> : ^^^ +>"000000" : "000000" +> : ^^^^^^^^ + +const encodedBase64_1 = arr1.toBase64(); +>encodedBase64_1 : any +> : ^^^ +>arr1.toBase64() : any +> : ^^^ +>arr1.toBase64 : any +> : ^^^ +>arr1 : any +> : ^^^ +>toBase64 : any +> : ^^^ + +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +>encodedBase64_2 : any +> : ^^^ +>arr1.toBase64({ alphabet: "base64" }) : any +> : ^^^ +>arr1.toBase64 : any +> : ^^^ +>arr1 : any +> : ^^^ +>toBase64 : any +> : ^^^ +>{ alphabet: "base64" } : { alphabet: string; } +> : ^^^^^^^^^^^^^^^^^^^^^ +>alphabet : string +> : ^^^^^^ +>"base64" : "base64" +> : ^^^^^^^^ + +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +>encodedBase64_3 : any +> : ^^^ +>arr1.toBase64({ alphabet: "base64url", omitPadding: true }) : any +> : ^^^ +>arr1.toBase64 : any +> : ^^^ +>arr1 : any +> : ^^^ +>toBase64 : any +> : ^^^ +>{ alphabet: "base64url", omitPadding: true } : { alphabet: string; omitPadding: boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>alphabet : string +> : ^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ +>omitPadding : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ + +const encodedHex_1 = arr1.toHex(); +>encodedHex_1 : any +> : ^^^ +>arr1.toHex() : any +> : ^^^ +>arr1.toHex : any +> : ^^^ +>arr1 : any +> : ^^^ +>toHex : any +> : ^^^ + +const target1 = new Uint8Array(10); +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8Array(10) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + +const r1 = target1.setFromBase64("AAAAAA=="); +>r1 : any +> : ^^^ +>target1.setFromBase64("AAAAAA==") : any +> : ^^^ +>target1.setFromBase64 : any +> : ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : any +> : ^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ + +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +>r2 : any +> : ^^^ +>target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }) : any +> : ^^^ +>target1.setFromBase64 : any +> : ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : any +> : ^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ +>{ lastChunkHandling: "strict" } : { lastChunkHandling: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>lastChunkHandling : string +> : ^^^^^^ +>"strict" : "strict" +> : ^^^^^^^^ + +const r3 = target1.setFromBase64("AAAAAA", { +>r3 : any +> : ^^^ +>target1.setFromBase64("AAAAAA", { alphabet: "base64url", lastChunkHandling: "stop-before-partial"}) : any +> : ^^^ +>target1.setFromBase64 : any +> : ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : any +> : ^^^ +>"AAAAAA" : "AAAAAA" +> : ^^^^^^^^ +>{ alphabet: "base64url", lastChunkHandling: "stop-before-partial"} : { alphabet: string; lastChunkHandling: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + alphabet: "base64url", +>alphabet : string +> : ^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ + + lastChunkHandling: "stop-before-partial" +>lastChunkHandling : string +> : ^^^^^^ +>"stop-before-partial" : "stop-before-partial" +> : ^^^^^^^^^^^^^^^^^^^^^ + +}); + +const target2 = new Uint8Array(10); +>target2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8Array(10) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + +const r4 = target2.setFromHex("000000"); +>r4 : any +> : ^^^ +>target2.setFromHex("000000") : any +> : ^^^ +>target2.setFromHex : any +> : ^^^ +>target2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromHex : any +> : ^^^ +>"000000" : "000000" +> : ^^^^^^^^ + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +>totalWritten : any +> : ^^^ +>r1.written + r2.written + r3.written + r4.written : any +> : ^^^ +>r1.written + r2.written + r3.written : any +> : ^^^ +>r1.written + r2.written : any +> : ^^^ +>r1.written : any +> : ^^^ +>r1 : any +> : ^^^ +>written : any +> : ^^^ +>r2.written : any +> : ^^^ +>r2 : any +> : ^^^ +>written : any +> : ^^^ +>r3.written : any +> : ^^^ +>r3 : any +> : ^^^ +>written : any +> : ^^^ +>r4.written : any +> : ^^^ +>r4 : any +> : ^^^ +>written : any +> : ^^^ + +const totalRead = r1.read + r2.read + r3.read + r4.read; +>totalRead : any +> : ^^^ +>r1.read + r2.read + r3.read + r4.read : any +> : ^^^ +>r1.read + r2.read + r3.read : any +> : ^^^ +>r1.read + r2.read : any +> : ^^^ +>r1.read : any +> : ^^^ +>r1 : any +> : ^^^ +>read : any +> : ^^^ +>r2.read : any +> : ^^^ +>r2 : any +> : ^^^ +>read : any +> : ^^^ +>r3.read : any +> : ^^^ +>r3 : any +> : ^^^ +>read : any +> : ^^^ +>r4.read : any +> : ^^^ +>r4 : any +> : ^^^ +>read : any +> : ^^^ + diff --git a/tests/baselines/reference/toFromHexBase64(target=esnext).js b/tests/baselines/reference/toFromHexBase64(target=esnext).js new file mode 100644 index 0000000000000..b6085d185ae45 --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=esnext).js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +//// [toFromHexBase64.ts] +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +const arr3 = Uint8Array.fromHex("000000"); + +const encodedBase64_1 = arr1.toBase64(); +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); + +const encodedHex_1 = arr1.toHex(); + +const target1 = new Uint8Array(10); +const r1 = target1.setFromBase64("AAAAAA=="); +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +const r3 = target1.setFromBase64("AAAAAA", { + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" +}); + +const target2 = new Uint8Array(10); +const r4 = target2.setFromHex("000000"); + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +const totalRead = r1.read + r2.read + r3.read + r4.read; + + +//// [toFromHexBase64.js] +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +const arr3 = Uint8Array.fromHex("000000"); +const encodedBase64_1 = arr1.toBase64(); +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +const encodedHex_1 = arr1.toHex(); +const target1 = new Uint8Array(10); +const r1 = target1.setFromBase64("AAAAAA=="); +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +const r3 = target1.setFromBase64("AAAAAA", { + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" +}); +const target2 = new Uint8Array(10); +const r4 = target2.setFromHex("000000"); +const totalWritten = r1.written + r2.written + r3.written + r4.written; +const totalRead = r1.read + r2.read + r3.read + r4.read; diff --git a/tests/baselines/reference/toFromHexBase64(target=esnext).symbols b/tests/baselines/reference/toFromHexBase64(target=esnext).symbols new file mode 100644 index 0000000000000..01881795bad4b --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=esnext).symbols @@ -0,0 +1,120 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +=== toFromHexBase64.ts === +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>Uint8Array.fromBase64 : Symbol(Uint8ArrayConstructor.fromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>fromBase64 : Symbol(Uint8ArrayConstructor.fromBase64, Decl(lib.esnext.array.d.ts, --, --)) + +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +>arr2 : Symbol(arr2, Decl(toFromHexBase64.ts, 1, 5)) +>Uint8Array.fromBase64 : Symbol(Uint8ArrayConstructor.fromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>fromBase64 : Symbol(Uint8ArrayConstructor.fromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 1, 46)) + +const arr3 = Uint8Array.fromHex("000000"); +>arr3 : Symbol(arr3, Decl(toFromHexBase64.ts, 2, 5)) +>Uint8Array.fromHex : Symbol(Uint8ArrayConstructor.fromHex, Decl(lib.esnext.array.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>fromHex : Symbol(Uint8ArrayConstructor.fromHex, Decl(lib.esnext.array.d.ts, --, --)) + +const encodedBase64_1 = arr1.toBase64(); +>encodedBase64_1 : Symbol(encodedBase64_1, Decl(toFromHexBase64.ts, 4, 5)) +>arr1.toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) + +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +>encodedBase64_2 : Symbol(encodedBase64_2, Decl(toFromHexBase64.ts, 5, 5)) +>arr1.toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 5, 39)) + +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +>encodedBase64_3 : Symbol(encodedBase64_3, Decl(toFromHexBase64.ts, 6, 5)) +>arr1.toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>toBase64 : Symbol(Uint8Array.toBase64, Decl(lib.esnext.array.d.ts, --, --)) +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 6, 39)) +>omitPadding : Symbol(omitPadding, Decl(toFromHexBase64.ts, 6, 62)) + +const encodedHex_1 = arr1.toHex(); +>encodedHex_1 : Symbol(encodedHex_1, Decl(toFromHexBase64.ts, 8, 5)) +>arr1.toHex : Symbol(Uint8Array.toHex, Decl(lib.esnext.array.d.ts, --, --)) +>arr1 : Symbol(arr1, Decl(toFromHexBase64.ts, 0, 5)) +>toHex : Symbol(Uint8Array.toHex, Decl(lib.esnext.array.d.ts, --, --)) + +const target1 = new Uint8Array(10); +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) + +const r1 = target1.setFromBase64("AAAAAA=="); +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>target1.setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) + +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>target1.setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>lastChunkHandling : Symbol(lastChunkHandling, Decl(toFromHexBase64.ts, 12, 46)) + +const r3 = target1.setFromBase64("AAAAAA", { +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>target1.setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) +>target1 : Symbol(target1, Decl(toFromHexBase64.ts, 10, 5)) +>setFromBase64 : Symbol(Uint8Array.setFromBase64, Decl(lib.esnext.array.d.ts, --, --)) + + alphabet: "base64url", +>alphabet : Symbol(alphabet, Decl(toFromHexBase64.ts, 13, 44)) + + lastChunkHandling: "stop-before-partial" +>lastChunkHandling : Symbol(lastChunkHandling, Decl(toFromHexBase64.ts, 14, 24)) + +}); + +const target2 = new Uint8Array(10); +>target2 : Symbol(target2, Decl(toFromHexBase64.ts, 18, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) + +const r4 = target2.setFromHex("000000"); +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) +>target2.setFromHex : Symbol(Uint8Array.setFromHex, Decl(lib.esnext.array.d.ts, --, --)) +>target2 : Symbol(target2, Decl(toFromHexBase64.ts, 18, 5)) +>setFromHex : Symbol(Uint8Array.setFromHex, Decl(lib.esnext.array.d.ts, --, --)) + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +>totalWritten : Symbol(totalWritten, Decl(toFromHexBase64.ts, 21, 5)) +>r1.written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r2.written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r3.written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r4.written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) +>written : Symbol(written, Decl(lib.esnext.array.d.ts, --, --)) + +const totalRead = r1.read + r2.read + r3.read + r4.read; +>totalRead : Symbol(totalRead, Decl(toFromHexBase64.ts, 22, 5)) +>r1.read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r1 : Symbol(r1, Decl(toFromHexBase64.ts, 11, 5)) +>read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r2.read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r2 : Symbol(r2, Decl(toFromHexBase64.ts, 12, 5)) +>read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r3.read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r3 : Symbol(r3, Decl(toFromHexBase64.ts, 13, 5)) +>read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r4.read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) +>r4 : Symbol(r4, Decl(toFromHexBase64.ts, 19, 5)) +>read : Symbol(read, Decl(lib.esnext.array.d.ts, --, --)) + diff --git a/tests/baselines/reference/toFromHexBase64(target=esnext).types b/tests/baselines/reference/toFromHexBase64(target=esnext).types new file mode 100644 index 0000000000000..e736aa7692897 --- /dev/null +++ b/tests/baselines/reference/toFromHexBase64(target=esnext).types @@ -0,0 +1,281 @@ +//// [tests/cases/conformance/esnext/toFromHexBase64.ts] //// + +=== toFromHexBase64.ts === +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64("AAAAAA==") : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ + +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +>arr2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ +>"AAAAAA" : "AAAAAA" +> : ^^^^^^^^ +>{ alphabet: "base64url" } : { alphabet: "base64url"; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ +>alphabet : "base64url" +> : ^^^^^^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ + +const arr3 = Uint8Array.fromHex("000000"); +>arr3 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromHex("000000") : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromHex : (string: string) => Uint8Array +> : ^ ^^ ^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>fromHex : (string: string) => Uint8Array +> : ^ ^^ ^^^^^ +>"000000" : "000000" +> : ^^^^^^^^ + +const encodedBase64_1 = arr1.toBase64(); +>encodedBase64_1 : string +> : ^^^^^^ +>arr1.toBase64() : string +> : ^^^^^^ +>arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ + +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +>encodedBase64_2 : string +> : ^^^^^^ +>arr1.toBase64({ alphabet: "base64" }) : string +> : ^^^^^^ +>arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ +>{ alphabet: "base64" } : { alphabet: "base64"; } +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>alphabet : "base64" +> : ^^^^^^^^ +>"base64" : "base64" +> : ^^^^^^^^ + +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); +>encodedBase64_3 : string +> : ^^^^^^ +>arr1.toBase64({ alphabet: "base64url", omitPadding: true }) : string +> : ^^^^^^ +>arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string +> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ +>{ alphabet: "base64url", omitPadding: true } : { alphabet: "base64url"; omitPadding: true; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>alphabet : "base64url" +> : ^^^^^^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ +>omitPadding : true +> : ^^^^ +>true : true +> : ^^^^ + +const encodedHex_1 = arr1.toHex(); +>encodedHex_1 : string +> : ^^^^^^ +>arr1.toHex() : string +> : ^^^^^^ +>arr1.toHex : () => string +> : ^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>toHex : () => string +> : ^^^^^^ + +const target1 = new Uint8Array(10); +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8Array(10) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + +const r1 = target1.setFromBase64("AAAAAA=="); +>r1 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64("AAAAAA==") : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ + +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +>r2 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }) : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>"AAAAAA==" : "AAAAAA==" +> : ^^^^^^^^^^ +>{ lastChunkHandling: "strict" } : { lastChunkHandling: "strict"; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>lastChunkHandling : "strict" +> : ^^^^^^^^ +>"strict" : "strict" +> : ^^^^^^^^ + +const r3 = target1.setFromBase64("AAAAAA", { +>r3 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64("AAAAAA", { alphabet: "base64url", lastChunkHandling: "stop-before-partial"}) : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1.setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => { read: number; written: number; } +> : ^ ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>"AAAAAA" : "AAAAAA" +> : ^^^^^^^^ +>{ alphabet: "base64url", lastChunkHandling: "stop-before-partial"} : { alphabet: "base64url"; lastChunkHandling: "stop-before-partial"; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + alphabet: "base64url", +>alphabet : "base64url" +> : ^^^^^^^^^^^ +>"base64url" : "base64url" +> : ^^^^^^^^^^^ + + lastChunkHandling: "stop-before-partial" +>lastChunkHandling : "stop-before-partial" +> : ^^^^^^^^^^^^^^^^^^^^^ +>"stop-before-partial" : "stop-before-partial" +> : ^^^^^^^^^^^^^^^^^^^^^ + +}); + +const target2 = new Uint8Array(10); +>target2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>new Uint8Array(10) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array : Uint8ArrayConstructor +> : ^^^^^^^^^^^^^^^^^^^^^ +>10 : 10 +> : ^^ + +const r4 = target2.setFromHex("000000"); +>r4 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target2.setFromHex("000000") : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target2.setFromHex : (string: string) => { read: number; written: number; } +> : ^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>target2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>setFromHex : (string: string) => { read: number; written: number; } +> : ^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^ +>"000000" : "000000" +> : ^^^^^^^^ + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +>totalWritten : number +> : ^^^^^^ +>r1.written + r2.written + r3.written + r4.written : number +> : ^^^^^^ +>r1.written + r2.written + r3.written : number +> : ^^^^^^ +>r1.written + r2.written : number +> : ^^^^^^ +>r1.written : number +> : ^^^^^^ +>r1 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>written : number +> : ^^^^^^ +>r2.written : number +> : ^^^^^^ +>r2 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>written : number +> : ^^^^^^ +>r3.written : number +> : ^^^^^^ +>r3 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>written : number +> : ^^^^^^ +>r4.written : number +> : ^^^^^^ +>r4 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>written : number +> : ^^^^^^ + +const totalRead = r1.read + r2.read + r3.read + r4.read; +>totalRead : number +> : ^^^^^^ +>r1.read + r2.read + r3.read + r4.read : number +> : ^^^^^^ +>r1.read + r2.read + r3.read : number +> : ^^^^^^ +>r1.read + r2.read : number +> : ^^^^^^ +>r1.read : number +> : ^^^^^^ +>r1 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>read : number +> : ^^^^^^ +>r2.read : number +> : ^^^^^^ +>r2 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>read : number +> : ^^^^^^ +>r3.read : number +> : ^^^^^^ +>r3 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>read : number +> : ^^^^^^ +>r4.read : number +> : ^^^^^^ +>r4 : { read: number; written: number; } +> : ^^^^^^^^ ^^^^^^^^^^^ ^^^ +>read : number +> : ^^^^^^ + diff --git a/tests/cases/conformance/esnext/toFromHexBase64.ts b/tests/cases/conformance/esnext/toFromHexBase64.ts new file mode 100644 index 0000000000000..fa3f6b0f4724d --- /dev/null +++ b/tests/cases/conformance/esnext/toFromHexBase64.ts @@ -0,0 +1,25 @@ +// @target: esnext, es2024 + +const arr1 = Uint8Array.fromBase64("AAAAAA=="); +const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); +const arr3 = Uint8Array.fromHex("000000"); + +const encodedBase64_1 = arr1.toBase64(); +const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); +const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true }); + +const encodedHex_1 = arr1.toHex(); + +const target1 = new Uint8Array(10); +const r1 = target1.setFromBase64("AAAAAA=="); +const r2 = target1.setFromBase64("AAAAAA==", { lastChunkHandling: "strict" }); +const r3 = target1.setFromBase64("AAAAAA", { + alphabet: "base64url", + lastChunkHandling: "stop-before-partial" +}); + +const target2 = new Uint8Array(10); +const r4 = target2.setFromHex("000000"); + +const totalWritten = r1.written + r2.written + r3.written + r4.written; +const totalRead = r1.read + r2.read + r3.read + r4.read; From ed6539c677a1e3daf19c53a4dec6b4bb3c4a9f5f Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Fri, 16 May 2025 14:03:58 -0500 Subject: [PATCH 5/7] Fix typo --- src/compiler/utilities.ts | 2 +- .../toFromHexBase64(target=es2024).errors.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 94e476d236d07..a5ad7e5c0c405 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1914,7 +1914,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__ "cause", ], })), - Uint8Constructor: new Map(Object.entries({ + Uint8ArrayConstructor: new Map(Object.entries({ esnext: [ "fromBase64", "fromHex", diff --git a/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt b/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt index 5a3f8092ca7e4..39980ed96f271 100644 --- a/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt +++ b/tests/baselines/reference/toFromHexBase64(target=es2024).errors.txt @@ -1,6 +1,6 @@ -toFromHexBase64.ts(1,25): error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. -toFromHexBase64.ts(2,25): error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. -toFromHexBase64.ts(3,25): error TS2339: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. +toFromHexBase64.ts(1,25): error TS2550: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +toFromHexBase64.ts(2,25): error TS2550: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. +toFromHexBase64.ts(3,25): error TS2550: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. toFromHexBase64.ts(12,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. toFromHexBase64.ts(13,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. toFromHexBase64.ts(14,20): error TS2550: Property 'setFromBase64' does not exist on type 'Uint8Array'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. @@ -10,13 +10,13 @@ toFromHexBase64.ts(20,20): error TS2550: Property 'setFromHex' does not exist on ==== toFromHexBase64.ts (7 errors) ==== const arr1 = Uint8Array.fromBase64("AAAAAA=="); ~~~~~~~~~~ -!!! error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. +!!! error TS2550: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); ~~~~~~~~~~ -!!! error TS2339: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. +!!! error TS2550: Property 'fromBase64' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. const arr3 = Uint8Array.fromHex("000000"); ~~~~~~~ -!!! error TS2339: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. +!!! error TS2550: Property 'fromHex' does not exist on type 'Uint8ArrayConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later. const encodedBase64_1 = arr1.toBase64(); const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); From 3f18d3c96858e5c78263577d47198b7479cea751 Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Thu, 5 Jun 2025 12:21:39 -0500 Subject: [PATCH 6/7] Use method definitions and narrow down type --- src/lib/esnext.array.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/esnext.array.d.ts b/src/lib/esnext.array.d.ts index 24af033406fb6..70694a1b1328f 100644 --- a/src/lib/esnext.array.d.ts +++ b/src/lib/esnext.array.d.ts @@ -25,21 +25,21 @@ interface Uint8ArrayConstructor { * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last * chunk is inconsistent with the `lastChunkHandling` option. */ - fromBase64: ( + fromBase64( string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }, - ) => Uint8Array; + ): Uint8Array; /** * Creates a new `Uint8Array` from a base16-encoded string. * @returns A new `Uint8Array` instance. */ - fromHex: ( + fromHex( string: string, - ) => Uint8Array; + ): Uint8Array; } interface Uint8Array { @@ -48,10 +48,10 @@ interface Uint8Array { * @param options If provided, sets the alphabet and padding behavior used. * @returns A base64-encoded string. */ - toBase64: (options?: { + toBase64(options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; - }) => string; + }): string; /** * Sets the `Uint8Array` from a base64-encoded string. @@ -61,10 +61,10 @@ interface Uint8Array { * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last * chunk is inconsistent with the `lastChunkHandling` option. */ - setFromBase64: (string: string, options?: { + setFromBase64(string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; - }) => { + }): { read: number; written: number; }; @@ -73,14 +73,14 @@ interface Uint8Array { * Converts the `Uint8Array` to a base16-encoded string. * @returns A base16-encoded string. */ - toHex: () => string; + toHex(): string; /** * Sets the `Uint8Array` from a base16-encoded string. * @param string The base16-encoded string. * @returns An object containing the number of bytes read and written. */ - setFromHex: (string: string) => { + setFromHex(string: string): { read: number; written: number; }; From a5df42df35ccff860a0a23823d4bf979d4d33289 Mon Sep 17 00:00:00 2001 From: idontwanttothink Date: Thu, 5 Jun 2025 12:31:26 -0500 Subject: [PATCH 7/7] Update baselines --- .../toFromHexBase64(target=esnext).types | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/baselines/reference/toFromHexBase64(target=esnext).types b/tests/baselines/reference/toFromHexBase64(target=esnext).types index e736aa7692897..9f4e664272c27 100644 --- a/tests/baselines/reference/toFromHexBase64(target=esnext).types +++ b/tests/baselines/reference/toFromHexBase64(target=esnext).types @@ -2,30 +2,30 @@ === toFromHexBase64.ts === const arr1 = Uint8Array.fromBase64("AAAAAA=="); ->arr1 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromBase64("AAAAAA==") : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array -> : ^ ^^ ^^ ^^^ ^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64("AAAAAA==") : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ >Uint8Array : Uint8ArrayConstructor > : ^^^^^^^^^^^^^^^^^^^^^ ->fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array -> : ^ ^^ ^^ ^^^ ^^^^^ +>fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ >"AAAAAA==" : "AAAAAA==" > : ^^^^^^^^^^ const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); ->arr2 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }) : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array -> : ^ ^^ ^^ ^^^ ^^^^^ +>arr2 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }) : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ >Uint8Array : Uint8ArrayConstructor > : ^^^^^^^^^^^^^^^^^^^^^ ->fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array -> : ^ ^^ ^^ ^^^ ^^^^^ +>fromBase64 : (string: string, options?: { alphabet?: "base64" | "base64url"; lastChunkHandling?: "loose" | "strict" | "stop-before-partial"; }) => Uint8Array +> : ^ ^^ ^^ ^^^ ^^^^^ >"AAAAAA" : "AAAAAA" > : ^^^^^^^^ >{ alphabet: "base64url" } : { alphabet: "base64url"; } @@ -36,16 +36,16 @@ const arr2 = Uint8Array.fromBase64("AAAAAA", { alphabet: "base64url" }); > : ^^^^^^^^^^^ const arr3 = Uint8Array.fromHex("000000"); ->arr3 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromHex("000000") : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Uint8Array.fromHex : (string: string) => Uint8Array -> : ^ ^^ ^^^^^ +>arr3 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromHex("000000") : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ +>Uint8Array.fromHex : (string: string) => Uint8Array +> : ^ ^^ ^^^^^ >Uint8Array : Uint8ArrayConstructor > : ^^^^^^^^^^^^^^^^^^^^^ ->fromHex : (string: string) => Uint8Array -> : ^ ^^ ^^^^^ +>fromHex : (string: string) => Uint8Array +> : ^ ^^ ^^^^^ >"000000" : "000000" > : ^^^^^^^^ @@ -56,8 +56,8 @@ const encodedBase64_1 = arr1.toBase64(); > : ^^^^^^ >arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ ->arr1 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ >toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ @@ -68,8 +68,8 @@ const encodedBase64_2 = arr1.toBase64({ alphabet: "base64" }); > : ^^^^^^ >arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ ->arr1 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ >toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ >{ alphabet: "base64" } : { alphabet: "base64"; } @@ -86,8 +86,8 @@ const encodedBase64_3 = arr1.toBase64({ alphabet: "base64url", omitPadding: true > : ^^^^^^ >arr1.toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ ->arr1 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ >toBase64 : (options?: { alphabet?: "base64" | "base64url"; omitPadding?: boolean; }) => string > : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^ >{ alphabet: "base64url", omitPadding: true } : { alphabet: "base64url"; omitPadding: true; } @@ -108,8 +108,8 @@ const encodedHex_1 = arr1.toHex(); > : ^^^^^^ >arr1.toHex : () => string > : ^^^^^^ ->arr1 : Uint8Array -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>arr1 : Uint8Array +> : ^^^^^^^^^^^^^^^^^^^^^^^ >toHex : () => string > : ^^^^^^