From ce1ee97d551cf8be65b354fa49612e65cc69f249 Mon Sep 17 00:00:00 2001 From: Nicolas Le Cam Date: Tue, 16 Sep 2025 23:02:31 +0200 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73672=20=20fea?= =?UTF-8?q?t(uuid):=20remove=20types=20by=20@KuSh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/uuid/.npmignore | 8 -- types/uuid/index.d.mts | 19 ---- types/uuid/index.d.ts | 113 --------------------- types/uuid/package.json | 43 -------- types/uuid/tsconfig.json | 19 ---- types/uuid/uuid-tests.ts | 183 ---------------------------------- types/uuid/v2/.npmignore | 5 - types/uuid/v2/index.d.ts | 30 ------ types/uuid/v2/package.json | 20 ---- types/uuid/v2/tsconfig.json | 19 ---- types/uuid/v2/uuid-tests.ts | 45 --------- types/uuid/v3/.npmignore | 5 - types/uuid/v3/index.d.ts | 13 --- types/uuid/v3/interfaces.d.ts | 29 ------ types/uuid/v3/package.json | 30 ------ types/uuid/v3/tsconfig.json | 19 ---- types/uuid/v3/uuid-tests.ts | 74 -------------- types/uuid/v3/v1.d.ts | 5 - types/uuid/v3/v4.d.ts | 5 - types/uuid/v3/v5.d.ts | 12 --- types/uuid/v7/.npmignore | 5 - types/uuid/v7/index.d.ts | 6 -- types/uuid/v7/interfaces.d.ts | 60 ----------- types/uuid/v7/package.json | 34 ------- types/uuid/v7/tsconfig.json | 19 ---- types/uuid/v7/uuid-tests.ts | 88 ---------------- types/uuid/v7/v1.d.ts | 8 -- types/uuid/v7/v3.d.ts | 8 -- types/uuid/v7/v4.d.ts | 8 -- types/uuid/v7/v5.d.ts | 8 -- 31 files changed, 4 insertions(+), 940 deletions(-) delete mode 100644 types/uuid/.npmignore delete mode 100644 types/uuid/index.d.mts delete mode 100644 types/uuid/index.d.ts delete mode 100644 types/uuid/package.json delete mode 100644 types/uuid/tsconfig.json delete mode 100644 types/uuid/uuid-tests.ts delete mode 100644 types/uuid/v2/.npmignore delete mode 100644 types/uuid/v2/index.d.ts delete mode 100644 types/uuid/v2/package.json delete mode 100644 types/uuid/v2/tsconfig.json delete mode 100644 types/uuid/v2/uuid-tests.ts delete mode 100644 types/uuid/v3/.npmignore delete mode 100644 types/uuid/v3/index.d.ts delete mode 100644 types/uuid/v3/interfaces.d.ts delete mode 100644 types/uuid/v3/package.json delete mode 100644 types/uuid/v3/tsconfig.json delete mode 100644 types/uuid/v3/uuid-tests.ts delete mode 100644 types/uuid/v3/v1.d.ts delete mode 100644 types/uuid/v3/v4.d.ts delete mode 100644 types/uuid/v3/v5.d.ts delete mode 100644 types/uuid/v7/.npmignore delete mode 100644 types/uuid/v7/index.d.ts delete mode 100644 types/uuid/v7/interfaces.d.ts delete mode 100644 types/uuid/v7/package.json delete mode 100644 types/uuid/v7/tsconfig.json delete mode 100644 types/uuid/v7/uuid-tests.ts delete mode 100644 types/uuid/v7/v1.d.ts delete mode 100644 types/uuid/v7/v3.d.ts delete mode 100644 types/uuid/v7/v4.d.ts delete mode 100644 types/uuid/v7/v5.d.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 59e4769c1f949f7..4c68a86d77da081 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -7839,6 +7839,10 @@ "libraryName": "username", "asOfVersion": "5.0.0" }, + "uuid": { + "libraryName": "uuid", + "asOfVersion": "11.0.0" + }, "uuid-apikey": { "libraryName": "uuid-apikey", "asOfVersion": "1.5.0" diff --git a/types/uuid/.npmignore b/types/uuid/.npmignore deleted file mode 100644 index 7e0f9c239fa89a8..000000000000000 --- a/types/uuid/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts -/v2/ -/v3/ -/v7/ diff --git a/types/uuid/index.d.mts b/types/uuid/index.d.mts deleted file mode 100644 index 84bc5bd8d279b06..000000000000000 --- a/types/uuid/index.d.mts +++ /dev/null @@ -1,19 +0,0 @@ -import uuid from "./index.js"; -export import v1 = uuid.v1; -export import v1ToV6 = uuid.v1ToV6; -export import v3 = uuid.v3; -export import v4 = uuid.v4; -export import v5 = uuid.v5; -export import v6 = uuid.v6; -export import v6ToV1 = uuid.v6ToV1; -export import v7 = uuid.v7; -export import NIL = uuid.NIL; -export import MAX = uuid.MAX; -export import version = uuid.version; -export import validate = uuid.validate; -export import stringify = uuid.stringify; -export import parse = uuid.parse; -export import V1Options = uuid.V1Options; -export import V4Options = uuid.V4Options; -export import V6Options = uuid.V6Options; -export import V7Options = uuid.V7Options; diff --git a/types/uuid/index.d.ts b/types/uuid/index.d.ts deleted file mode 100644 index 4a2edac06fe37b7..000000000000000 --- a/types/uuid/index.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -// disable automatic export -export {}; - -// Uses ArrayLike to admit Uint8 and co. -type OutputBuffer = ArrayLike; -type InputBuffer = ArrayLike; - -interface RandomOptions { - /** `Array` of 16 random bytes (0-255) */ - random?: InputBuffer | undefined; -} -interface RngOptions { - /** Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) */ - rng?: (() => InputBuffer) | undefined; -} - -interface V1BaseOptions { - /** RFC "node" field as an `Array[6]` of byte values (per 4.1.6) */ - node?: InputBuffer | undefined; - /** RFC "clock sequence" as a `Number` between 0 - 0x3fff */ - clockseq?: number | undefined; - /** RFC "timestamp" field (`Number` of milliseconds, unix epoch) */ - msecs?: number | Date | undefined; - /** RFC "timestamp" field (`Number` of nanoseconds to add to msecs, should be 0-10,000) */ - nsecs?: number | undefined; -} -interface V1RandomOptions extends V1BaseOptions, RandomOptions {} -interface V1RngOptions extends V1BaseOptions, RngOptions {} - -export type V1Options = V1RandomOptions | V1RngOptions; -export type V4Options = RandomOptions | RngOptions; -export type V6Options = V1Options; - -interface V7BaseOptions { - msecs?: number | Date | undefined; - seq?: number; -} -export type V7Options = (RandomOptions | RngOptions) & V7BaseOptions; - -type VToV = ((uuid: string) => string) & ((uuid: OutputBuffer) => Uint8Array); - -type v1String = (options?: V1Options) => string; -type v1Buffer = (options: V1Options | null | undefined, buffer: T, offset?: number) => T; -type v1 = v1Buffer & v1String; - -type v1ToV6 = VToV; - -type v4String = (options?: V4Options) => string; -type v4Buffer = (options: V4Options | null | undefined, buffer: T, offset?: number) => T; -type v4 = v4Buffer & v4String; - -type v3String = (name: string | InputBuffer, namespace: string | InputBuffer) => string; -type v3Buffer = ( - name: string | InputBuffer, - namespace: string | InputBuffer, - buffer: T, - offset?: number, -) => T; -interface v3Static { - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L16 - DNS: string; - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L17 - URL: string; -} -type v3 = v3Buffer & v3String & v3Static; - -type v5String = (name: string | InputBuffer, namespace: string | InputBuffer) => string; -type v5Buffer = ( - name: string | InputBuffer, - namespace: string | InputBuffer, - buffer: T, - offset?: number, -) => T; -interface v5Static { - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L16 - DNS: string; - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L17 - URL: string; -} -type v5 = v5Buffer & v5String & v5Static; - -type v6String = (options?: V6Options) => string; -type v6Buffer = (options: V6Options | null | undefined, buffer: T, offset?: number) => T; -type v6 = v6Buffer & v6String; - -type v6ToV1 = VToV; - -type v7String = (options?: V7Options) => string; -type v7Buffer = (options: V7Options | null | undefined, buffer: T, offset?: number) => T; -type v7 = v7Buffer & v7String; - -type NIL = string; -type MAX = string; - -type parse = (uuid: string) => Uint8Array; -type stringify = (buffer: InputBuffer, offset?: number) => string; -type validate = (uuid: string) => boolean; -type version = (uuid: string) => number; - -export const NIL: NIL; -export const MAX: MAX; -export const parse: parse; -export const stringify: stringify; -export const v1: v1; -export const v1ToV6: v1ToV6; -export const v3: v3; -export const v4: v4; -export const v5: v5; -export const v6: v6; -export const v6ToV1: v6ToV1; -export const v7: v7; -export const validate: validate; -export const version: version; diff --git a/types/uuid/package.json b/types/uuid/package.json deleted file mode 100644 index fba4908c814976e..000000000000000 --- a/types/uuid/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "private": true, - "name": "@types/uuid", - "version": "10.0.9999", - "projects": [ - "https://github.com/uuidjs/uuid" - ], - "exports": { - "./package.json": "./package.json", - ".": { - "types": { - "import": "./index.d.mts", - "default": "./index.d.ts" - } - } - }, - "devDependencies": { - "@types/node": "*", - "@types/uuid": "workspace:." - }, - "owners": [ - { - "name": "Oliver Hoffmann", - "githubUsername": "iamolivinius" - }, - { - "name": "Felipe Ochoa", - "githubUsername": "felipeochoa" - }, - { - "name": "Chris Barth", - "githubUsername": "cjbarth" - }, - { - "name": "Linus Unnebäck", - "githubUsername": "LinusU" - }, - { - "name": "Christoph Tavan", - "githubUsername": "ctavan" - } - ] -} diff --git a/types/uuid/tsconfig.json b/types/uuid/tsconfig.json deleted file mode 100644 index fff0a0d8fac1a8f..000000000000000 --- a/types/uuid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uuid-tests.ts" - ] -} diff --git a/types/uuid/uuid-tests.ts b/types/uuid/uuid-tests.ts deleted file mode 100644 index a22cb401ca7342d..000000000000000 --- a/types/uuid/uuid-tests.ts +++ /dev/null @@ -1,183 +0,0 @@ -/// - -import { - MAX as MAX_UUID, - NIL as NIL_UUID, - parse as uuidParse, - stringify as uuidStringify, - v1 as uuidv1, - V1Options, - v1ToV6, - v3 as uuidv3, - v4 as uuidv4, - V4Options, - v5 as uuidv5, - v6 as uuidv6, - V6Options, - v6ToV1, - v7 as uuidv7, - V7Options, - validate as uuidValidate, - version as uuidVersion, -} from "uuid"; - -const randoms = [ - 0x10, - 0x91, - 0x56, - 0xbe, - 0xc4, - 0xfb, - 0xc1, - 0xea, - 0x71, - 0xb4, - 0xef, - 0xe1, - 0x67, - 0x1c, - 0x58, - 0x36, -]; - -let stringv1: string = uuidv1(); -stringv1 = uuidv1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); -stringv1 = uuidv1({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - random: randoms, -}); -stringv1 = uuidv1({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - rng: () => randoms, -}); - -const v1Options: V1Options = { - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - rng: () => randoms, -}; -stringv1 = uuidv1(v1Options); - -let bufferv1 = new Uint8Array(32); -bufferv1 = uuidv1(null, bufferv1); -bufferv1 = uuidv1(undefined, bufferv1, 16); - -const stringv16: string = v1ToV6(stringv1); -const bufferv16: Uint8Array = v1ToV6(bufferv1); -const arrayv16: ArrayLike = v1ToV6(uuidv6(undefined, [])); - -let stringv4: string = uuidv4(); -stringv4 = uuidv4({ random: randoms }); -stringv4 = uuidv4({ rng: () => randoms }); - -const v4Options: V4Options = { random: randoms }; -stringv4 = uuidv4(v4Options); - -let bufferv4: number[] = new Array(32); -bufferv4 = uuidv4(undefined, bufferv4); -bufferv4 = uuidv4(null, bufferv4, 16); - -let stringv6: string = uuidv6(); -stringv6 = uuidv6({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); -stringv6 = uuidv6({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - random: randoms, -}); -stringv6 = uuidv6({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - rng: () => randoms, -}); - -const v6Options: V6Options = { - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - rng: () => randoms, -}; -stringv6 = uuidv6(v6Options); - -let bufferv6 = new Uint8Array(32); -bufferv6 = uuidv6(null, bufferv1); -bufferv6 = uuidv6(undefined, bufferv1, 16); - -const stringv61: string = v6ToV1(stringv6); -const bufferv61: Uint8Array = v6ToV1(bufferv6); -const arrayv61: ArrayLike = v6ToV1(uuidv6(undefined, [])); - -let stringv7: string = uuidv7(); -stringv7 = uuidv7({ random: randoms }); -stringv7 = uuidv7({ rng: () => randoms }); -stringv7 = uuidv7({ - msecs: new Date("2011-11-01").getTime(), - random: randoms, -}); -stringv7 = uuidv7({ - msecs: new Date("2011-11-01").getTime(), - rng: () => randoms, -}); - -const v7Options: V7Options = { - msecs: new Date("2011-11-01").getTime(), - random: randoms, -}; -stringv7 = uuidv7(v7Options); - -let bufferv7: number[] = new Array(32); -bufferv7 = uuidv4(undefined, bufferv7); -bufferv7 = uuidv4(null, bufferv7, 16); - -// https://github.com/uuidjs/uuid#quickstart---commonjs-recommended -const MY_NAMESPACE = uuidv4(); -const a3: string = uuidv3("hello", MY_NAMESPACE); -const b3: string = uuidv3("world", MY_NAMESPACE); -const c3: Buffer = uuidv3("world", MY_NAMESPACE, Buffer.alloc(16)); -const d3: number[] = uuidv3("world", MY_NAMESPACE, [], 0); - -const e3: string = uuidv3("hello.example.com", uuidv3.DNS); -const f3: string = uuidv3("http://example.com/hello", uuidv3.URL); - -const a5: string = uuidv5("hello", MY_NAMESPACE); -const b5: string = uuidv5("world", MY_NAMESPACE); -const c5: Buffer = uuidv5("world", MY_NAMESPACE, Buffer.alloc(16)); -const d5: number[] = uuidv5("world", MY_NAMESPACE, [], 0); - -const e5: string = uuidv5("hello.example.com", uuidv5.DNS); -const f5: string = uuidv5("http://example.com/hello", uuidv5.URL); - -const g = Buffer.alloc(16); -uuidv4(null, g); // $ExpectType Buffer || Buffer - -class CustomBuffer extends Uint8Array {} -const h = new CustomBuffer(10); -uuidv4(null, h); // $ExpectType CustomBuffer - -const nil5: string = uuidv5("hello", NIL_UUID); - -const stringified: string = uuidStringify(bufferv4); -const parsed: Uint8Array = uuidParse(stringified); - -let valid: boolean = uuidValidate(stringv1); -valid = uuidValidate(stringv4); -valid = uuidValidate(a3); -valid = uuidValidate(a5); -valid = uuidValidate(NIL_UUID); -valid = uuidValidate(MAX_UUID); - -let version: number = uuidVersion(stringv1); -version = uuidVersion(stringv4); -version = uuidVersion(a3); -version = uuidVersion(a5); -version = uuidVersion(MAX_UUID); diff --git a/types/uuid/v2/.npmignore b/types/uuid/v2/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/uuid/v2/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/uuid/v2/index.d.ts b/types/uuid/v2/index.d.ts deleted file mode 100644 index 16dcfaa2a9dd4f1..000000000000000 --- a/types/uuid/v2/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -declare namespace uuid { - interface V1Options { - node?: number[] | undefined; - clockseq?: number | undefined; - msecs?: number | Date | undefined; - nsecs?: number | undefined; - } - - type V4Options = { random: number[] } | { rng: () => number[] }; - - interface UuidStatic { - (options?: V4Options): string; - (options: V4Options | null, buffer: number[], offset?: number): number[]; - (options: V4Options | null, buffer: Buffer, offset?: number): Buffer; - - v1(options?: V1Options): string; - v1(options: V1Options | null, buffer: number[], offset?: number): number[]; - v1(options: V1Options | null, buffer: Buffer, offset?: number): Buffer; - v4: UuidStatic; - parse(id: string): number[]; - parse(id: string, buffer: number[], offset?: number): number[]; - parse(id: string, buffer: Buffer, offset?: number): Buffer; - unparse(buffer: number[] | Buffer, offset?: number): string; - } -} - -declare const uuid: uuid.UuidStatic; -export = uuid; diff --git a/types/uuid/v2/package.json b/types/uuid/v2/package.json deleted file mode 100644 index a08861926bea76d..000000000000000 --- a/types/uuid/v2/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/uuid", - "version": "2.0.9999", - "projects": [ - "https://github.com/defunctzombie/node-uuid" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/uuid": "workspace:." - }, - "owners": [ - { - "name": "Oliver Hoffmann", - "githubUsername": "iamolivinius" - } - ] -} diff --git a/types/uuid/v2/tsconfig.json b/types/uuid/v2/tsconfig.json deleted file mode 100644 index fff0a0d8fac1a8f..000000000000000 --- a/types/uuid/v2/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uuid-tests.ts" - ] -} diff --git a/types/uuid/v2/uuid-tests.ts b/types/uuid/v2/uuid-tests.ts deleted file mode 100644 index 864328f10bdae1a..000000000000000 --- a/types/uuid/v2/uuid-tests.ts +++ /dev/null @@ -1,45 +0,0 @@ -import uuid = require("uuid"); - -let uuidv1: string = uuid.v1(); - -uuidv1 = uuid.v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); - -let bufferv1: number[] = new Array(32); -bufferv1 = uuid.v1(null, bufferv1); -bufferv1 = uuid.v1(null, bufferv1, 16); - -let uuidv4: string = uuid.v4(); - -const randoms = [ - 0x10, - 0x91, - 0x56, - 0xbe, - 0xc4, - 0xfb, - 0xc1, - 0xea, - 0x71, - 0xb4, - 0xef, - 0xe1, - 0x67, - 0x1c, - 0x58, - 0x36, -]; -uuidv4 = uuid({ random: randoms }); -uuidv4 = uuid({ rng: () => randoms }); - -let bufferv4: number[] = new Array(32); -bufferv4 = uuid(null, bufferv4); -bufferv4 = uuid(null, bufferv4, 16); - -let nodeBufferv4: Buffer = Buffer.alloc(32); -nodeBufferv4 = uuid.v4(null, nodeBufferv4); -nodeBufferv4 = uuid.v4(null, nodeBufferv4, 16); diff --git a/types/uuid/v3/.npmignore b/types/uuid/v3/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/uuid/v3/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/uuid/v3/index.d.ts b/types/uuid/v3/index.d.ts deleted file mode 100644 index c23abcc80c38f26..000000000000000 --- a/types/uuid/v3/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// The version number has been artificially set to 3.4, instead of 3.0, -// because of the existing uuid-js npm types package being at 3.3.28, -// meaning that `npm install @types/uuid` was installing the typings for uuid-js, not this - -import { v1, v4 } from "./interfaces"; - -interface UuidStatic { - v1: v1; - v4: v4; -} - -declare const uuid: UuidStatic & v4; -export = uuid; diff --git a/types/uuid/v3/interfaces.d.ts b/types/uuid/v3/interfaces.d.ts deleted file mode 100644 index 42cad20cfb7f491..000000000000000 --- a/types/uuid/v3/interfaces.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Uses ArrayLike to admit Unit8 and co. -export type OutputBuffer = ArrayLike; -export type InputBuffer = ArrayLike; - -export interface V1Options { - node?: InputBuffer | undefined; - clockseq?: number | undefined; - msecs?: number | Date | undefined; - nsecs?: number | undefined; -} - -export type V4Options = { random: InputBuffer } | { rng(): InputBuffer }; - -export type v1String = (options?: V1Options) => string; -export type v1Buffer = (options: V1Options | null | undefined, buffer: T, offset?: number) => T; -export type v1 = v1Buffer & v1String; - -export type v4String = (options?: V4Options) => string; -export type v4Buffer = (options: V4Options | null | undefined, buffer: T, offset?: number) => T; -export type v4 = v4Buffer & v4String; - -export type v5String = (name: string | InputBuffer, namespace: string | InputBuffer) => string; -export type v5Buffer = ( - name: string | InputBuffer, - namespace: string | InputBuffer, - buffer: T, - offset?: number, -) => T; -export type v5 = v5Buffer & v5String; diff --git a/types/uuid/v3/package.json b/types/uuid/v3/package.json deleted file mode 100644 index 39db129b9224071..000000000000000 --- a/types/uuid/v3/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "private": true, - "name": "@types/uuid", - "version": "3.4.9999", - "projects": [ - "https://github.com/kelektiv/node-uuid" - ], - "devDependencies": { - "@types/node": "*", - "@types/uuid": "workspace:." - }, - "owners": [ - { - "name": "Oliver Hoffmann", - "githubUsername": "iamolivinius" - }, - { - "name": "Felipe Ochoa", - "githubUsername": "felipeochoa" - }, - { - "name": "Chris Barth", - "githubUsername": "cjbarth" - }, - { - "name": "Linus Unnebäck", - "githubUsername": "LinusU" - } - ] -} diff --git a/types/uuid/v3/tsconfig.json b/types/uuid/v3/tsconfig.json deleted file mode 100644 index fff0a0d8fac1a8f..000000000000000 --- a/types/uuid/v3/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uuid-tests.ts" - ] -} diff --git a/types/uuid/v3/uuid-tests.ts b/types/uuid/v3/uuid-tests.ts deleted file mode 100644 index 0e0b34a9086ea47..000000000000000 --- a/types/uuid/v3/uuid-tests.ts +++ /dev/null @@ -1,74 +0,0 @@ -/// - -import v1 = require("uuid/v1"); -import v4 = require("uuid/v4"); -import v5 = require("uuid/v5"); - -let uuidv1: string = v1(); - -uuidv1 = v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); - -uuidv1 = v1(); -uuidv1 = v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); - -let bufferv1 = new Uint8Array(32); -bufferv1 = v1(null, bufferv1); -bufferv1 = v1(undefined, bufferv1, 16); -bufferv1 = v1(undefined, bufferv1); -bufferv1 = v1(null, bufferv1, 16); - -let uuidv4: string = v4(); - -const randoms = [ - 0x10, - 0x91, - 0x56, - 0xbe, - 0xc4, - 0xfb, - 0xc1, - 0xea, - 0x71, - 0xb4, - 0xef, - 0xe1, - 0x67, - 0x1c, - 0x58, - 0x36, -]; -uuidv4 = v4({ random: randoms }); -uuidv4 = v4({ rng: () => randoms }); - -let bufferv4: number[] = new Array(32); -bufferv4 = v4(undefined, bufferv4); -bufferv4 = v4(null, bufferv4, 16); -bufferv4 = v4(null, bufferv4); -bufferv4 = v4(undefined, bufferv4, 16); - -const MY_NAMESPACE = v4(); -const a: string = v5("hello", MY_NAMESPACE); -const b: string = v5("world", MY_NAMESPACE); -const c: Buffer = v5("world", MY_NAMESPACE, new Buffer(16)); -const d: number[] = v5("world", MY_NAMESPACE, [], 0); - -// https://github.com/kelektiv/node-uuid#quickstart---commonjs-recommended -const e: string = v5("hello.example.com", v5.DNS); -const f: string = v5("http://example.com/hello", v5.URL); - -const g = Buffer.alloc(16); -v4(null, g); // $ExpectType Buffer || Buffer - -class CustomBuffer extends Uint8Array {} -const h = new CustomBuffer(10); -v4(null, h); // $ExpectType CustomBuffer diff --git a/types/uuid/v3/v1.d.ts b/types/uuid/v3/v1.d.ts deleted file mode 100644 index ef0c8e2d10ebe0a..000000000000000 --- a/types/uuid/v3/v1.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { v1 } from "./interfaces"; - -declare const v1: v1; - -export = v1; diff --git a/types/uuid/v3/v4.d.ts b/types/uuid/v3/v4.d.ts deleted file mode 100644 index c7e24ff8314e315..000000000000000 --- a/types/uuid/v3/v4.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { v4 } from "./interfaces"; - -declare const v4: v4; - -export = v4; diff --git a/types/uuid/v3/v5.d.ts b/types/uuid/v3/v5.d.ts deleted file mode 100644 index 4351e001c950fd0..000000000000000 --- a/types/uuid/v3/v5.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { v5 } from "./interfaces"; - -interface v5Static { - // https://github.com/kelektiv/node-uuid/blob/master/v5.js#L47 - DNS: string; - // https://github.com/kelektiv/node-uuid/blob/master/v5.js#L48 - URL: string; -} - -declare const v5: v5Static & v5; - -export = v5; diff --git a/types/uuid/v7/.npmignore b/types/uuid/v7/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/uuid/v7/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/uuid/v7/index.d.ts b/types/uuid/v7/index.d.ts deleted file mode 100644 index 4d4d4fe5f85f685..000000000000000 --- a/types/uuid/v7/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { v1, v3, v4, v5 } from "./interfaces"; - -export const v1: v1; -export const v3: v3; -export const v4: v4; -export const v5: v5; diff --git a/types/uuid/v7/interfaces.d.ts b/types/uuid/v7/interfaces.d.ts deleted file mode 100644 index 764533b1256c31d..000000000000000 --- a/types/uuid/v7/interfaces.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Uses ArrayLike to admit Unit8 and co. -export type OutputBuffer = ArrayLike; -export type InputBuffer = ArrayLike; - -export interface RandomOptions { - random?: InputBuffer | undefined; -} -export interface RngOptions { - rng?: (() => InputBuffer) | undefined; -} - -export interface V1BaseOptions { - node?: InputBuffer | undefined; - clockseq?: number | undefined; - msecs?: number | Date | undefined; - nsecs?: number | undefined; -} -export interface V1RandomOptions extends V1BaseOptions, RandomOptions {} -export interface V1RngOptions extends V1BaseOptions, RngOptions {} - -export type V1Options = V1RandomOptions | V1RngOptions; -export type V4Options = RandomOptions | RngOptions; - -export type v1String = (options?: V1Options) => string; -export type v1Buffer = (options: V1Options | null | undefined, buffer: T, offset?: number) => T; -export type v1 = v1Buffer & v1String; - -export type v4String = (options?: V4Options) => string; -export type v4Buffer = (options: V4Options | null | undefined, buffer: T, offset?: number) => T; -export type v4 = v4Buffer & v4String; - -export type v3String = (name: string | InputBuffer, namespace: string | InputBuffer) => string; -export type v3Buffer = ( - name: string | InputBuffer, - namespace: string | InputBuffer, - buffer: T, - offset?: number, -) => T; -export interface v3Static { - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L22 - DNS: string; - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L23 - URL: string; -} -export type v3 = v3Buffer & v3String & v3Static; - -export type v5String = (name: string | InputBuffer, namespace: string | InputBuffer) => string; -export type v5Buffer = ( - name: string | InputBuffer, - namespace: string | InputBuffer, - buffer: T, - offset?: number, -) => T; -export interface v5Static { - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L22 - DNS: string; - // https://github.com/uuidjs/uuid/blob/master/src/v35.js#L23 - URL: string; -} -export type v5 = v5Buffer & v5String & v5Static; diff --git a/types/uuid/v7/package.json b/types/uuid/v7/package.json deleted file mode 100644 index a513d8c36dd72a0..000000000000000 --- a/types/uuid/v7/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "private": true, - "name": "@types/uuid", - "version": "7.0.9999", - "projects": [ - "https://github.com/uuidjs/uuid" - ], - "devDependencies": { - "@types/node": "*", - "@types/uuid": "workspace:." - }, - "owners": [ - { - "name": "Oliver Hoffmann", - "githubUsername": "iamolivinius" - }, - { - "name": "Felipe Ochoa", - "githubUsername": "felipeochoa" - }, - { - "name": "Chris Barth", - "githubUsername": "cjbarth" - }, - { - "name": "Linus Unnebäck", - "githubUsername": "LinusU" - }, - { - "name": "Christoph Tavan", - "githubUsername": "ctavan" - } - ] -} diff --git a/types/uuid/v7/tsconfig.json b/types/uuid/v7/tsconfig.json deleted file mode 100644 index fff0a0d8fac1a8f..000000000000000 --- a/types/uuid/v7/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "uuid-tests.ts" - ] -} diff --git a/types/uuid/v7/uuid-tests.ts b/types/uuid/v7/uuid-tests.ts deleted file mode 100644 index d05323cfd9c275e..000000000000000 --- a/types/uuid/v7/uuid-tests.ts +++ /dev/null @@ -1,88 +0,0 @@ -/// - -import { v1 as uuidv1, v3 as uuidv3, v4 as uuidv4, v5 as uuidv5 } from "uuid"; - -import v1 = require("uuid/v1"); -import v3 = require("uuid/v3"); -import v4 = require("uuid/v4"); -import v5 = require("uuid/v5"); - -const randoms = [ - 0x10, - 0x91, - 0x56, - 0xbe, - 0xc4, - 0xfb, - 0xc1, - 0xea, - 0x71, - 0xb4, - 0xef, - 0xe1, - 0x67, - 0x1c, - 0x58, - 0x36, -]; - -let stringv1: string = uuidv1(); -stringv1 = uuidv1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, -}); -stringv1 = uuidv1({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - random: randoms, -}); -stringv1 = uuidv1({ - msecs: new Date("2011-11-01").getTime(), - nsecs: 5678, - rng: () => randoms, -}); - -let bufferv1 = new Uint8Array(32); -bufferv1 = uuidv1(null, bufferv1); -bufferv1 = uuidv1(undefined, bufferv1, 16); - -let stringv4: string = uuidv4(); -stringv4 = uuidv4({ random: randoms }); -stringv4 = uuidv4({ rng: () => randoms }); - -let bufferv4: number[] = new Array(32); -bufferv4 = uuidv4(undefined, bufferv4); -bufferv4 = uuidv4(null, bufferv4, 16); - -// https://github.com/uuidjs/uuid#quickstart---commonjs-recommended -const MY_NAMESPACE = uuidv4(); -const a3: string = uuidv3("hello", MY_NAMESPACE); -const b3: string = uuidv3("world", MY_NAMESPACE); -const c3: Buffer = uuidv3("world", MY_NAMESPACE, Buffer.alloc(16)); -const d3: number[] = uuidv3("world", MY_NAMESPACE, [], 0); - -const e3: string = uuidv3("hello.example.com", uuidv3.DNS); -const f3: string = uuidv3("http://example.com/hello", uuidv3.URL); - -const a5: string = uuidv5("hello", MY_NAMESPACE); -const b5: string = uuidv5("world", MY_NAMESPACE); -const c5: Buffer = uuidv5("world", MY_NAMESPACE, Buffer.alloc(16)); -const d5: number[] = uuidv5("world", MY_NAMESPACE, [], 0); - -const e5: string = uuidv5("hello.example.com", uuidv5.DNS); -const f5: string = uuidv5("http://example.com/hello", uuidv5.URL); - -const g = Buffer.alloc(16); -uuidv4(null, g); // $ExpectType Buffer || Buffer - -class CustomBuffer extends Uint8Array {} -const h = new CustomBuffer(10); -uuidv4(null, h); // $ExpectType CustomBuffer - -// Legacy deep import -stringv1 = v1(); -stringv4 = v4(); -const l3: string = v3("hello", MY_NAMESPACE); -const l5: string = v5("hello", MY_NAMESPACE); diff --git a/types/uuid/v7/v1.d.ts b/types/uuid/v7/v1.d.ts deleted file mode 100644 index f255d3b2315a5f1..000000000000000 --- a/types/uuid/v7/v1.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { v1 } from "./interfaces"; - -/* - * @deprecated Deep requiring like `require('uuid/v1')` is deprecated. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated - */ -declare const v1: v1; - -export = v1; diff --git a/types/uuid/v7/v3.d.ts b/types/uuid/v7/v3.d.ts deleted file mode 100644 index 060a03fb54db0f1..000000000000000 --- a/types/uuid/v7/v3.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { v3 } from "./interfaces"; - -/* - * @deprecated Deep requiring like `require('uuid/v3')` is deprecated. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated - */ -declare const v3: v3; - -export = v3; diff --git a/types/uuid/v7/v4.d.ts b/types/uuid/v7/v4.d.ts deleted file mode 100644 index df4c1bead1d7d7f..000000000000000 --- a/types/uuid/v7/v4.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { v4 } from "./interfaces"; - -/* - * @deprecated Deep requiring like `require('uuid/v4')` is deprecated. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated - */ -declare const v4: v4; - -export = v4; diff --git a/types/uuid/v7/v5.d.ts b/types/uuid/v7/v5.d.ts deleted file mode 100644 index 2ec72ddc053cf07..000000000000000 --- a/types/uuid/v7/v5.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { v5 } from "./interfaces"; - -/* - * @deprecated Deep requiring like `require('uuid/v5')` is deprecated. See https://github.com/uuidjs/uuid#deep-requires-now-deprecated - */ -declare const v5: v5; - -export = v5; From 30ff7b019a35f8225df815d3e7614e987e4c1a3c Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 16 Sep 2025 17:11:18 -0400 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73658=20feat(r?= =?UTF-8?q?eact-window):=20remove=20types=20by=20@bvaughn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/react-window/.npmignore | 5 - types/react-window/index.d.ts | 524 -------------------- types/react-window/package.json | 29 -- types/react-window/react-window-tests.tsx | 576 ---------------------- types/react-window/tsconfig.json | 21 - 6 files changed, 4 insertions(+), 1155 deletions(-) delete mode 100644 types/react-window/.npmignore delete mode 100644 types/react-window/index.d.ts delete mode 100644 types/react-window/package.json delete mode 100644 types/react-window/react-window-tests.tsx delete mode 100644 types/react-window/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4c68a86d77da081..650161802f1571d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -6471,6 +6471,10 @@ "libraryName": "react-widgets", "asOfVersion": "5.0.0" }, + "react-window": { + "libraryName": "react-window", + "asOfVersion": "2.0.0" + }, "react-youtube": { "libraryName": "react-youtube", "asOfVersion": "7.10.0" diff --git a/types/react-window/.npmignore b/types/react-window/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/react-window/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/react-window/index.d.ts b/types/react-window/index.d.ts deleted file mode 100644 index e68471c2b28573a..000000000000000 --- a/types/react-window/index.d.ts +++ /dev/null @@ -1,524 +0,0 @@ -import { Component, ComponentClass, ComponentType, CSSProperties, FunctionComponent, Key, Ref } from "react"; - -export type CSSDirection = "ltr" | "rtl"; -export type Direction = "vertical" | "horizontal"; // TODO: deprecate in favour of Layout -export type Layout = "vertical" | "horizontal"; -export type ScrollDirection = "forward" | "backward"; -export type Align = "auto" | "smart" | "center" | "end" | "start"; - -export interface ListChildComponentProps { - index: number; - style: CSSProperties; - data: T; - isScrolling?: boolean | undefined; -} - -export interface GridChildComponentProps { - columnIndex: number; - rowIndex: number; - style: CSSProperties; - data: T; - isScrolling?: boolean | undefined; -} - -// This is supposed to represent the type of the first parameter to -// React.createElement. -export type ReactElementType = - | FunctionComponent - | ComponentClass - | string; - -export interface CommonProps { - /** - * Optional CSS class to attach to outermost
element. - */ - className?: string | undefined; - /** - * Tag name passed to document.createElement to create the inner container element. This is an advanced property; in most cases, the default ("div") should be used. - */ - innerElementType?: ReactElementType | undefined; - /** - * Ref to attach to the inner container element. This is an advanced property. - */ - innerRef?: Ref | undefined; - /** - * Tag name passed to document.createElement to create the inner container element. This is an advanced property; in most cases, the default ("div") should be used. - * - * @deprecated since 1.4.0 - */ - innerTagName?: string | undefined; - /** - * Contextual data to be passed to the item renderer as a data prop. This is a light-weight alternative to React's built-in context API. - * - * Item data is useful for item renderers that are class components. - */ - itemData?: T | undefined; - /** - * Tag name passed to document.createElement to create the outer container element. This is an advanced property; in most cases, the default ("div") should be used. - */ - outerElementType?: ReactElementType | undefined; - /** - * Ref to attach to the outer container element. This is an advanced property. - */ - outerRef?: Ref | undefined; - /** - * Tag name passed to document.createElement to create the outer container element. This is an advanced property; in most cases, the default ("div") should be used. - * - * @deprecated since 1.4.0 - */ - outerTagName?: string | undefined; - /** - * Optional inline style to attach to outermost
element. - */ - style?: CSSProperties | undefined; - /** - * Adds an additional isScrolling parameter to the children render function. This parameter can be used to show a placeholder row or column while the list is being scrolled. - * - * Note that using this parameter will result in an additional render call after scrolling has stopped (when isScrolling changes from true to false). - */ - useIsScrolling?: boolean | undefined; -} - -export type ListItemKeySelector = (index: number, data: T) => Key; - -export interface ListOnItemsRenderedProps { - overscanStartIndex: number; - overscanStopIndex: number; - visibleStartIndex: number; - visibleStopIndex: number; -} - -export interface ListOnScrollProps { - scrollDirection: ScrollDirection; - scrollOffset: number; - scrollUpdateWasRequested: boolean; -} - -export interface ListProps extends CommonProps { - /** - * React component responsible for rendering the individual item specified by an index prop. This component also receives a style prop (used for positioning). - * - * If useIsScrolling is enabled for the list, the component also receives an additional isScrolling boolean prop. - */ - children: ComponentType>; - /** - * Height of the list. - * - * For vertical lists, this must be a number. It affects the number of rows that will be rendered (and displayed) at any given time. - * - * For horizontal lists, this can be a number or a string (e.g. "50%"). - */ - height: number | string; - /** - * Total number of items in the list. Note that only a few items will be rendered and displayed at a time. - */ - itemCount: number; - /** - * Width of the list. - * - * For horizontal lists, this must be a number. It affects the number of columns that will be rendered (and displayed) at any given time. - * - * For vertical lists, this can be a number or a string (e.g. "50%"). - */ - width: number | string; - /** - * Determines the direction of text and horizontal scrolling. - * - * This property also automatically sets the CSS direction style for the list component. - * - * Specifying "horizontal" or "vertical" for this value is deprecated. Use "layout" prop instead. - * - * @default "ltr" - */ - direction?: CSSDirection | Direction | undefined; - /** - * Layout/orientation of the list. - * - * Acceptable values are: - * - "vertical" (default) - Up/down scrolling. - * - "horizontal" - Left/right scrolling. - * - * Note that lists may scroll in both directions (depending on CSS) but content will only be windowed in the layout direction specified. - */ - layout?: Layout | undefined; - /** - * Scroll offset for initial render. - * - * For vertical lists, this affects scrollTop. For horizontal lists, this affects scrollLeft. - */ - initialScrollOffset?: number | undefined; - /** - * By default, lists will use an item's index as its key. This is okay if: - * - * - Your collections of items is never sorted or modified - * - Your item renderer is not stateful and does not extend PureComponent - * - * If your list does not satisfy the above constraints, use the itemKey property to specify your own keys for items - */ - itemKey?: ListItemKeySelector | undefined; - /** - * The number of items (rows or columns) to render outside of the visible area. This property can be important for two reasons: - * - * - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item. - * - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling. - * - * Note that overscanning too much can negatively impact performance. By default, List overscans by one item. - */ - overscanCount?: number | undefined; - /** - * Called when the items rendered by the list change. - */ - onItemsRendered?: ((props: ListOnItemsRenderedProps) => any) | undefined; - /** - * Called when the list scroll positions changes, as a result of user scrolling or scroll-to method calls. - */ - onScroll?: ((props: ListOnScrollProps) => any) | undefined; -} - -export type GridItemKeySelector = (params: { - columnIndex: number; - rowIndex: number; - data: T; -}) => Key; - -export interface GridOnItemsRenderedProps { - overscanColumnStartIndex: number; - overscanColumnStopIndex: number; - overscanRowStartIndex: number; - overscanRowStopIndex: number; - visibleColumnStartIndex: number; - visibleColumnStopIndex: number; - visibleRowStartIndex: number; - visibleRowStopIndex: number; -} - -export interface GridOnScrollProps { - horizontalScrollDirection: ScrollDirection; - scrollLeft: number; - scrollTop: number; - scrollUpdateWasRequested: boolean; - verticalScrollDirection: ScrollDirection; -} - -export interface GridProps extends CommonProps { - /** - * React component responsible for rendering the individual item specified by an index prop. This component also receives a style prop (used for positioning). - * - * If useIsScrolling is enabled for the list, the component also receives an additional isScrolling boolean prop. - */ - children: ComponentType>; - /** - * Number of columns in the grid. Note that only a few columns will be rendered and displayed at a time. - */ - columnCount: number; - /** - * Determines the direction of text and horizontal scrolling. - * - * This property also automatically sets the CSS direction style for the grid component. - * - * @default "ltr" - */ - direction?: CSSDirection | undefined; - /** - * Height of the grid. This affects the number of rows that will be rendered (and displayed) at any given time. - */ - height: number; - /** - * Horizontal scroll offset for initial render. - */ - initialScrollLeft?: number | undefined; - /** - * Vertical scroll offset for initial render. - */ - initialScrollTop?: number | undefined; - /** - * By default, grids will use an item's indices as its key. This is okay if: - * - * - Your collections of items is never sorted or modified - * - Your item renderer is not stateful and does not extend PureComponent - * - * If your grid does not satisfy the above constraints, use the itemKey property to specify your own keys for items. - */ - itemKey?: GridItemKeySelector | undefined; - /** - * Called when the items rendered by the grid change. - */ - onItemsRendered?: ((props: GridOnItemsRenderedProps) => any) | undefined; - /** - * Called when the grid scroll positions changes, as a result of user scrolling or scroll-to method calls. - */ - onScroll?: ((props: GridOnScrollProps) => any) | undefined; - /** - * @deprecated since version 1.8.2, please use overscanColumnCount - */ - overscanColumnsCount?: number | undefined; - /** - * The number of columns to render outside of the visible area. This property can be important for two reasons: - * - * - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item. - * - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling. - * - * Note that overscanning too much can negatively impact performance. By default, grid overscans by one item. - */ - overscanColumnCount?: number | undefined; - /** - * @deprecated since version 1.8.2, please use overscanRowCount - */ - overscanRowsCount?: number | undefined; - /** - * The number of rows to render outside of the visible area. This property can be important for two reasons: - * - * - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item. - * - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling. - * - * Note that overscanning too much can negatively impact performance. By default, grid overscans by one item. - */ - overscanRowCount?: number | undefined; - /** - * The number of items (rows or columns) to render outside of the visible area. This property can be important for two reasons: - * - * - Overscanning by one row or column allows the tab key to focus on the next (not yet visible) item. - * - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling. - * - * Note that overscanning too much can negatively impact performance. By default, grid overscans by one item. - * - * @deprecated since version 1.4.0 - */ - overscanCount?: number | undefined; - /** - * Number of rows in the grid. Note that only a few rows will be rendered and displayed at a time. - */ - rowCount: number; - /** - * Width of the grid. This affects the number of columns that will be rendered (and displayed) at any given time. - */ - width: number; -} - -export interface FixedSizeListProps extends ListProps { - /** - * Size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width. - */ - itemSize: number; -} - -export interface VariableSizeListProps extends ListProps { - /** - * Estimated size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width. - * - * This value is used to calculated the estimated total size of a list before its items have all been measured. The total size impacts user scrolling behavior. - * It is updated whenever new items are measured. - */ - estimatedItemSize?: number | undefined; - /** - * Returns the size of a item in the direction being windowed. For vertical lists, this is the row height. For horizontal lists, this is the column width. - */ - itemSize: (index: number) => number; -} - -export interface FixedSizeGridProps extends GridProps { - /** - * Width of an individual column within the grid. - */ - columnWidth: number; - /** - * Height of an individual row within the grid. - */ - rowHeight: number; -} - -export interface VariableSizeGridProps extends GridProps { - /** - * Returns the width of the specified column. - */ - columnWidth: (index: number) => number; - /** - * Average (or estimated) column width for unrendered columns. - * - * This value is used to calculated the estimated total width of a Grid before its columns have all been measured. - * The estimated width impacts user scrolling behavior. It is updated whenever new columns are measured. - */ - estimatedColumnWidth?: number | undefined; - /** - * Average (or estimated) row height for unrendered rows. - * - * This value is used to calculated the estimated total height of a Grid before its rows have all been measured. - * The estimated height impacts user scrolling behavior. It is updated whenever new rows are measured. - */ - estimatedRowHeight?: number | undefined; - /** - * Returns the height of the specified row. - */ - rowHeight: (index: number) => number; -} - -export class FixedSizeList extends Component> { - /** - * Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop). - */ - scrollTo(scrollOffset: number): void; - /** - * Scroll to the specified item. - * - * By default, the List will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: - * - * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) - * - smart - * - If the item is already visible, don't scroll at all. - * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. - * - If it is more than one viewport away, scroll so that it is centered within the list. - * - center - Center align the item within the list. - * - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists). - * - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists). - */ - scrollToItem(index: number, align?: Align): void; -} - -export class VariableSizeList extends Component> { - /** - * Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop). - */ - scrollTo(scrollOffset: number): void; - /** - * Scroll to the specified item. - * - * By default, the List will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: - * - * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) - * - smart - * - If the item is already visible, don't scroll at all. - * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. - * - If it is more than one viewport away, scroll so that it is centered within the list. - * - center - Center align the item within the list. - * - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists). - * - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists). - */ - scrollToItem(index: number, align?: Align): void; - /** - * VariableSizeList caches offsets and measurements for each index for performance purposes. - * This method clears that cached data for all items after (and including) the specified index. - * It should be called whenever a item's size changes. (Note that this is not a typical occurrence.) - * - * By default the list will automatically re-render after the index is reset. - * If you would like to delay this re-render until e.g. a state update has completed in the parent component, - * specify a value of false for the second, optional parameter. - */ - resetAfterIndex(index: number, shouldForceUpdate?: boolean): void; -} - -export class FixedSizeGrid extends Component> { - /** - * Scroll to the specified offsets. - */ - scrollTo(params: { scrollLeft?: number; scrollTop?: number }): void; - /** - * Scroll to the specified item. - * - * By default, the Grid will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: - * - * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) - * - smart - * - If the item is already visible, don't scroll at all. - * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. - * - If it is more than one viewport away, scroll so that it is centered within the grid. - * - center - Center align the item within the grid. - * - end - Align the item to the bottom, right hand side of the grid. - * - start - Align the item to the top, left hand of the grid. - * - * If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively). - */ - scrollToItem(params: { - align?: Align | undefined; - columnIndex?: number | undefined; - rowIndex?: number | undefined; - }): void; -} - -export class VariableSizeGrid extends Component> { - /** - * Scroll to the specified offsets. - */ - scrollTo(params: { scrollLeft?: number; scrollTop?: number }): void; - /** - * Scroll to the specified item. - * - * By default, the Grid will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: - * - * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) - * - smart - * - If the item is already visible, don't scroll at all. - * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. - * - If it is more than one viewport away, scroll so that it is centered within the grid. - * - center - Center align the item within the grid. - * - end - Align the item to the bottom, right hand side of the grid. - * - start - Align the item to the top, left hand of the grid. - * - * If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively). - */ - scrollToItem(params: { - align?: Align | undefined; - columnIndex?: number | undefined; - rowIndex?: number | undefined; - }): void; - /** - * VariableSizeGrid caches offsets and measurements for each column index for performance purposes. - * This method clears that cached data for all columns after (and including) the specified index. - * It should be called whenever a column's width changes. (Note that this is not a typical occurrence.) - * - * By default the grid will automatically re-render after the index is reset. - * If you would like to delay this re-render until e.g. a state update has completed in the parent component, - * specify a value of false for the second, optional parameter. - */ - resetAfterColumnIndex(index: number, shouldForceUpdate?: boolean): void; - /** - * VariableSizeGrid caches offsets and measurements for each item for performance purposes. - * This method clears that cached data for all items after (and including) the specified indices. - * It should be called whenever an items size changes. (Note that this is not a typical occurrence.) - * - * By default the grid will automatically re-render after the index is reset. - * If you would like to delay this re-render until e.g. a state update has completed in the parent component, - * specify a value of false for the optional shouldForceUpdate parameter. - */ - resetAfterIndices(params: { - columnIndex: number; - rowIndex: number; - shouldForceUpdate?: boolean | undefined; - }): void; - /** - * VariableSizeGrid caches offsets and measurements for each row index for performance purposes. - * This method clears that cached data for all rows after (and including) the specified index. - * It should be called whenever a row's height changes. (Note that this is not a typical occurrence.) - * - * By default the grid will automatically re-render after the index is reset. - * If you would like to delay this re-render until e.g. a state update has completed in the parent component, - * specify a value of false for the second, optional parameter. - */ - resetAfterRowIndex(index: number, shouldForceUpdate?: boolean): void; -} - -/** - * Custom comparison function for React.memo(). - * It knows to compare individual style props and ignore the wrapper object. - * - * @see https://reactjs.org/docs/react-api.html#reactmemo - */ -export function areEqual( - prevProps: Readonly, - nextProps: Readonly, -): boolean; - -/** - * Custom shouldComponentUpdate for class components. - * It knows to compare individual style props and ignore the wrapper object. - * - * @see https://reactjs.org/docs/react-component.html#shouldcomponentupdate - */ -export function shouldComponentUpdate

( - this: { props: P; state: S }, - nextProps: Readonly

, - nextState: Readonly, -): boolean; diff --git a/types/react-window/package.json b/types/react-window/package.json deleted file mode 100644 index 6ccbc33a864745c..000000000000000 --- a/types/react-window/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "private": true, - "name": "@types/react-window", - "version": "1.8.9999", - "projects": [ - "https://github.com/bvaughn/react-window/", - "http://react-window.now.sh" - ], - "dependencies": { - "@types/react": "*" - }, - "devDependencies": { - "@types/react-window": "workspace:." - }, - "owners": [ - { - "name": "Martynas Kadiša", - "githubUsername": "martynaskadisa" - }, - { - "name": "Alex Guerra", - "githubUsername": "heyimalex" - }, - { - "name": "John Gozde", - "githubUsername": "jgoz" - } - ] -} diff --git a/types/react-window/react-window-tests.tsx b/types/react-window/react-window-tests.tsx deleted file mode 100644 index dd64b9d0f69e461..000000000000000 --- a/types/react-window/react-window-tests.tsx +++ /dev/null @@ -1,576 +0,0 @@ -import * as React from "react"; -import { - areEqual, - FixedSizeGrid, - FixedSizeList, - ListChildComponentProps, - shouldComponentUpdate, - VariableSizeGrid, - VariableSizeList, -} from "react-window"; - -const FixedSizeListTestRequiredProps: React.FC = () => ( - - {({ style, index }) =>

Test {index}
} - -); - -const VariableSizeListTestRequiredProps: React.FC = () => ( - 0} height={0} itemCount={0} width={0}> - {({ style, index }) =>
Test {index}
} -
-); - -const FixedSizeGridTestRequiredProps: React.FC = () => ( - - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -const VariableSizeGridTestRequiredProps: React.FC = () => ( - 0} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - > - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -const anyRef: React.Ref = React.createRef(); - -const FixedSizeListTestOptionalProps: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - "foo" + index.toString()} - layout={testBool ? "vertical" : "horizontal"} - onItemsRendered={({ - overscanStartIndex, - overscanStopIndex, - visibleStartIndex, - visibleStopIndex, - }) => - overscanStartIndex - + overscanStopIndex - + visibleStartIndex - + visibleStopIndex} - useIsScrolling={true} - outerElementType="div" - style={{ color: "cyan" }} - overscanCount={0} - outerRef={anyRef} - ref={React.createRef()} - onScroll={({ - scrollDirection, - scrollOffset, - scrollUpdateWasRequested, - }) => - scrollDirection === "forward" - ? scrollUpdateWasRequested - : scrollOffset} - > - {({ style, index }) =>
Test {index}
} -
-); - -const VariableSizeListTestOptionalProps: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - 0} - height={0} - itemCount={0} - width={0} - className="" - direction={testBool ? "rtl" : "ltr"} - initialScrollOffset={0} - innerRef={anyRef} - innerElementType="div" - itemData={{ foo: "bar" }} - itemKey={index => "foo" + index.toString()} - layout={testBool ? "vertical" : "horizontal"} - onItemsRendered={({ - overscanStartIndex, - overscanStopIndex, - visibleStartIndex, - visibleStopIndex, - }) => - overscanStartIndex - + overscanStopIndex - + visibleStartIndex - + visibleStopIndex} - useIsScrolling={true} - outerElementType="div" - style={{ color: "cyan" }} - overscanCount={0} - outerRef={anyRef} - ref={React.createRef()} - onScroll={({ - scrollDirection, - scrollOffset, - scrollUpdateWasRequested, - }) => - scrollDirection === "forward" - ? scrollUpdateWasRequested - : scrollOffset} - estimatedItemSize={0} - > - {({ style, index }) =>
Test {index}
} -
-); - -const VariableSizeGridTestOptionalProps: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - 0} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - className="" - direction={testBool ? "ltr" : "rtl"} - estimatedColumnWidth={0} - estimatedRowHeight={0} - initialScrollLeft={0} - initialScrollTop={0} - innerRef={anyRef} - innerElementType="div" - itemData={{ foo: "bar" }} - itemKey={({ columnIndex, rowIndex }) => columnIndex.toString() + rowIndex.toString()} - onItemsRendered={({ - overscanColumnStartIndex, - overscanColumnStopIndex, - overscanRowStartIndex, - overscanRowStopIndex, - visibleColumnStartIndex, - visibleColumnStopIndex, - visibleRowStartIndex, - visibleRowStopIndex, - }) => undefined} - onScroll={({ - horizontalScrollDirection, - scrollLeft, - scrollTop, - scrollUpdateWasRequested, - verticalScrollDirection, - }) => undefined} - outerRef={anyRef} - outerElementType="div" - overscanColumnCount={5} - overscanRowCount={5} - ref={React.createRef()} - style={{ color: "red" }} - useIsScrolling={true} - > - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -const RowWithAreEqual = React.memo((props: ListChildComponentProps) => { - const { index, style } = props; - return
Row {index}
; -}, areEqual); - -class RowWithShouldComponentUpdate extends React.Component< - ListChildComponentProps -> { - shouldComponentUpdate(...args: any[]) { - return shouldComponentUpdate.call(this, ...args); - } - render() { - const { index, style } = this.props; - return
Row {index}
; - } -} - -const fixedRef = React.createRef(); -const FixedSizeGridTestRefs: React.FC = () => ( - - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -if (fixedRef.current) { - fixedRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0 }); - fixedRef.current.scrollTo({ scrollLeft: 0 }); - fixedRef.current.scrollTo({ scrollTop: 0 }); - fixedRef.current.scrollTo({}); - fixedRef.current.scrollToItem({}); - fixedRef.current.scrollToItem({ align: "auto" }); - fixedRef.current.scrollToItem({ rowIndex: 0 }); - fixedRef.current.scrollToItem({ columnIndex: 0 }); - fixedRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); - fixedRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); -} - -const variableRef = React.createRef(); -const VariableSizeGridTestRefs: React.FC = () => ( - 0} - ref={variableRef} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - > - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -if (variableRef.current) { - variableRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0 }); - variableRef.current.scrollTo({ scrollLeft: 0 }); - variableRef.current.scrollTo({ scrollTop: 0 }); - variableRef.current.scrollTo({}); - variableRef.current.scrollToItem({}); - variableRef.current.scrollToItem({ align: "auto" }); - variableRef.current.scrollToItem({ rowIndex: 0 }); - variableRef.current.scrollToItem({ columnIndex: 0 }); - variableRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); - variableRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); - variableRef.current.resetAfterColumnIndex(0); - variableRef.current.resetAfterColumnIndex(0, true); - variableRef.current.resetAfterRowIndex(0); - variableRef.current.resetAfterRowIndex(0, false); - variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0 }); - variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0, shouldForceUpdate: true }); -} - -/** - * TODO: when v2 of `react-window` cuts, remove typing in index.d.ts and cutover to these tests - * which use a typed `itemData`. - */ -interface ExampleItemData { - foo: "string"; -} - -const FixedSizeListTestRequiredPropsV2: React.FC = () => ( - - {({ style, index }) =>
Test {index}
} -
-); - -const VariableSizeListTestRequiredPropsV2: React.FC = () => ( - 0} height={0} itemCount={0} width={0}> - {({ style, index }) =>
Test {index}
} -
-); - -const FixedSizeGridTestRequiredPropsV2: React.FC = () => ( - - {({ style, columnIndex, rowIndex }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -const VariableSizeGridTestRequiredPropsV2: React.FC = () => ( - 0} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - > - {({ style, columnIndex, rowIndex, data }) => ( -
- Test {rowIndex} {columnIndex} -
- )} -
-); - -const anyRefV2: React.Ref = React.createRef(); - -const FixedSizeListTestOptionalPropsV2: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - "foo" + index.toString()} - layout={testBool ? "vertical" : "horizontal"} - onItemsRendered={({ - overscanStartIndex, - overscanStopIndex, - visibleStartIndex, - visibleStopIndex, - }) => - overscanStartIndex - + overscanStopIndex - + visibleStartIndex - + visibleStopIndex} - useIsScrolling={true} - outerElementType="div" - style={{ color: "cyan" }} - overscanCount={0} - outerRef={anyRef} - ref={React.createRef()} - onScroll={({ - scrollDirection, - scrollOffset, - scrollUpdateWasRequested, - }) => - scrollDirection === "forward" - ? scrollUpdateWasRequested - : scrollOffset} - > - {({ style, index, data }) =>
Test {index} {data.foo}
} -
-); - -const VariableSizeListTestOptionalPropsV2: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - 0} - height={0} - itemCount={0} - width={0} - className="" - direction={testBool ? "rtl" : "ltr"} - initialScrollOffset={0} - innerRef={anyRef} - innerElementType="div" - itemData={{ foo: "bar" }} - itemKey={index => "foo" + index.toString()} - layout={testBool ? "vertical" : "horizontal"} - onItemsRendered={({ - overscanStartIndex, - overscanStopIndex, - visibleStartIndex, - visibleStopIndex, - }) => - overscanStartIndex - + overscanStopIndex - + visibleStartIndex - + visibleStopIndex} - useIsScrolling={true} - outerElementType="div" - style={{ color: "cyan" }} - overscanCount={0} - outerRef={anyRef} - ref={React.createRef()} - onScroll={({ - scrollDirection, - scrollOffset, - scrollUpdateWasRequested, - }) => - scrollDirection === "forward" - ? scrollUpdateWasRequested - : scrollOffset} - estimatedItemSize={0} - > - {({ style, index, data }) =>
Test {index} {data.foo}
} -
-); - -const VariableSizeGridTestOptionalPropsV2: React.FC<{ testBool: boolean }> = ({ - testBool, -}) => ( - 0} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - className="" - direction={testBool ? "ltr" : "rtl"} - estimatedColumnWidth={0} - estimatedRowHeight={0} - initialScrollLeft={0} - initialScrollTop={0} - innerRef={anyRef} - innerElementType="div" - itemData={{ foo: "bar" }} - itemKey={({ columnIndex, rowIndex }) => columnIndex.toString() + rowIndex.toString()} - onItemsRendered={({ - overscanColumnStartIndex, - overscanColumnStopIndex, - overscanRowStartIndex, - overscanRowStopIndex, - visibleColumnStartIndex, - visibleColumnStopIndex, - visibleRowStartIndex, - visibleRowStopIndex, - }) => undefined} - onScroll={({ - horizontalScrollDirection, - scrollLeft, - scrollTop, - scrollUpdateWasRequested, - verticalScrollDirection, - }) => undefined} - outerRef={anyRef} - outerElementType="div" - overscanColumnCount={5} - overscanRowCount={5} - ref={React.createRef()} - style={{ color: "red" }} - useIsScrolling={true} - > - {({ style, columnIndex, rowIndex, data }) => ( -
- Test {rowIndex} {columnIndex} {data.foo} -
- )} -
-); - -const RowWithAreEqualV2 = React.memo((props: ListChildComponentProps) => { - const { index, style, data } = props; - return
Row `${index}-${data.foo}`
; -}, areEqual); - -class RowWithShouldComponentUpdateV2 extends React.Component< - ListChildComponentProps -> { - shouldComponentUpdate(...args: any[]) { - return shouldComponentUpdate.call(this, ...args); - } - render() { - const { index, style, data } = this.props; - return
Row {index} {data.foo}
; - } -} - -const fixedRefV2 = React.createRef>(); -const FixedSizeGridTestRefsV2: React.FC = () => ( - - {({ style, columnIndex, rowIndex, data }) => ( -
- Test {rowIndex} {columnIndex} {data.foo} -
- )} -
-); - -if (fixedRef.current) { - fixedRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0 }); - fixedRef.current.scrollTo({ scrollLeft: 0 }); - fixedRef.current.scrollTo({ scrollTop: 0 }); - fixedRef.current.scrollTo({}); - fixedRef.current.scrollToItem({}); - fixedRef.current.scrollToItem({ align: "auto" }); - fixedRef.current.scrollToItem({ rowIndex: 0 }); - fixedRef.current.scrollToItem({ columnIndex: 0 }); - fixedRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); - fixedRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); -} - -const variableRefV2 = React.createRef>(); -const VariableSizeGridTestRefsV2: React.FC = () => ( - 0} - ref={variableRef} - rowCount={0} - rowHeight={index => 0} - height={0} - width={0} - > - {({ style, columnIndex, rowIndex, data }) => ( -
- Test {rowIndex} {columnIndex} {data.foo} -
- )} -
-); - -if (variableRef.current) { - variableRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0 }); - variableRef.current.scrollTo({ scrollLeft: 0 }); - variableRef.current.scrollTo({ scrollTop: 0 }); - variableRef.current.scrollTo({}); - variableRef.current.scrollToItem({}); - variableRef.current.scrollToItem({ align: "auto" }); - variableRef.current.scrollToItem({ rowIndex: 0 }); - variableRef.current.scrollToItem({ columnIndex: 0 }); - variableRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); - variableRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); - variableRef.current.resetAfterColumnIndex(0); - variableRef.current.resetAfterColumnIndex(0, true); - variableRef.current.resetAfterRowIndex(0); - variableRef.current.resetAfterRowIndex(0, false); - variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0 }); - variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0, shouldForceUpdate: true }); -} diff --git a/types/react-window/tsconfig.json b/types/react-window/tsconfig.json deleted file mode 100644 index 955ffb0bebf78e9..000000000000000 --- a/types/react-window/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "jsx": "react", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-window-tests.tsx" - ] -} From f26583dbd621f3dabcda27e23f4e69a6b923567c Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 16 Sep 2025 17:12:31 -0400 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73679=20feat(r?= =?UTF-8?q?eact-window-infinite-loader):=20remove=20types=20by=20@bvaughn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/react-window-infinite-loader/.npmignore | 5 -- types/react-window-infinite-loader/index.d.ts | 19 ----- .../react-window-infinite-loader/package.json | 25 ------- .../react-window-infinite-loader-tests.tsx | 73 ------------------- .../tsconfig.json | 22 ------ 6 files changed, 4 insertions(+), 144 deletions(-) delete mode 100644 types/react-window-infinite-loader/.npmignore delete mode 100644 types/react-window-infinite-loader/index.d.ts delete mode 100644 types/react-window-infinite-loader/package.json delete mode 100644 types/react-window-infinite-loader/react-window-infinite-loader-tests.tsx delete mode 100644 types/react-window-infinite-loader/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 650161802f1571d..2a124c1a3e533f6 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4333,6 +4333,10 @@ "libraryName": "metascraper-video", "asOfVersion": "5.42.0" }, + "react-window": { + "libraryName": "react-window-infinite-loader", + "asOfVersion": "2.0.0" + }, "metascraper-youtube": { "libraryName": "metascraper-youtube", "asOfVersion": "5.42.0" diff --git a/types/react-window-infinite-loader/.npmignore b/types/react-window-infinite-loader/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/react-window-infinite-loader/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/react-window-infinite-loader/index.d.ts b/types/react-window-infinite-loader/index.d.ts deleted file mode 100644 index 76d096b60f431d0..000000000000000 --- a/types/react-window-infinite-loader/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, FC, ReactNode, Ref } from "react"; -import { FixedSizeList, ListOnItemsRenderedProps, VariableSizeList } from "react-window"; - -type OnItemsRendered = (props: ListOnItemsRenderedProps) => any; - -interface InfiniteLoaderProps { - isItemLoaded: (index: number) => boolean; - loadMoreItems: (startIndex: number, stopIndex: number) => Promise | void; - itemCount: number; - children: (props: { onItemsRendered: OnItemsRendered; ref: (ref: any) => void }) => ReactNode; - threshold?: number | undefined; - minimumBatchSize?: number | undefined; -} - -declare class InfiniteLoader extends Component { - resetloadMoreItemsCache(autoReload?: boolean): void; -} - -export = InfiniteLoader; diff --git a/types/react-window-infinite-loader/package.json b/types/react-window-infinite-loader/package.json deleted file mode 100644 index ef664b10accbed0..000000000000000 --- a/types/react-window-infinite-loader/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "private": true, - "name": "@types/react-window-infinite-loader", - "version": "1.0.9999", - "projects": [ - "https://github.com/bvaughn/react-window-infinite-loader/" - ], - "dependencies": { - "@types/react": "*", - "@types/react-window": "*" - }, - "devDependencies": { - "@types/react-window-infinite-loader": "workspace:." - }, - "owners": [ - { - "name": "Nivesh Ravindran", - "githubUsername": "Nibblesh" - }, - { - "name": "fnknzzz", - "githubUsername": "fnknzzz" - } - ] -} diff --git a/types/react-window-infinite-loader/react-window-infinite-loader-tests.tsx b/types/react-window-infinite-loader/react-window-infinite-loader-tests.tsx deleted file mode 100644 index 57626af7d697a0f..000000000000000 --- a/types/react-window-infinite-loader/react-window-infinite-loader-tests.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import * as React from "react"; -import { FixedSizeList } from "react-window"; -import InfiniteLoader from "react-window-infinite-loader"; - -const LOADING = 1; -const LOADED = 2; -const itemStatusMap: { [key: number]: number } = {}; - -const isItemLoaded = (index: number) => !!itemStatusMap[index]; -const loadMoreItems = (startIndex: number, stopIndex: number) => { - for (let index = startIndex; index <= stopIndex; index++) { - itemStatusMap[index] = LOADING; - } - return new Promise(resolve => - setTimeout(() => { - for (let index = startIndex; index <= stopIndex; index++) { - itemStatusMap[index] = LOADED; - } - resolve(); - }, 2500) - ); -}; - -class Row extends React.PureComponent<{ index: number; style: React.CSSProperties; data: any }> { - render() { - const { index, style } = this.props; - - return ( -
- {`${itemStatusMap[index] === LOADED ? `Row ${index}` : "Loading..."}`} -
- ); - } -} - -const App = () => { - const fixedSizeListRef = React.useRef(null); - fixedSizeListRef.current?.scrollToItem(10); - return ( - -

- This demo app mimics loading remote data with a 2.5s timer. While rows are "loading" they will display a - "Loading..." label. Once data has been "loaded" the row number will be displayed. Start scrolling the - list to automatically load data. -

- - {({ onItemsRendered, ref }) => ( - { - ref(listRef); - fixedSizeListRef.current = listRef; - }} - width={300} - > - {Row} - - )} - -

- Check out the documentation to learn more: -
- - github.com/bvaughn/react-window-infinite-loader - -

-
- ); -}; diff --git a/types/react-window-infinite-loader/tsconfig.json b/types/react-window-infinite-loader/tsconfig.json deleted file mode 100644 index 5fec54a6e2e5e35..000000000000000 --- a/types/react-window-infinite-loader/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "esModuleInterop": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": true, - "jsx": "react" - }, - "files": [ - "index.d.ts", - "react-window-infinite-loader-tests.tsx" - ] -} From 4163c3a8d02b06c69e7b9a6bcfb0f0bfed648dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Morav=C4=8D=C3=ADk?= Date: Tue, 16 Sep 2025 23:16:16 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73520=20fix(do?= =?UTF-8?q?ckerode):=20improve=20types=20for=20`AuthConfig`,=20`Image.push?= =?UTF-8?q?`=20by=20@jirimoravcik?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/dockerode/index.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 72eace6845e3f58..c614e92d71a3d07 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -130,9 +130,10 @@ declare namespace Dockerode { get(callback: Callback): void; get(): Promise; - push(options: ImagePushOptions, callback: Callback): void; - push(callback: Callback): void; + push(options: ImagePushOptions, callback: Callback, auth?: AuthConfig): void; + push(callback: Callback, auth?: AuthConfig): void; push(options?: ImagePushOptions): Promise; + push(options?: ImagePushOptions, callback?: undefined, auth?: AuthConfig): Promise; tag(options: ImageTagOptions, callback: Callback): void; tag(callback: Callback): void; @@ -1134,6 +1135,7 @@ declare namespace Dockerode { tag?: string | undefined; authconfig?: AuthConfig | undefined; abortSignal?: AbortSignal; + stream?: boolean | undefined; } interface ImageTagOptions { @@ -1148,7 +1150,13 @@ declare namespace Dockerode { tag?: string; } - interface AuthConfig { + interface AuthConfigKey { + key: string; + } + interface AuthConfigBase64 { + base64: string; + } + interface AuthConfigObject { username?: string; password?: string; auth?: string; @@ -1159,6 +1167,8 @@ declare namespace Dockerode { email?: string | undefined; } + type AuthConfig = AuthConfigKey | AuthConfigBase64 | AuthConfigObject; + interface RegistryConfig { [registryAddress: string]: { username: string; From 47ce11115afd26f2b097a00a94a4ea12451c1a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Tue, 16 Sep 2025 22:17:53 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73527=20[node]?= =?UTF-8?q?=20https:=20deconflict=20overridable=20Agent=20methods=20by=20@?= =?UTF-8?q?Renegade334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/http.d.ts | 2 +- types/node/https.d.ts | 5 +++++ types/node/test/https.ts | 12 ++++++++++++ types/node/v18/http.d.ts | 2 +- types/node/v18/https.d.ts | 5 +++++ types/node/v18/test/https.ts | 12 ++++++++++++ types/node/v20/http.d.ts | 2 +- types/node/v20/https.d.ts | 5 +++++ types/node/v20/test/https.ts | 12 ++++++++++++ types/node/v22/http.d.ts | 2 +- types/node/v22/https.d.ts | 5 +++++ types/node/v22/test/https.ts | 12 ++++++++++++ 12 files changed, 72 insertions(+), 4 deletions(-) diff --git a/types/node/http.d.ts b/types/node/http.d.ts index 3ed98d38b3f5f95..61fc93a98e842db 100644 --- a/types/node/http.d.ts +++ b/types/node/http.d.ts @@ -1615,7 +1615,7 @@ declare module "http" { createConnection( options: ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void, - ): stream.Duplex; + ): stream.Duplex | null | undefined; /** * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to: * diff --git a/types/node/https.d.ts b/types/node/https.d.ts index a40f06b289c767c..7518dc2abb9b5d0 100644 --- a/types/node/https.d.ts +++ b/types/node/https.d.ts @@ -32,6 +32,11 @@ declare module "https" { class Agent extends http.Agent { constructor(options?: AgentOptions); options: AgentOptions; + createConnection( + options: RequestOptions, + callback?: (err: Error | null, stream: Duplex) => void, + ): Duplex | null | undefined; + getName(options?: RequestOptions): string; } interface Server< Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, diff --git a/types/node/test/https.ts b/types/node/test/https.ts index f70668f34cbfc08..741f3a59b955e12 100644 --- a/types/node/test/https.ts +++ b/types/node/test/https.ts @@ -22,6 +22,18 @@ import * as url from "node:url"; agent = https.globalAgent; + class CustomAgent extends https.Agent { + createConnection(options: https.RequestOptions, callback?: (err: Error | null, socket: net.Socket) => void) { + const socket = new net.Socket(options); + callback?.(null, socket); + return socket; + } + getName(options: https.RequestOptions) { + return `${super.getName(options)}:${options?.ca}:${options?.cert}:${options?.key}`; + } + } + agent = new CustomAgent(); + let sockets: NodeJS.ReadOnlyDict = agent.sockets; sockets = agent.freeSockets; diff --git a/types/node/v18/http.d.ts b/types/node/v18/http.d.ts index 338c3ac5cbd0b4e..3cb47c93b7455a9 100644 --- a/types/node/v18/http.d.ts +++ b/types/node/v18/http.d.ts @@ -1559,7 +1559,7 @@ declare module "http" { createConnection( options: ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void, - ): stream.Duplex; + ): stream.Duplex | null | undefined; /** * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to: * diff --git a/types/node/v18/https.d.ts b/types/node/v18/https.d.ts index cc44b7eaaff6739..ded38bbd31edd6c 100644 --- a/types/node/v18/https.d.ts +++ b/types/node/v18/https.d.ts @@ -31,6 +31,11 @@ declare module "https" { class Agent extends http.Agent { constructor(options?: AgentOptions); options: AgentOptions; + createConnection( + options: RequestOptions, + callback?: (err: Error | null, stream: Duplex) => void, + ): Duplex | null | undefined; + getName(options?: RequestOptions): string; } interface Server< Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, diff --git a/types/node/v18/test/https.ts b/types/node/v18/test/https.ts index afdd1d4e19290d9..23d5671e57ac3f3 100644 --- a/types/node/v18/test/https.ts +++ b/types/node/v18/test/https.ts @@ -19,6 +19,18 @@ import * as url from "node:url"; agent = https.globalAgent; + class CustomAgent extends https.Agent { + createConnection(options: https.RequestOptions, callback?: (err: Error | null, socket: net.Socket) => void) { + const socket = new net.Socket(options); + callback?.(null, socket); + return socket; + } + getName(options: https.RequestOptions) { + return `${super.getName(options)}:${options?.ca}:${options?.cert}:${options?.key}`; + } + } + agent = new CustomAgent(); + let sockets: NodeJS.ReadOnlyDict = agent.sockets; sockets = agent.freeSockets; diff --git a/types/node/v20/http.d.ts b/types/node/v20/http.d.ts index 4ad797396ff76ff..abb79181c883627 100644 --- a/types/node/v20/http.d.ts +++ b/types/node/v20/http.d.ts @@ -1589,7 +1589,7 @@ declare module "http" { createConnection( options: ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void, - ): stream.Duplex; + ): stream.Duplex | null | undefined; /** * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to: * diff --git a/types/node/v20/https.d.ts b/types/node/v20/https.d.ts index bd7d94575fde2a9..8cc227f8ac6996b 100644 --- a/types/node/v20/https.d.ts +++ b/types/node/v20/https.d.ts @@ -31,6 +31,11 @@ declare module "https" { class Agent extends http.Agent { constructor(options?: AgentOptions); options: AgentOptions; + createConnection( + options: RequestOptions, + callback?: (err: Error | null, stream: Duplex) => void, + ): Duplex | null | undefined; + getName(options?: RequestOptions): string; } interface Server< Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, diff --git a/types/node/v20/test/https.ts b/types/node/v20/test/https.ts index 959ff28a7d75f8a..5cf2d1bf36c2709 100644 --- a/types/node/v20/test/https.ts +++ b/types/node/v20/test/https.ts @@ -19,6 +19,18 @@ import * as url from "node:url"; agent = https.globalAgent; + class CustomAgent extends https.Agent { + createConnection(options: https.RequestOptions, callback?: (err: Error | null, socket: net.Socket) => void) { + const socket = new net.Socket(options); + callback?.(null, socket); + return socket; + } + getName(options: https.RequestOptions) { + return `${super.getName(options)}:${options?.ca}:${options?.cert}:${options?.key}`; + } + } + agent = new CustomAgent(); + let sockets: NodeJS.ReadOnlyDict = agent.sockets; sockets = agent.freeSockets; diff --git a/types/node/v22/http.d.ts b/types/node/v22/http.d.ts index a398c51f465362e..f7c01f19b2a9328 100644 --- a/types/node/v22/http.d.ts +++ b/types/node/v22/http.d.ts @@ -1591,7 +1591,7 @@ declare module "http" { createConnection( options: ClientRequestArgs, callback?: (err: Error | null, stream: stream.Duplex) => void, - ): stream.Duplex; + ): stream.Duplex | null | undefined; /** * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to: * diff --git a/types/node/v22/https.d.ts b/types/node/v22/https.d.ts index b74d9d2919a5efe..78288c807418318 100644 --- a/types/node/v22/https.d.ts +++ b/types/node/v22/https.d.ts @@ -32,6 +32,11 @@ declare module "https" { class Agent extends http.Agent { constructor(options?: AgentOptions); options: AgentOptions; + createConnection( + options: RequestOptions, + callback?: (err: Error | null, stream: Duplex) => void, + ): Duplex | null | undefined; + getName(options?: RequestOptions): string; } interface Server< Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, diff --git a/types/node/v22/test/https.ts b/types/node/v22/test/https.ts index 4f0faa6577ea062..f9b37edfd3c1b22 100644 --- a/types/node/v22/test/https.ts +++ b/types/node/v22/test/https.ts @@ -19,6 +19,18 @@ import * as url from "node:url"; agent = https.globalAgent; + class CustomAgent extends https.Agent { + createConnection(options: https.RequestOptions, callback?: (err: Error | null, socket: net.Socket) => void) { + const socket = new net.Socket(options); + callback?.(null, socket); + return socket; + } + getName(options: https.RequestOptions) { + return `${super.getName(options)}:${options?.ca}:${options?.cert}:${options?.key}`; + } + } + agent = new CustomAgent(); + let sockets: NodeJS.ReadOnlyDict = agent.sockets; sockets = agent.freeSockets; From 52c8ef6b820dc4a4f72a48201767239a4e0e41d2 Mon Sep 17 00:00:00 2001 From: Erwan Jugand <47392755+erwanjugand@users.noreply.github.com> Date: Tue, 16 Sep 2025 23:29:27 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73535=20[chrom?= =?UTF-8?q?e]=20update=20history=20namespace=20by=20@erwanjugand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/chrome/index.d.ts | 144 +++++++++++++++++++++---------------- types/chrome/test/index.ts | 96 ++++++++++++++++++++----- 2 files changed, 161 insertions(+), 79 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index e5ea6bef55742ab..fe8e35806666266 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -5815,46 +5815,81 @@ declare namespace chrome { /** An object encapsulating one visit to a URL. */ export interface VisitItem { /** The transition type for this visit from its referrer. */ - transition: string; - /** Optional. When this visit occurred, represented in milliseconds since the epoch. */ - visitTime?: number | undefined; + transition: `${TransitionType}`; + /** + * True if the visit originated on this device. False if it was synced from a different device + * @since Chrome 115 + */ + isLocal: boolean; + /** When this visit occurred, represented in milliseconds since the epoch. */ + visitTime?: number; /** The unique identifier for this visit. */ visitId: string; /** The visit ID of the referrer. */ referringVisitId: string; - /** The unique identifier for the item. */ + /** The unique identifier for the corresponding {@link history.HistoryItem}. */ id: string; } /** An object encapsulating one result of a history query. */ export interface HistoryItem { - /** Optional. The number of times the user has navigated to this page by typing in the address. */ - typedCount?: number | undefined; - /** Optional. The title of the page when it was last loaded. */ - title?: string | undefined; - /** Optional. The URL navigated to by a user. */ - url?: string | undefined; - /** Optional. When this page was last loaded, represented in milliseconds since the epoch. */ - lastVisitTime?: number | undefined; - /** Optional. The number of times the user has navigated to this page. */ - visitCount?: number | undefined; + /** The number of times the user has navigated to this page by typing in the address. */ + typedCount?: number; + /** The title of the page when it was last loaded. */ + title?: string; + /** The URL navigated to by a user. */ + url?: string; + /** When this page was last loaded, represented in milliseconds since the epoch. */ + lastVisitTime?: number; + /** The number of times the user has navigated to this page. */ + visitCount?: number; /** The unique identifier for the item. */ id: string; } + /** + * The transition type for this visit from its referrer. + * @since Chrome 44 + */ + export enum TransitionType { + /** The user arrived at this page by clicking a link on another page. */ + LINK = "link", + /** The user arrived at this page by typing the URL in the address bar. This is also used for other explicit navigation actions. */ + TYPED = "typed", + /** The user arrived at this page through a suggestion in the UI, for example, through a menu item. */ + AUTO_BOOKMARK = "auto_bookmark", + /** The user arrived at this page through subframe navigation that they didn't request, such as through an ad loading in a frame on the previous page. These don't always generate new navigation entries in the back and forward menus. */ + AUTO_SUBFRAME = "auto_subframe", + /** The user arrived at this page by selecting something in a subframe. */ + MANUAL_SUBFRAME = "manual_subframe", + /** The user arrived at this page by typing in the address bar and selecting an entry that didn't look like a URL, such as a Google Search suggestion. For example, a match might have the URL of a Google Search result page, but it might appear to the user as "Search Google for ...". These are different from typed navigations because the user didn't type or see the destination URL. They're also related to keyword navigations. */ + GENERATED = "generated", + /** The page was specified in the command line or is the start page. */ + AUTO_TOPLEVEL = "auto_toplevel", + /** The user arrived at this page by filling out values in a form and submitting the form. Not all form submissions use this transition type. */ + FORM_SUBMIT = "form_submit", + /** The user reloaded the page, either by clicking the reload button or by pressing Enter in the address bar. Session restore and Reopen closed tab also use this transition type. */ + RELOAD = "reload", + /** The URL for this page was generated from a replaceable keyword other than the default search provider. */ + KEYWORD = "keyword", + /** Corresponds to a visit generated for a keyword. */ + KEYWORD_GENERATED = "keyword_generated", + } + export interface HistoryQuery { - /** A free-text query to the history service. Leave empty to retrieve all pages. */ + /** A free-text query to the history service. Leave this empty to retrieve all pages. */ text: string; - /** Optional. The maximum number of results to retrieve. Defaults to 100. */ + /** The maximum number of results to retrieve. Defaults to 100. */ maxResults?: number | undefined; - /** Optional. Limit results to those visited after this date, represented in milliseconds since the epoch. */ + /** Limit results to those visited after this date, represented in milliseconds since the epoch. If property is not specified, it will default to 24 hours. */ startTime?: number | undefined; - /** Optional. Limit results to those visited before this date, represented in milliseconds since the epoch. */ + /** Limit results to those visited before this date, represented in milliseconds since the epoch. */ endTime?: number | undefined; } - export interface Url { - /** The URL for the operation. It must be in the format as returned from a call to history.search. */ + /** @since Chrome 88 */ + export interface UrlDetails { + /** The URL for the operation. It must be in the format as returned from a call to {@link history.search}. */ url: string; } @@ -5868,73 +5903,62 @@ declare namespace chrome { export interface RemovedResult { /** True if all history was removed. If true, then urls will be empty. */ allHistory: boolean; - /** Optional. */ - urls?: string[] | undefined; + urls?: string[]; } - export interface HistoryVisitedEvent extends chrome.events.Event<(result: HistoryItem) => void> {} - - export interface HistoryVisitRemovedEvent extends chrome.events.Event<(removed: RemovedResult) => void> {} - /** * Searches the history for the last visit time of each page matching the query. - * @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only). + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ export function search(query: HistoryQuery): Promise; - /** - * Searches the history for the last visit time of each page matching the query. - */ export function search(query: HistoryQuery, callback: (results: HistoryItem[]) => void): void; + /** * Adds a URL to the history at the current time with a transition type of "link". - * @return The `addUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. - */ - export function addUrl(details: Url): Promise; - /** - * Adds a URL to the history at the current time with a transition type of "link". + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ - export function addUrl(details: Url, callback: () => void): void; + export function addUrl(details: UrlDetails): Promise; + export function addUrl(details: UrlDetails, callback: () => void): void; + /** * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range. - * @return The `deleteRange` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ export function deleteRange(range: Range): Promise; - /** - * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range. - */ export function deleteRange(range: Range, callback: () => void): void; + /** * Deletes all items from the history. - * @return The `deleteAll` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ export function deleteAll(): Promise; - /** - * Deletes all items from the history. - */ export function deleteAll(callback: () => void): void; + /** * Retrieves information about visits to a URL. - * @return The `getVisits` method provides its result via callback or returned as a `Promise` (MV3 only). - */ - export function getVisits(details: Url): Promise; - /** - * Retrieves information about visits to a URL. - */ - export function getVisits(details: Url, callback: (results: VisitItem[]) => void): void; - /** - * Removes all occurrences of the given URL from the history. - * @return The `deleteUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ - export function deleteUrl(details: Url): Promise; + export function getVisits(details: UrlDetails): Promise; + export function getVisits(details: UrlDetails, callback: (results: VisitItem[]) => void): void; + /** * Removes all occurrences of the given URL from the history. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 96. */ - export function deleteUrl(details: Url, callback: () => void): void; + export function deleteUrl(details: UrlDetails): Promise; + export function deleteUrl(details: UrlDetails, callback: () => void): void; + + /** Fired when a URL is visited, providing the {@link HistoryItem} data for that URL. This event fires before the page has loaded. */ + export const onVisited: events.Event<(result: HistoryItem) => void>; - /** Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. */ - export var onVisited: HistoryVisitedEvent; - /** Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. */ - export var onVisitRemoved: HistoryVisitRemovedEvent; + /** Fired when one or more URLs are removed from history. When all visits have been removed the URL is purged from history. */ + export const onVisitRemoved: events.Event<(removed: RemovedResult) => void>; } //////////////////// diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 6465127f8e3d578..c2f29360fb4b674 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -4806,30 +4806,88 @@ function testGcm() { }); } -// https://developer.chrome.com/docs/extensions/reference/history +// https://developer.chrome.com/docs/extensions/reference/api/history function testHistory() { + chrome.history.TransitionType.AUTO_BOOKMARK === "auto_bookmark"; + chrome.history.TransitionType.AUTO_SUBFRAME === "auto_subframe"; + chrome.history.TransitionType.AUTO_TOPLEVEL === "auto_toplevel"; + chrome.history.TransitionType.FORM_SUBMIT === "form_submit"; + chrome.history.TransitionType.GENERATED === "generated"; + chrome.history.TransitionType.KEYWORD === "keyword"; + chrome.history.TransitionType.KEYWORD_GENERATED === "keyword_generated"; + chrome.history.TransitionType.LINK === "link"; + chrome.history.TransitionType.MANUAL_SUBFRAME === "manual_subframe"; + chrome.history.TransitionType.RELOAD === "reload"; + chrome.history.TransitionType.TYPED === "typed"; + + const urlDetails: chrome.history.UrlDetails = { + url: "https://example.com", + }; + + chrome.history.addUrl(urlDetails); // $ExpectType Promise + chrome.history.addUrl(urlDetails, () => void 0); // $ExpectType void // @ts-expect-error - chrome.history.search({}, (results) => {}); - chrome.history.search({ text: "" }, (results) => {}); + chrome.history.addUrl(urlDetails, () => {}).then(() => {}); + + chrome.history.deleteAll(); // $ExpectType Promise + chrome.history.deleteAll(() => void 0); // $ExpectType void + // @ts-expect-error + chrome.history.deleteAll(() => {}).then(() => {}); + + const range: chrome.history.Range = { + endTime: new Date().getTime(), + startTime: new Date().getTime(), + }; + + chrome.history.deleteRange(range); // $ExpectType Promise + chrome.history.deleteRange(range, () => void 0); // $ExpectType void // @ts-expect-error - chrome.history.addUrl({}, () => {}); - chrome.history.addUrl({ url: "https://example.com" }, () => {}); + chrome.history.deleteRange(range, () => {}).then(() => {}); + + chrome.history.deleteUrl(urlDetails); // $ExpectType Promise + chrome.history.deleteUrl(urlDetails, () => void 0); // $ExpectType void // @ts-expect-error - chrome.history.deleteRange({}, () => {}); - chrome.history.deleteRange({ startTime: 1646172000000, endTime: 1646258400000 }, () => {}); - chrome.history.deleteAll(() => {}); - chrome.history.deleteUrl({ url: "https://example.com" }, () => {}); - chrome.history.getVisits({ url: "https://example.com" }, () => {}); -} + chrome.history.deleteUrl(urlDetails, () => {}).then(() => {}); + + chrome.history.getVisits(urlDetails); // $ExpectType Promise + chrome.history.getVisits(urlDetails, ([result]) => { // $ExpectType void + result.id; // $ExpectType string + result.isLocal; // $ExpectType boolean + result.referringVisitId; // $ExpectType string + result.transition; // $ExpectType "link" | "typed" | "auto_bookmark" | "auto_subframe" | "manual_subframe" | "generated" | "auto_toplevel" | "form_submit" | "reload" | "keyword" | "keyword_generated" + result.visitId; // $ExpectType string + result.visitTime; // $ExpectType number | undefined + }); + // @ts-expect-error + chrome.history.getVisits(urlDetails, () => {}).then(() => {}); + + const query: chrome.history.HistoryQuery = { + endTime: new Date().getTime(), + maxResults: 2, + startTime: new Date().getTime(), + text: "example", + }; + + chrome.history.search(query); // $ExpectType Promise + chrome.history.search(query, ([result]) => { // $ExpectType void + result.id; // $ExpectType string + result.lastVisitTime; // $ExpectType number | undefined + result.title; // $ExpectType string | undefined + result.typedCount; // $ExpectType number | undefined + result.url; // $ExpectType string | undefined + result.visitCount; // $ExpectType number | undefined + }); + // @ts-expect-error + chrome.history.search(query, () => {}).then(() => {}); -// https://developer.chrome.com/docs/extensions/reference/history -async function testHistoryForPromise() { - await chrome.history.search({ text: "" }); - await chrome.history.addUrl({ url: "https://example.com" }); - await chrome.history.deleteRange({ startTime: 1646172000000, endTime: 1646258400000 }); - await chrome.history.deleteAll(); - await chrome.history.deleteUrl({ url: "https://example.com" }); - await chrome.history.getVisits({ url: "https://example.com" }); + checkChromeEvent(chrome.history.onVisited, (result) => { + result; // $ExpectType HistoryItem + }); + + checkChromeEvent(chrome.history.onVisitRemoved, (result) => { + result.allHistory; // $ExpectType boolean + result.urls; // $ExpectType string[] | undefined + }); } // https://developer.chrome.com/docs/extensions/reference/api/identity