mirror of
https://github.com/denoland/deno.git
synced 2025-09-25 11:49:11 +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
|
||||
* a `Uint8Array`.
|
||||
*/
|
||||
bytes(): Promise<Uint8Array>;
|
||||
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
||||
/**
|
||||
* Reads the stream to completion. It returns a promise that resolves with
|
||||
* 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 */
|
||||
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.
|
||||
|
|
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";
|
||||
/** @category Crypto */
|
||||
type NamedCurve = string;
|
||||
/** @category Crypto */
|
||||
type BigInteger = Uint8Array<ArrayBuffer>;
|
||||
|
||||
/** @category Crypto */
|
||||
interface RsaOtherPrimesInfo {
|
||||
|
@ -121,7 +123,7 @@ interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
|||
/** @category Crypto */
|
||||
interface RsaKeyGenParams extends Algorithm {
|
||||
modulusLength: number;
|
||||
publicExponent: Uint8Array;
|
||||
publicExponent: BigInteger;
|
||||
}
|
||||
|
||||
/** @category Crypto */
|
||||
|
@ -131,7 +133,7 @@ interface RsaPssParams extends Algorithm {
|
|||
|
||||
/** @category Crypto */
|
||||
interface RsaOaepParams extends Algorithm {
|
||||
label?: Uint8Array;
|
||||
label?: BufferSource;
|
||||
}
|
||||
|
||||
/** @category Crypto */
|
||||
|
@ -159,7 +161,7 @@ interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
|||
/** @category Crypto */
|
||||
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
||||
modulusLength: number;
|
||||
publicExponent: Uint8Array;
|
||||
publicExponent: BigInteger;
|
||||
}
|
||||
|
||||
/** @category Crypto */
|
||||
|
@ -651,15 +653,15 @@ interface Crypto {
|
|||
*/
|
||||
getRandomValues<
|
||||
T extends
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| Uint8Array
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Uint8ClampedArray
|
||||
| BigInt64Array
|
||||
| BigUint64Array,
|
||||
| Int8Array<ArrayBuffer>
|
||||
| Int16Array<ArrayBuffer>
|
||||
| Int32Array<ArrayBuffer>
|
||||
| Uint8Array<ArrayBuffer>
|
||||
| Uint16Array<ArrayBuffer>
|
||||
| Uint32Array<ArrayBuffer>
|
||||
| Uint8ClampedArray<ArrayBuffer>
|
||||
| BigInt64Array<ArrayBuffer>
|
||||
| BigUint64Array<ArrayBuffer>,
|
||||
>(
|
||||
array: 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
|
||||
* the encoding.
|
||||
*/
|
||||
decode(input?: BufferSource, options?: TextDecodeOptions): string;
|
||||
decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string;
|
||||
}
|
||||
|
||||
/** @category Encoding */
|
||||
|
@ -492,7 +492,7 @@ interface TextEncoderCommon {
|
|||
/** @category Encoding */
|
||||
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
||||
readonly readable: ReadableStream<string>;
|
||||
readonly writable: WritableStream<BufferSource>;
|
||||
readonly writable: WritableStream<AllowSharedBufferSource>;
|
||||
}
|
||||
|
||||
/** @category Encoding */
|
||||
|
@ -503,7 +503,7 @@ declare var TextDecoderStream: {
|
|||
|
||||
/** @category Encoding */
|
||||
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||
readonly writable: WritableStream<string>;
|
||||
}
|
||||
|
||||
|
@ -681,9 +681,9 @@ interface Blob {
|
|||
readonly size: number;
|
||||
readonly type: string;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
bytes(): Promise<Uint8Array>;
|
||||
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
stream(): ReadableStream<Uint8Array>;
|
||||
stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,9 @@ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
|
|||
/** @category Streams */
|
||||
declare var ReadableStreamBYOBReader: {
|
||||
readonly prototype: ReadableStreamBYOBReader;
|
||||
new (stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
|
||||
new (
|
||||
stream: ReadableStream<Uint8Array<ArrayBuffer>>,
|
||||
): ReadableStreamBYOBReader;
|
||||
};
|
||||
|
||||
/** @category Streams */
|
||||
|
@ -973,7 +975,7 @@ declare var ReadableStream: {
|
|||
new (
|
||||
underlyingSource: UnderlyingByteSource,
|
||||
strategy?: { highWaterMark?: number },
|
||||
): ReadableStream<Uint8Array>;
|
||||
): ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||
new <R = any>(
|
||||
underlyingSource: UnderlyingDefaultSource<R>,
|
||||
strategy?: QueuingStrategy<R>,
|
||||
|
@ -1353,7 +1355,7 @@ declare function structuredClone<T = any>(
|
|||
* @category Streams
|
||||
*/
|
||||
interface CompressionStream extends GenericTransformStream {
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||
readonly writable: WritableStream<BufferSource>;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1402,7 @@ declare var CompressionStream: {
|
|||
* @category Streams
|
||||
*/
|
||||
interface DecompressionStream extends GenericTransformStream {
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
readonly readable: ReadableStream<Uint8Array<ArrayBuffer>>;
|
||||
readonly writable: WritableStream<BufferSource>;
|
||||
}
|
||||
|
||||
|
@ -1463,7 +1465,7 @@ interface ImageDataSettings {
|
|||
/** @category Platform */
|
||||
interface ImageData {
|
||||
readonly colorSpace: PredefinedColorSpace;
|
||||
readonly data: Uint8ClampedArray;
|
||||
readonly data: Uint8ClampedArray<ArrayBuffer>;
|
||||
readonly height: number;
|
||||
readonly width: number;
|
||||
}
|
||||
|
@ -1473,7 +1475,7 @@ declare var ImageData: {
|
|||
readonly prototype: ImageData;
|
||||
new (sw: number, sh: number, settings?: ImageDataSettings): ImageData;
|
||||
new (
|
||||
data: Uint8ClampedArray,
|
||||
data: Uint8ClampedArray<ArrayBuffer>,
|
||||
sw: number,
|
||||
sh?: number,
|
||||
settings?: ImageDataSettings,
|
||||
|
|
|
@ -4,7 +4,7 @@ import { assertEquals, assertRejects } from "./test_util.ts";
|
|||
|
||||
const prefix = "tests/testdata/image";
|
||||
|
||||
function generateNumberedData(n: number): Uint8ClampedArray {
|
||||
function generateNumberedData(n: number): Uint8ClampedArray<ArrayBuffer> {
|
||||
return new Uint8ClampedArray(
|
||||
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() {
|
||||
async function aesCtrRoundTrip(
|
||||
key: CryptoKey,
|
||||
counter: Uint8Array,
|
||||
counter: Uint8Array<ArrayBuffer>,
|
||||
length: number,
|
||||
plainText: Uint8Array,
|
||||
plainText: Uint8Array<ArrayBuffer>,
|
||||
) {
|
||||
const cipherText = await crypto.subtle.encrypt(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue