diff --git a/notNeededPackages.json b/notNeededPackages.json index 5331264cd29a79..cc30364015935b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4885,6 +4885,10 @@ "libraryName": "parse-ms", "asOfVersion": "2.1.0" }, + "parse-numeric-range": { + "libraryName": "parse-numeric-range", + "asOfVersion": "1.3.0" + }, "parse5": { "libraryName": "parse5", "asOfVersion": "7.0.0" diff --git a/types/node/buffer.buffer.d.ts b/types/node/buffer.buffer.d.ts index c0839cdbd78f35..acb8342ff27462 100644 --- a/types/node/buffer.buffer.d.ts +++ b/types/node/buffer.buffer.d.ts @@ -160,6 +160,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/node/test/buffer.ts b/types/node/test/buffer.ts index d5d36825e311c4..41c372e038a8d9 100644 --- a/types/node/test/buffer.ts +++ b/types/node/test/buffer.ts @@ -149,6 +149,17 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ Buffer.from({} as { [Symbol.toPrimitive](): number }); } + // ArrayLike or string + { + const arrayOrString = "foo" as number[] | string; + // $ExpectType Buffer || Buffer + Buffer.from(arrayOrString); + + const typedArrayOrString = "foo" as Uint8Array | string; + // $ExpectType Buffer || Buffer + Buffer.from(typedArrayOrString); + } + // @ts-expect-error Buffer.from({}); // @ts-expect-error diff --git a/types/node/ts5.6/buffer.buffer.d.ts b/types/node/ts5.6/buffer.buffer.d.ts index 0cb28428539cbe..aea019fbf0fd1c 100644 --- a/types/node/ts5.6/buffer.buffer.d.ts +++ b/types/node/ts5.6/buffer.buffer.d.ts @@ -158,6 +158,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/node/v18/buffer.buffer.d.ts b/types/node/v18/buffer.buffer.d.ts index 834d1dc22e9d73..f5b1b3e2eda0c8 100644 --- a/types/node/v18/buffer.buffer.d.ts +++ b/types/node/v18/buffer.buffer.d.ts @@ -155,6 +155,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/node/v18/test/buffer.ts b/types/node/v18/test/buffer.ts index c4e6916b43a170..a31602020af51f 100644 --- a/types/node/v18/test/buffer.ts +++ b/types/node/v18/test/buffer.ts @@ -148,6 +148,17 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ Buffer.from({} as { [Symbol.toPrimitive](): number }); } + // ArrayLike or string + { + const arrayOrString = "foo" as number[] | string; + // $ExpectType Buffer || Buffer + Buffer.from(arrayOrString); + + const typedArrayOrString = "foo" as Uint8Array | string; + // $ExpectType Buffer || Buffer + Buffer.from(typedArrayOrString); + } + // @ts-expect-error Buffer.from({}); // @ts-expect-error diff --git a/types/node/v18/ts5.6/buffer.buffer.d.ts b/types/node/v18/ts5.6/buffer.buffer.d.ts index dbf02cf0cc6248..9fc5a7e7f6b8af 100644 --- a/types/node/v18/ts5.6/buffer.buffer.d.ts +++ b/types/node/v18/ts5.6/buffer.buffer.d.ts @@ -153,6 +153,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/node/v20/buffer.buffer.d.ts b/types/node/v20/buffer.buffer.d.ts index 13e3b1abafb15c..10004003edc008 100644 --- a/types/node/v20/buffer.buffer.d.ts +++ b/types/node/v20/buffer.buffer.d.ts @@ -160,6 +160,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/node/v20/test/buffer.ts b/types/node/v20/test/buffer.ts index d5d36825e311c4..41c372e038a8d9 100644 --- a/types/node/v20/test/buffer.ts +++ b/types/node/v20/test/buffer.ts @@ -149,6 +149,17 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ Buffer.from({} as { [Symbol.toPrimitive](): number }); } + // ArrayLike or string + { + const arrayOrString = "foo" as number[] | string; + // $ExpectType Buffer || Buffer + Buffer.from(arrayOrString); + + const typedArrayOrString = "foo" as Uint8Array | string; + // $ExpectType Buffer || Buffer + Buffer.from(typedArrayOrString); + } + // @ts-expect-error Buffer.from({}); // @ts-expect-error diff --git a/types/node/v20/ts5.6/buffer.buffer.d.ts b/types/node/v20/ts5.6/buffer.buffer.d.ts index 0cb28428539cbe..aea019fbf0fd1c 100644 --- a/types/node/v20/ts5.6/buffer.buffer.d.ts +++ b/types/node/v20/ts5.6/buffer.buffer.d.ts @@ -158,6 +158,7 @@ declare module "buffer" { * @param encoding The encoding of `string`. **Default:** `'utf8'`. */ from(string: WithImplicitCoercion, encoding?: BufferEncoding): Buffer; + from(arrayOrString: WithImplicitCoercion | string>): Buffer; /** * Creates a new Buffer using the passed {data} * @param values to create a new Buffer diff --git a/types/parse-numeric-range/.npmignore b/types/parse-numeric-range/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/parse-numeric-range/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/parse-numeric-range/index.d.ts b/types/parse-numeric-range/index.d.ts deleted file mode 100644 index 8ed6ee05329c7a..00000000000000 --- a/types/parse-numeric-range/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Parses expressions like `1-10,20-30`. Returns an energetic (as opposed to lazy) array. - * @param expression a numeric range expression - */ -declare function parse(expression: string): number[]; -export = parse; diff --git a/types/parse-numeric-range/package.json b/types/parse-numeric-range/package.json deleted file mode 100644 index b4364fa2869f7d..00000000000000 --- a/types/parse-numeric-range/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/parse-numeric-range", - "version": "0.0.9999", - "projects": [ - "https://github.com/euank/node-parse-numeric-range" - ], - "devDependencies": { - "@types/parse-numeric-range": "workspace:." - }, - "owners": [ - { - "name": "Eoin O'Brien", - "githubUsername": "eoin-obrien" - } - ] -} diff --git a/types/parse-numeric-range/parse-numeric-range-tests.ts b/types/parse-numeric-range/parse-numeric-range-tests.ts deleted file mode 100644 index 4f61a27638f22e..00000000000000 --- a/types/parse-numeric-range/parse-numeric-range-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import parse = require("parse-numeric-range"); - -// $ExpectType number[] -parse(""); - -// $ExpectType number[] -parse("The cake is a lie."); - -// $ExpectType number[] -parse("4"); - -// $ExpectType number[] -parse("1..3"); - -// $ExpectType number[] -parse("5-16,18,20"); - -// $ExpectType number[] -parse("5\u202516"); diff --git a/types/parse-numeric-range/tsconfig.json b/types/parse-numeric-range/tsconfig.json deleted file mode 100644 index aaf52ed28a51ed..00000000000000 --- a/types/parse-numeric-range/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", - "parse-numeric-range-tests.ts" - ] -}