From bcbe920785a222710e199fc4e8282ae474034119 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sat, 10 Jan 2026 15:17:47 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74227=20feat(l?= =?UTF-8?q?odash):=20remove=20redundant=20isArray()=20overload=20by=20@hkl?= =?UTF-8?q?eungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/lodash/common/lang.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/types/lodash/common/lang.d.ts b/types/lodash/common/lang.d.ts index 333e5356caeb0c..1adf7d1499eca0 100644 --- a/types/lodash/common/lang.d.ts +++ b/types/lodash/common/lang.d.ts @@ -342,10 +342,6 @@ declare module "../index" { * @return Returns true if value is correctly classified, else false. */ isArray(value?: any): value is any[]; - /** - * @see _.isArray - */ - isArray(value?: any): value is any[]; } interface LoDashImplicitWrapper { /** From a06bb40bed4a228afb9e8f420e478a2b45779326 Mon Sep 17 00:00:00 2001 From: David Goss Date: Sat, 10 Jan 2026 08:20:19 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74159=20Add=20?= =?UTF-8?q?highlight=20fn=20to=20@babel/code-frame=20types=20by=20@davidjg?= =?UTF-8?q?oss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/babel__code-frame/babel__code-frame-tests.ts | 4 +++- types/babel__code-frame/index.d.ts | 9 +++++++++ types/babel__code-frame/package.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/types/babel__code-frame/babel__code-frame-tests.ts b/types/babel__code-frame/babel__code-frame-tests.ts index 8efb2b25e9d62c..7ae13033005150 100644 --- a/types/babel__code-frame/babel__code-frame-tests.ts +++ b/types/babel__code-frame/babel__code-frame-tests.ts @@ -1,4 +1,4 @@ -import codeFrame, { codeFrameColumns } from "@babel/code-frame"; +import codeFrame, { codeFrameColumns, highlight } from "@babel/code-frame"; const code = ` const number = 1; @@ -24,3 +24,5 @@ codeFrameColumns( { start: { line: 2, column: 2 } }, { highlightCode: true }, ); + +highlight(code); diff --git a/types/babel__code-frame/index.d.ts b/types/babel__code-frame/index.d.ts index f73c5dda44e5e0..425b4964c14230 100644 --- a/types/babel__code-frame/index.d.ts +++ b/types/babel__code-frame/index.d.ts @@ -46,3 +46,12 @@ export default function codeFrame( colNumber: number, options?: BabelCodeFrameOptions, ): string; + +/** + * Add syntax highlighting to a code snippet, to be displayed in a terminal. + * + * @param code Raw code to be highlighted + * + * @returns Highlighted code + */ +export function highlight(code: string): string; diff --git a/types/babel__code-frame/package.json b/types/babel__code-frame/package.json index b68513f5859c52..4cd2c441c67b61 100644 --- a/types/babel__code-frame/package.json +++ b/types/babel__code-frame/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/babel__code-frame", - "version": "7.0.9999", + "version": "7.27.9999", "projects": [ "https://github.com/babel/babel/tree/master/packages/babel-code-frame", "https://babeljs.io" From 591fde5cbbd2440ee5871d667fbd14a301072ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Homyee=20King=20=E3=83=9B=E3=83=9F=E3=82=A4?= Date: Sat, 10 Jan 2026 17:00:40 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74140=20chore:?= =?UTF-8?q?=20typo=20by=20@HomyeeKing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/vscode/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vscode/index.d.ts b/types/vscode/index.d.ts index 81b0581fdb6de2..63dcebf3713834 100644 --- a/types/vscode/index.d.ts +++ b/types/vscode/index.d.ts @@ -10143,7 +10143,7 @@ declare module 'vscode' { * * This closes the panel if it showing and disposes of the resources owned by the webview. * Webview panels are also disposed when the user closes the webview panel. Both cases - * fire the `onDispose` event. + * fire the `onDidDispose` event. */ dispose(): any; } From 6c487a4d2ecc866b5d06c16b9568e887eaee0758 Mon Sep 17 00:00:00 2001 From: krzysdz <12915102+krzysdz@users.noreply.github.com> Date: Sat, 10 Jan 2026 09:05:51 +0000 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74161=20[expre?= =?UTF-8?q?ss-serve-static-core]=20Fix=20`req.params`=20type=20by=20@krzys?= =?UTF-8?q?dz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: krzysdz --- .../express-serve-static-core-tests.ts | 36 +++++++------ types/express-serve-static-core/index.d.ts | 51 +++++++++++-------- .../v4/express-serve-static-core-tests.ts | 12 ----- types/express-serve-static-core/v4/index.d.ts | 18 +------ types/express/express-tests.ts | 20 +------- types/express/v4/express-tests.ts | 20 +------- types/i18n/i18n-tests.ts | 2 +- 7 files changed, 51 insertions(+), 108 deletions(-) diff --git a/types/express-serve-static-core/express-serve-static-core-tests.ts b/types/express-serve-static-core/express-serve-static-core-tests.ts index 62fd45e116ec61..6261537061b180 100644 --- a/types/express-serve-static-core/express-serve-static-core-tests.ts +++ b/types/express-serve-static-core/express-serve-static-core-tests.ts @@ -45,16 +45,16 @@ app.route("/:foo").get(req => { req.is(1); }); -// Params can used as an array -app.get("/*", req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number +// Wildcard parameters return string arrays +app.get("/*foo", req => { + req.params.foo; // $ExpectType string[] + req.params.foo.length; // $ExpectType number }); -// Params can used as an array - under route -app.route("/*").get(req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number +// Wildcard parameters return string arrays - under route +app.route("/*foo").get(req => { + req.params.foo; // $ExpectType string[] + req.params.foo.length; // $ExpectType number }); // Params can be a custom type @@ -74,10 +74,16 @@ app.route("/:foo/:bar").get<{ foo: string; bar: number }>(req => { req.params.baz; }); -// Optional params -app.get("/:foo/:bar?", req => { +// Regular expressions have parameters that always are strings, never arrays of strings +app.get(/^\/(.*?)\|(?\d+)/, req => { + req.params[0]; // $ExpectType string + req.params.foo; // $ExpectType string +}); + +// Regular expressions have parameters that always are strings, never arrays of strings - under route +app.route(/^\/(.*?)\|(?\d+)/).get(req => { + req.params[0]; // $ExpectType string req.params.foo; // $ExpectType string - req.params.bar; // $ExpectType string | undefined }); // Express 5.0: Optional params @@ -107,14 +113,6 @@ app.get("/:foo/:bar-:baz/:qux", req => { req.params.quxx; }); -// regex parameters - not supported -app.get("/:foo/:bar(\\d:+)/:baz", req => { - req.params.foo; // $ExpectType string - req.params.bar; // $ExpectType string - req.params.qux; // $ExpectType string - req.params.quxx; // $ExpectType string -}); - // long path parameters - https://github.com/DefinitelyTyped/DefinitelyTyped/pull/53513#issuecomment-870550063 app.get("/website-api/jobalarm/:jobalarmId/:subscriptionId/search", req => { req.params.jobalarmId; // $ExpectType string diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index 31bbdf1ff4bc51..4f1fc7736269db 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -42,10 +42,13 @@ export interface Dictionary { } export interface ParamsDictionary { - [key: string]: string; + [key: string]: string | string[]; + [key: number]: string; } -export type ParamsArray = string[]; -export type Params = ParamsDictionary | ParamsArray; +export interface ParamsFlatDictionary { + [key: string | number]: string; +} +export type Params = ParamsDictionary | ParamsFlatDictionary; export interface Locals extends Express.Locals {} @@ -96,20 +99,26 @@ type GetRouteParameter = RemoveTail< `.${string}` >; -// prettier-ignore -export type RouteParameters = Route extends `${infer Required}{${infer Optional}}${infer Next}` - ? ParseRouteParameters & Partial> & RouteParameters - : ParseRouteParameters; +// dprint-ignore +export type RouteParameters = Route extends string + ? Route extends `${infer Required}{${infer Optional}}${infer Next}` + ? ParseRouteParameters & Partial> & RouteParameters + : ParseRouteParameters + : ParamsFlatDictionary; type ParseRouteParameters = string extends Route ? ParamsDictionary - : Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters : Route extends `${string}:${infer Rest}` ? & ( GetRouteParameter extends never ? ParamsDictionary - : GetRouteParameter extends `${infer ParamName}?` ? { [P in ParamName]?: string } // TODO: Remove old `?` handling when Express 5 is promoted to "latest" : { [P in GetRouteParameter]: string } ) & (Rest extends `${GetRouteParameter}${infer Next}` ? RouteParameters : unknown) + : Route extends `${string}*${infer Rest}` ? + & ( + GetRouteParameter extends never ? ParamsDictionary + : { [P in GetRouteParameter]: string[] } + ) + & (Rest extends `${GetRouteParameter}${infer Next}` ? RouteParameters : unknown) : {}; /* eslint-disable @definitelytyped/no-unnecessary-generics */ @@ -118,7 +127,7 @@ export interface IRouterMatcher< Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any, > { < - Route extends string, + Route extends string | RegExp, P = RouteParameters, ResBody = any, ReqBody = any, @@ -131,7 +140,7 @@ export interface IRouterMatcher< ...handlers: Array> ): T; < - Path extends string, + Path extends string | RegExp, P = RouteParameters, ResBody = any, ReqBody = any, @@ -168,7 +177,7 @@ export interface IRouterMatcher< (path: PathParams, subApplication: Application): T; } -export interface IRouterHandler { +export interface IRouterHandler { (...handlers: Array>>): T; (...handlers: Array>>): T; < @@ -284,7 +293,7 @@ export interface IRouter extends RequestHandler { use: IRouterHandler & IRouterMatcher; - route(prefix: T): IRoute; + route(prefix: T): IRoute; route(prefix: PathParams): IRoute; /** * Stack of configured routes @@ -303,7 +312,7 @@ export interface ILayer { handle: (req: Request, res: Response, next: NextFunction) => any; } -export interface IRoute { +export interface IRoute { path: string; stack: ILayer[]; all: IRouterHandler; @@ -381,16 +390,14 @@ export type Errback = (err: Error) => void; /** * @param P For most requests, this should be `ParamsDictionary`, but if you're - * using this in a route handler for a route that uses a `RegExp` or a wildcard - * `string` path (e.g. `'/user/*'`), then `req.params` will be an array, in - * which case you should use `ParamsArray` instead. - * - * @see https://expressjs.com/en/api.html#req.params + * using this in a route handler for a route that uses a `RegExp`, then `req.params` + * will only contains strings, in which case you should use `ParamsFlatDictionary` instead. * * @example - * app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary` - * app.get(/user\/(.*)/, (req, res) => res.send(req.params[0])); - * app.get('/user/*', (req, res) => res.send(req.params[0])); + * app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`, parameter is string + * app.get('/user/*id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`, parameter is string[] + * app.get(/user\/(?.*)/, (req, res) => res.send(req.params.id)); // implicitly `ParamsFlatDictionary`, parameter is string + * app.get(/user\/(.*)/, (req, res) => res.send(req.params[0])); // implicitly `ParamsFlatDictionary`, parameter is string */ export interface Request< P = ParamsDictionary, diff --git a/types/express-serve-static-core/v4/express-serve-static-core-tests.ts b/types/express-serve-static-core/v4/express-serve-static-core-tests.ts index 06dc93249b0052..04ebe7d8574397 100644 --- a/types/express-serve-static-core/v4/express-serve-static-core-tests.ts +++ b/types/express-serve-static-core/v4/express-serve-static-core-tests.ts @@ -42,18 +42,6 @@ app.route("/:foo").get(req => { req.is(1); }); -// Params can used as an array -app.get("/*", req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number -}); - -// Params can used as an array - under route -app.route("/*").get(req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number -}); - // Params can be a custom type // NB. out-of-the-box all params are strings, however, other types are allowed to accommodate request validation/coercion middleware app.get<{ foo: string; bar: number }>("/:foo/:bar", req => { diff --git a/types/express-serve-static-core/v4/index.d.ts b/types/express-serve-static-core/v4/index.d.ts index 9e3d2502624a08..878b4e8819be7e 100644 --- a/types/express-serve-static-core/v4/index.d.ts +++ b/types/express-serve-static-core/v4/index.d.ts @@ -42,10 +42,9 @@ export interface Dictionary { } export interface ParamsDictionary { - [key: string]: string; + [key: string | number]: string; } -export type ParamsArray = string[]; -export type Params = ParamsDictionary | ParamsArray; +export type Params = ParamsDictionary; export interface Locals extends Express.Locals {} @@ -382,19 +381,6 @@ export interface RequestRanges extends RangeParserRanges {} export type Errback = (err: Error) => void; -/** - * @param P For most requests, this should be `ParamsDictionary`, but if you're - * using this in a route handler for a route that uses a `RegExp` or a wildcard - * `string` path (e.g. `'/user/*'`), then `req.params` will be an array, in - * which case you should use `ParamsArray` instead. - * - * @see https://expressjs.com/en/api.html#req.params - * - * @example - * app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary` - * app.get(/user\/(.*)/, (req, res) => res.send(req.params[0])); - * app.get('/user/*', (req, res) => res.send(req.params[0])); - */ export interface Request< P = ParamsDictionary, ResBody = any, diff --git a/types/express/express-tests.ts b/types/express/express-tests.ts index 93decba108e1ea..3d6261180e01d1 100644 --- a/types/express/express-tests.ts +++ b/types/express/express-tests.ts @@ -1,5 +1,5 @@ import express = require("express"); -import { ParamsArray, Request, RequestRanges } from "express-serve-static-core"; +import { Request, RequestRanges } from "express-serve-static-core"; import * as http from "http"; namespace express_tests { @@ -139,24 +139,6 @@ namespace express_tests { req.params[0]; }); - // Params can used as an array - router.get("/*", req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - - // Params can used as an array and can be specified via an explicit param type (express-serve-static-core) - router.get("/*", (req: Request) => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - - // Params can used as an array and can be specified via an explicit param type (express) - router.get("/*", (req: express.Request) => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - // Params can be a custom type // NB. out-of-the-box all params are strings, however, other types are allowed to accomadate request validation/coersion middleware router.get<{ foo: string; bar: number }>("/:foo/:bar", req => { diff --git a/types/express/v4/express-tests.ts b/types/express/v4/express-tests.ts index 98fcf8c4fec858..953f5b5e0d1427 100644 --- a/types/express/v4/express-tests.ts +++ b/types/express/v4/express-tests.ts @@ -1,5 +1,5 @@ import express = require("express"); -import { ParamsArray, Request, RequestRanges } from "express-serve-static-core"; +import { Request, RequestRanges } from "express-serve-static-core"; import * as http from "http"; namespace express_tests { @@ -146,24 +146,6 @@ namespace express_tests { req.params[0]; }); - // Params can used as an array - router.get("/*", req => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - - // Params can used as an array and can be specified via an explicit param type (express-serve-static-core) - router.get("/*", (req: Request) => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - - // Params can used as an array and can be specified via an explicit param type (express) - router.get("/*", (req: express.Request) => { - req.params[0]; // $ExpectType string - req.params.length; // $ExpectType number - }); - // Params can be a custom type // NB. out-of-the-box all params are strings, however, other types are allowed to accomadate request validation/coersion middleware router.get<{ foo: string; bar: number }>("/:foo/:bar", req => { diff --git a/types/i18n/i18n-tests.ts b/types/i18n/i18n-tests.ts index ccdf8b04647d80..e981c9b0539ec4 100644 --- a/types/i18n/i18n-tests.ts +++ b/types/i18n/i18n-tests.ts @@ -248,7 +248,7 @@ app.get("/ar", (_req: Express.Request, res: i18n.Response) => { i18n.setLocale(res, "ar"); i18n.setLocale(res.locals, "ar"); - i18n.setLocale([req, res.locals], req.params.lang); + i18n.setLocale([req, res.locals], "ar"); i18n.setLocale(res, "ar", true); }); From 53fd3f0794a0db898c703f85e7391012802e077e Mon Sep 17 00:00:00 2001 From: okathira <43328895+okathira@users.noreply.github.com> Date: Sat, 10 Jan 2026 18:06:04 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74250=20[react?= =?UTF-8?q?]=20Add=20missing=20SVG=20attributes:=20nonce,=20part,=20and=20?= =?UTF-8?q?slot=20by=20@okathira?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/react/index.d.ts | 3 +++ types/react/test/elementAttributes.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b3bab603f01a06..9994664130574b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -3564,6 +3564,9 @@ declare namespace React { method?: string | undefined; min?: number | string | undefined; name?: string | undefined; + nonce?: string | undefined; + part?: string | undefined; + slot?: string | undefined; style?: CSSProperties | undefined; target?: string | undefined; type?: string | undefined; diff --git a/types/react/test/elementAttributes.tsx b/types/react/test/elementAttributes.tsx index 22e7be732eb7ae..b9e3a8837d5238 100644 --- a/types/react/test/elementAttributes.tsx +++ b/types/react/test/elementAttributes.tsx @@ -29,6 +29,7 @@ const testCases = [ , , , + , , , , @@ -101,6 +102,7 @@ const testCases = [ open />, , + ,
, // Float <> @@ -171,6 +173,7 @@ const testCases = [ <> , From a32184072cadb83985f0e1d87caed81a5dda39a1 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 10 Jan 2026 10:21:37 +0000 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74228=20nodema?= =?UTF-8?q?iler:=20Fix=20'From'=20header=20incorrect=20array-less=20typing?= =?UTF-8?q?=20by=20@SpeedyCraftah?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/nodemailer/lib/mailer/index.d.ts | 2 +- types/nodemailer/nodemailer-tests.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/nodemailer/lib/mailer/index.d.ts b/types/nodemailer/lib/mailer/index.d.ts index 94b6910f3d474f..38e6e71c4d9f10 100644 --- a/types/nodemailer/lib/mailer/index.d.ts +++ b/types/nodemailer/lib/mailer/index.d.ts @@ -97,7 +97,7 @@ declare namespace Mail { interface Options { /** The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name ' */ - from?: string | Address | undefined; + from?: string | Address | Array | undefined; /** An e-mail address that will appear on the Sender: field */ sender?: string | Address | undefined; /** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */ diff --git a/types/nodemailer/nodemailer-tests.ts b/types/nodemailer/nodemailer-tests.ts index 2e6dcf9aa05829..f0257a0343a004 100644 --- a/types/nodemailer/nodemailer-tests.ts +++ b/types/nodemailer/nodemailer-tests.ts @@ -120,6 +120,17 @@ function message_common_fields_test() { }; } +// Array variant of common fields + +function message_common_fields_array_test() { + const message: Mail.Options = { + from: ["sender@server.com", { address: "sender2@server.com", name: "Sender2" }], + to: ["receiver@sender.com", { address: "receiver2@sender.com", name: "Receiver2" }], + cc: ["ccdreceiver@sender.com"], + bcc: ["bccdreceiver@sender.com"], + }; +} + // More advanced fields function message_more_advanced_fields_test() { From 3e6bd95eee45a6df5c3276bb87538afe62892a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgars=20Egl=C4=ABtis?= <37242620+eglitise@users.noreply.github.com> Date: Sat, 10 Jan 2026 12:30:46 +0200 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74267=20feat(t?= =?UTF-8?q?een=5Fprocess):=20remove=20types=20by=20@eglitise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/teen_process/.npmignore | 5 - types/teen_process/index.d.ts | 230 ----------------------- types/teen_process/package.json | 20 -- types/teen_process/teen_process-tests.ts | 62 ------ types/teen_process/tsconfig.json | 19 -- 6 files changed, 4 insertions(+), 336 deletions(-) delete mode 100644 types/teen_process/.npmignore delete mode 100644 types/teen_process/index.d.ts delete mode 100644 types/teen_process/package.json delete mode 100644 types/teen_process/teen_process-tests.ts delete mode 100644 types/teen_process/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 81314a4802c99c..94b794804ac29d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -7543,6 +7543,10 @@ "libraryName": "tedious", "asOfVersion": "18.0.0" }, + "teen_process": { + "libraryName": "teen_process", + "asOfVersion": "4.0.0" + }, "temp-dir": { "libraryName": "temp-dir", "asOfVersion": "2.0.0" diff --git a/types/teen_process/.npmignore b/types/teen_process/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/teen_process/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/teen_process/index.d.ts b/types/teen_process/index.d.ts deleted file mode 100644 index b9c6d924d5961f..00000000000000 --- a/types/teen_process/index.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -/// - -import { ChildProcess, SpawnOptions } from "child_process"; -import { EventEmitter } from "events"; -import { URL } from "url"; - -export { spawn } from "child_process"; - -/** - * Options for {@link exec teen_process.exec}. - */ -export interface TeenProcessExecOptions extends Pick { - cwd?: string | URL | undefined; - env?: NodeJS.ProcessEnv | undefined; - timeout?: number | undefined; - /** - * The signal value to be used when the spawned process will be killed by the abort signal. - * @default 'SIGTERM' - */ - killSignal?: NodeJS.Signals | number | undefined; - /** - * Character encoding to use when converting `stdout` and `stderr` to a string. - * Has no effect if `isBuffer` is set to true. - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * Useful if you have a very chatty process whose output you don't care about and - * don't want to add it to the memory consumed by your program. - * @default false - */ - ignoreOutput?: boolean; - /** - * @default 'inherit' - */ - stdio?: string | undefined; - /** - * Specifies that the returned standard I/O is an instance of a Buffer. - * @default false - * @example - * let {stdout, stderr} = await exec('cat', [filename], {isBuffer: true}); - * Buffer.isBuffer(stdout); // true - */ - isBuffer?: boolean | undefined; - /** - * If you're on Windows, you'll want to pass `shell: true`, because exec actually uses spawn under the hood, - * and is therefore subject to the issues noted about Windows + spawn in the Node docs. - * @see https://nodejs.org/api/child_process.html - */ - shell?: boolean | string | undefined; - /** - * Allows stdout and stderr to be sent to a particular logger, as it it received. - * This is overridden by the `ignoreOutput` option. - */ - logger?: TeenProcessLogger | undefined; - /** - * Maximum size of `stdout` buffer - * @default 100 * 1024 * 1024 // 100 MB - */ - maxStdoutBufferSize?: number; - /** - * Maximum size of `stderr` buffer - * @default 100 * 1024 * 1024 // 100 MB - */ - maxStderrBufferSize?: number; -} - -export interface TeenProcessLogger { - debug(...args: any[]): void; -} - -/** The value {@link exec teen_process.exec} resolves to */ -export interface TeenProcessExecResult { - /** Stdout */ - stdout: T; - /** Stderr */ - stderr: T; - /** Exit code */ - code: number; -} - -/** - * Spawns a process - * @param cmd - Program to execute - * @param args - Arguments to pass to the program - * @param opts - Options - */ -export function exec( - cmd: string, - args: readonly string[] | undefined, - opts: TeenProcessExecOptions & { isBuffer: true }, -): Promise>; -export function exec( - cmd: string, - args?: readonly string[], - opts?: TeenProcessExecOptions, -): Promise>; - -export interface SubProcessOptions extends SpawnOptions { - encoding?: string | undefined; -} - -/** - * SubProcess can be used to cut down on some of the boilerplate when using `spawn` in an async/await context. - * @example - * import { SubProcess } from 'teen_process'; - * - * async function tailFileForABit () { - * let proc = new SubProcess('tail', ['-f', '/var/log/foo.log']); - * await proc.start(); - * await proc.stop(); - * } - */ -export class SubProcess extends EventEmitter { - cmd: string; - args: readonly string[]; - proc: ChildProcess | null; - opts: SubProcessOptions; - expectingExit: boolean; - rep: string; - - constructor(cmd: string, args?: readonly string[], opts?: SubProcessOptions); - - readonly isRunning: boolean; - - emitLines(stream: string, lines: readonly string[]): void; - - /** - * spawn the subprocess and return control whenever we deem that it has fully "started". - * @param startDetector - Lets SubProcess know when to return control from `start()`. - * If a number, SubProcess will wait that number of milliseconds. - * If a function, SubProcess will wait until it returns true. - * Defaults to wait until there is some output. - * @param timeoutMs - Maximum time to wait for a process to start, in milliseconds. - */ - start(detach?: boolean): Promise; - start( - startDetector?: ((stdout: string, stderr: string) => boolean) | number | null, - detach?: boolean, - ): Promise; - start( - startDetector?: ((stdout: string, stderr: string) => boolean) | number | null, - timeoutMs?: number | null, - detach?: boolean, - ): Promise; - - handleLastLines(): void; - - /** - * Kills the process. - * @param signal - Custom signal instead of the default 'SIGTERM'. - * @param timeout - If your process might not be killable and you don't really care, you can also pass a timeout, - * which will return control to you in the form of an error after the timeout has passed. - */ - stop(signal?: NodeJS.Signals | number, timeout?: number): Promise; - - /** - * After the process has been started you can use join() to wait for it to finish on its own. - * @example - * await proc.join(); // will throw on exitcode not 0 - * await proc.join([0, 1]); // will throw on exitcode not 0 or 1 - */ - join(allowedExitCodes?: readonly number[]): Promise; - - /* - * This will only work if the process is created with the `detached` option - */ - detachProcess(): void; - - /** - * Returns the process identifier (PID) of the child process. - * If the child process hasn't started, then the value is `null`. - */ - readonly pid: number | null | undefined; - - addListener(event: string, listener: (...args: any[]) => void): this; - addListener( - event: "exit" | "stop" | "end" | "die", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - addListener(event: "output", listener: (stdout: string, stderr: string) => void): this; - addListener(event: "lines-stdout" | "lines-stderr", listener: (lines: string[]) => void): this; - addListener(event: "stream-line", listener: (line: string) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "exit" | "stop" | "end" | "die", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "output", stdout: string, stderr: string): this; - emit(event: "lines-stdout" | "lines-stderr", lines: string[]): this; - emit(event: "stream-line", line: string): this; - on(event: string, listener: (...args: any[]) => void): this; - on( - event: "exit" | "stop" | "end" | "die", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - on(event: "output", listener: (stdout: string, stderr: string) => void): this; - on(event: "lines-stdout" | "lines-stderr", listener: (lines: string[]) => void): this; - on(event: "stream-line", listener: (line: string) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once( - event: "exit" | "stop" | "end" | "die", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - once(event: "output", listener: (stdout: string, stderr: string) => void): this; - once(event: "lines-stdout" | "lines-stderr", listener: (lines: string[]) => void): this; - once(event: "stream-line", listener: (line: string) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener( - event: "exit" | "stop" | "end" | "die", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependListener(event: "output", listener: (stdout: string, stderr: string) => void): this; - prependListener(event: "lines-stdout" | "lines-stderr", listener: (lines: string[]) => void): this; - prependListener(event: "stream-line", listener: (line: string) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "exit" | "stop" | "end" | "die", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "output", listener: (stdout: string, stderr: string) => void): this; - prependOnceListener(event: "lines-stdout" | "lines-stderr", listener: (lines: string[]) => void): this; - prependOnceListener(event: "stream-line", listener: (line: string) => void): this; -} - -/** - * {@link exec} can reject with this error - */ -export interface ExecError extends Error { - code?: number; - stdout: string; - stderr: string; -} diff --git a/types/teen_process/package.json b/types/teen_process/package.json deleted file mode 100644 index 60acd081735ca6..00000000000000 --- a/types/teen_process/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/teen_process", - "version": "2.0.9999", - "projects": [ - "https://github.com/appium/node-teen_process" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/teen_process": "workspace:." - }, - "owners": [ - { - "name": "Tiger Oakes", - "githubUsername": "NotWoods" - } - ] -} diff --git a/types/teen_process/teen_process-tests.ts b/types/teen_process/teen_process-tests.ts deleted file mode 100644 index 644c0cabdefbee..00000000000000 --- a/types/teen_process/teen_process-tests.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { exec, ExecError, SubProcess, SubProcessOptions, TeenProcessExecOptions } from "teen_process"; - -exec("bigfix"); -exec("echo", ["my name is bob", "lol"]); -exec("echo", ["arg"], { cwd: process.cwd(), env: { FOO: "bar" }, timeout: 500, ignoreOutput: true }); - -const options: TeenProcessExecOptions = { - killSignal: 0, - encoding: "utf-8", - stdio: "pipe", - logger: { debug: console.log.bind(console) }, -}; -exec("echo", [], options); - -const stringResult: Promise<{ - stdout: string; - stderr: string; - code: number; -}> = exec("ls", [__dirname]); - -const stringResult2: Promise<{ - stdout: string; - stderr: string; - code: number; -}> = exec("ls", [__dirname], { isBuffer: false }); - -const stringResult3: Promise<{ - stdout: string; - stderr: string; - code: number; -}> = exec("ls", [__dirname], { encoding: "binary" }); - -const bufferResult: Promise<{ - stdout: Buffer; - stderr: Buffer; - code: number; -}> = exec("ls", [__dirname], { - isBuffer: true, -}); - -const props: { - args: readonly string[]; - opts: SubProcessOptions; - pid: number | null | undefined; -} = new SubProcess("ls"); - -try { - exec("exit", ["1"], { shell: true }); -} catch (err) { - const { stdout, stderr, code } = err as ExecError; -} -const subproc = new SubProcess("ls", [], { cwd: process.cwd() }); -subproc.on("lines-stdout", (newLines: string[]) => {}); -subproc.once("lines-stderr", (newLines: string[]) => {}); -subproc.addListener("output", (stdout: string, stderr: string) => {}); -subproc.start(0); -subproc.start((stdout: string) => stdout.indexOf("nothere") !== -1); -subproc.join(); - -subproc.prependListener("exit", (code: number | null, signal: NodeJS.Signals | null) => {}); -subproc.stop(); -subproc.detachProcess(); diff --git a/types/teen_process/tsconfig.json b/types/teen_process/tsconfig.json deleted file mode 100644 index aa5ebeaa0ef295..00000000000000 --- a/types/teen_process/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "teen_process-tests.ts" - ] -}