mirror of
https://github.com/denoland/deno.git
synced 2025-09-25 19:59:16 +00:00
fix(dts): specify the underlying buffer type in more places (#30640)
This commit is contained in:
parent
e02e4c2042
commit
a3a904da14
6 changed files with 35 additions and 28 deletions
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -3835,7 +3835,7 @@ declare namespace Deno {
|
||||||
* Reads the stream to completion. It returns a promise that resolves with
|
* Reads the stream to completion. It returns a promise that resolves with
|
||||||
* a `Uint8Array`.
|
* a `Uint8Array`.
|
||||||
*/
|
*/
|
||||||
bytes(): Promise<Uint8Array>;
|
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
||||||
/**
|
/**
|
||||||
* Reads the stream to completion. It returns a promise that resolves with
|
* Reads the stream to completion. It returns a promise that resolves with
|
||||||
* the result of parsing the body text as JSON.
|
* the result of parsing the body text as JSON.
|
||||||
|
|
5
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
5
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -450,7 +450,10 @@ interface DOMStringList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Platform */
|
/** @category Platform */
|
||||||
type BufferSource = ArrayBufferView | ArrayBuffer;
|
type BufferSource = ArrayBufferView<ArrayBuffer> | ArrayBuffer;
|
||||||
|
|
||||||
|
/** @category Platform */
|
||||||
|
type AllowSharedBufferSource = ArrayBufferView | ArrayBufferLike;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A global console object that provides methods for logging, debugging, and error reporting.
|
* A global console object that provides methods for logging, debugging, and error reporting.
|
||||||
|
|
26
cli/tsc/dts/lib.deno_crypto.d.ts
vendored
26
cli/tsc/dts/lib.deno_crypto.d.ts
vendored
|
@ -38,6 +38,8 @@ type KeyUsage =
|
||||||
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
type NamedCurve = string;
|
type NamedCurve = string;
|
||||||
|
/** @category Crypto */
|
||||||
|
type BigInteger = Uint8Array<ArrayBuffer>;
|
||||||
|
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
interface RsaOtherPrimesInfo {
|
interface RsaOtherPrimesInfo {
|
||||||
|
@ -121,7 +123,7 @@ interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
interface RsaKeyGenParams extends Algorithm {
|
interface RsaKeyGenParams extends Algorithm {
|
||||||
modulusLength: number;
|
modulusLength: number;
|
||||||
publicExponent: Uint8Array;
|
publicExponent: BigInteger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
|
@ -131,7 +133,7 @@ interface RsaPssParams extends Algorithm {
|
||||||
|
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
interface RsaOaepParams extends Algorithm {
|
interface RsaOaepParams extends Algorithm {
|
||||||
label?: Uint8Array;
|
label?: BufferSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
|
@ -159,7 +161,7 @@ interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
||||||
modulusLength: number;
|
modulusLength: number;
|
||||||
publicExponent: Uint8Array;
|
publicExponent: BigInteger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Crypto */
|
/** @category Crypto */
|
||||||
|
@ -651,15 +653,15 @@ interface Crypto {
|
||||||
*/
|
*/
|
||||||
getRandomValues<
|
getRandomValues<
|
||||||
T extends
|
T extends
|
||||||
| Int8Array
|
| Int8Array<ArrayBuffer>
|
||||||
| Int16Array
|
| Int16Array<ArrayBuffer>
|
||||||
| Int32Array
|
| Int32Array<ArrayBuffer>
|
||||||
| Uint8Array
|
| Uint8Array<ArrayBuffer>
|
||||||
| Uint16Array
|
| Uint16Array<ArrayBuffer>
|
||||||
| Uint32Array
|
| Uint32Array<ArrayBuffer>
|
||||||
| Uint8ClampedArray
|
| Uint8ClampedArray<ArrayBuffer>
|
||||||
| BigInt64Array
|
| BigInt64Array<ArrayBuffer>
|
||||||
| BigUint64Array,
|
| BigUint64Array<ArrayBuffer>,
|
||||||
>(
|
>(
|
||||||
array: T,
|
array: T,
|
||||||
): T;
|
): T;
|
||||||
|
|
24
cli/tsc/dts/lib.deno_web.d.ts
vendored
24
cli/tsc/dts/lib.deno_web.d.ts
vendored
|
@ -427,7 +427,7 @@ interface TextDecoder extends TextDecoderCommon {
|
||||||
/** Turns binary data, often in the form of a Uint8Array, into a string given
|
/** Turns binary data, often in the form of a Uint8Array, into a string given
|
||||||
* the encoding.
|
* the encoding.
|
||||||
*/
|
*/
|
||||||
decode(input?: BufferSource, options?: TextDecodeOptions): string;
|
decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Encoding */
|
/** @category Encoding */
|
||||||
|
@ -492,7 +492,7 @@ interface TextEncoderCommon {
|
||||||
/** @category Encoding */
|
/** @category Encoding */
|
||||||
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
||||||
readonly readable: ReadableStream<string>;
|
readonly readable: ReadableStream<string>;
|
||||||
readonly writable: WritableStream<BufferSource>;
|
readonly writable: WritableStream<AllowSharedBufferSource>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @category Encoding */
|
/** @category Encoding */
|
||||||
|
@ -503,7 +503,7 @@ declare var TextDecoderStream: {
|
||||||
|
|
||||||
/** @category Encoding */
|
/** @category Encoding */
|
||||||
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||||
readonly writable: WritableStream<string>;
|
readonly writable: WritableStream<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,9 +681,9 @@ interface Blob {
|
||||||
readonly size: number;
|
readonly size: number;
|
||||||
readonly type: string;
|
readonly type: string;
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
arrayBuffer(): Promise<ArrayBuffer>;
|
||||||
bytes(): Promise<Uint8Array>;
|
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
||||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||||
stream(): ReadableStream<Uint8Array>;
|
stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||||
text(): Promise<string>;
|
text(): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,7 +788,9 @@ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
|
||||||
/** @category Streams */
|
/** @category Streams */
|
||||||
declare var ReadableStreamBYOBReader: {
|
declare var ReadableStreamBYOBReader: {
|
||||||
readonly prototype: ReadableStreamBYOBReader;
|
readonly prototype: ReadableStreamBYOBReader;
|
||||||
new (stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
|
new (
|
||||||
|
stream: ReadableStream<Uint8Array<ArrayBuffer>>,
|
||||||
|
): ReadableStreamBYOBReader;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @category Streams */
|
/** @category Streams */
|
||||||
|
@ -973,7 +975,7 @@ declare var ReadableStream: {
|
||||||
new (
|
new (
|
||||||
underlyingSource: UnderlyingByteSource,
|
underlyingSource: UnderlyingByteSource,
|
||||||
strategy?: { highWaterMark?: number },
|
strategy?: { highWaterMark?: number },
|
||||||
): ReadableStream<Uint8Array>;
|
): ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||||
new <R = any>(
|
new <R = any>(
|
||||||
underlyingSource: UnderlyingDefaultSource<R>,
|
underlyingSource: UnderlyingDefaultSource<R>,
|
||||||
strategy?: QueuingStrategy<R>,
|
strategy?: QueuingStrategy<R>,
|
||||||
|
@ -1353,7 +1355,7 @@ declare function structuredClone<T = any>(
|
||||||
* @category Streams
|
* @category Streams
|
||||||
*/
|
*/
|
||||||
interface CompressionStream extends GenericTransformStream {
|
interface CompressionStream extends GenericTransformStream {
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||||
readonly writable: WritableStream<BufferSource>;
|
readonly writable: WritableStream<BufferSource>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1400,7 +1402,7 @@ declare var CompressionStream: {
|
||||||
* @category Streams
|
* @category Streams
|
||||||
*/
|
*/
|
||||||
interface DecompressionStream extends GenericTransformStream {
|
interface DecompressionStream extends GenericTransformStream {
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||||
readonly writable: WritableStream<BufferSource>;
|
readonly writable: WritableStream<BufferSource>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1463,7 +1465,7 @@ interface ImageDataSettings {
|
||||||
/** @category Platform */
|
/** @category Platform */
|
||||||
interface ImageData {
|
interface ImageData {
|
||||||
readonly colorSpace: PredefinedColorSpace;
|
readonly colorSpace: PredefinedColorSpace;
|
||||||
readonly data: Uint8ClampedArray;
|
readonly data: Uint8ClampedArray<ArrayBuffer>;
|
||||||
readonly height: number;
|
readonly height: number;
|
||||||
readonly width: number;
|
readonly width: number;
|
||||||
}
|
}
|
||||||
|
@ -1473,7 +1475,7 @@ declare var ImageData: {
|
||||||
readonly prototype: ImageData;
|
readonly prototype: ImageData;
|
||||||
new (sw: number, sh: number, settings?: ImageDataSettings): ImageData;
|
new (sw: number, sh: number, settings?: ImageDataSettings): ImageData;
|
||||||
new (
|
new (
|
||||||
data: Uint8ClampedArray,
|
data: Uint8ClampedArray<ArrayBuffer>,
|
||||||
sw: number,
|
sw: number,
|
||||||
sh?: number,
|
sh?: number,
|
||||||
settings?: ImageDataSettings,
|
settings?: ImageDataSettings,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { assertEquals, assertRejects } from "./test_util.ts";
|
||||||
|
|
||||||
const prefix = "tests/testdata/image";
|
const prefix = "tests/testdata/image";
|
||||||
|
|
||||||
function generateNumberedData(n: number): Uint8ClampedArray {
|
function generateNumberedData(n: number): Uint8ClampedArray<ArrayBuffer> {
|
||||||
return new Uint8ClampedArray(
|
return new Uint8ClampedArray(
|
||||||
Array.from({ length: n }, (_, i) => [i + 1, 0, 0, 1]).flat(),
|
Array.from({ length: n }, (_, i) => [i + 1, 0, 0, 1]).flat(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -717,9 +717,9 @@ Deno.test(async function testAesCbcEncryptDecrypt() {
|
||||||
Deno.test(async function testAesCtrEncryptDecrypt() {
|
Deno.test(async function testAesCtrEncryptDecrypt() {
|
||||||
async function aesCtrRoundTrip(
|
async function aesCtrRoundTrip(
|
||||||
key: CryptoKey,
|
key: CryptoKey,
|
||||||
counter: Uint8Array,
|
counter: Uint8Array<ArrayBuffer>,
|
||||||
length: number,
|
length: number,
|
||||||
plainText: Uint8Array,
|
plainText: Uint8Array<ArrayBuffer>,
|
||||||
) {
|
) {
|
||||||
const cipherText = await crypto.subtle.encrypt(
|
const cipherText = await crypto.subtle.encrypt(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue