diff --git a/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx b/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx index fd876da8cd5f3e..b524bd1f42b6ec 100644 --- a/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx +++ b/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx @@ -19,6 +19,7 @@ import { CodeConversion, ContentDesign, Dashboard, + Design, DoctorPatient, Download_01, Export_01, @@ -87,3 +88,4 @@ import * as React from "react"; ; // $ExpectType Element ; // $ExpectType Element ; // $ExpectType Element +; // $ExpectType Element diff --git a/types/carbon__pictograms-react/es/design/index.d.ts b/types/carbon__pictograms-react/es/design/index.d.ts new file mode 100644 index 00000000000000..9dcca6cc15a71e --- /dev/null +++ b/types/carbon__pictograms-react/es/design/index.d.ts @@ -0,0 +1 @@ +export { Design as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/human-in-the-loop/index.d.ts b/types/carbon__pictograms-react/es/human-in-the-loop/index.d.ts new file mode 100644 index 00000000000000..1e488cc625fffd --- /dev/null +++ b/types/carbon__pictograms-react/es/human-in-the-loop/index.d.ts @@ -0,0 +1 @@ +export { HumanInTheLoop as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/index.d.ts b/types/carbon__pictograms-react/es/index.d.ts index 497c4c3c8d1a2e..7166cb944c772c 100644 --- a/types/carbon__pictograms-react/es/index.d.ts +++ b/types/carbon__pictograms-react/es/index.d.ts @@ -362,6 +362,7 @@ export { Delivered } from "../"; export { DeliveryTruck } from "../"; export { DeployingContainers } from "../"; export { Deployment } from "../"; +export { Design } from "../"; export { DesignLeadership } from "../"; export { DesignResearch } from "../"; export { DesignAndDevelopment_01 } from "../"; @@ -619,6 +620,7 @@ export { HongKong } from "../"; export { HongKongCityscape } from "../"; export { Hospital } from "../"; export { Hpi } from "../"; +export { HumanInTheLoop } from "../"; export { Humid } from "../"; export { Hummingbird } from "../"; export { Hurricane } from "../"; @@ -777,6 +779,7 @@ export { Marketplace } from "../"; export { Mas } from "../"; export { MassDataMigration } from "../"; export { MasterThreatHunting } from "../"; +export { MastersLeaderBoard } from "../"; export { MathCurve } from "../"; export { Maximize } from "../"; export { McgillUniversityMorriceHall } from "../"; @@ -907,6 +910,7 @@ export { Partnership } from "../"; export { Path } from "../"; export { Pattern } from "../"; export { PayForWhatYouUse } from "../"; +export { Pencil } from "../"; export { Performance } from "../"; export { Perfume } from "../"; export { Person_01 } from "../"; @@ -960,6 +964,7 @@ export { PrivateNetwork_03 } from "../"; export { PrivateNetwork_04 } from "../"; export { Process } from "../"; export { ProcessAutomation } from "../"; +export { Product } from "../"; export { Productivity } from "../"; export { ProfessionalMarketplace } from "../"; export { Progress } from "../"; @@ -992,6 +997,7 @@ export { ReadOnly } from "../"; export { RealEstate } from "../"; export { RealTime } from "../"; export { Receipt } from "../"; +export { Recruitment_01 } from "../"; export { Recycle } from "../"; export { RecycleBin } from "../"; export { RedHatApplications } from "../"; @@ -1106,6 +1112,7 @@ export { Socks } from "../"; export { SoftIceCream } from "../"; export { SoftlayerEnablement } from "../"; export { Software } from "../"; +export { Software_02 } from "../"; export { SolarField } from "../"; export { SolarPanel } from "../"; export { Solve } from "../"; @@ -1216,6 +1223,7 @@ export { TextLayout } from "../"; export { TextToSpeech } from "../"; export { ThisSideUp } from "../"; export { ThreatManagement } from "../"; +export { Tickets } from "../"; export { Time } from "../"; export { TimeLapse } from "../"; export { TimePlot } from "../"; @@ -1291,6 +1299,7 @@ export { UserInsights } from "../"; export { UserInterface } from "../"; export { UserMask } from "../"; export { UserProfile } from "../"; +export { UserResearchTools } from "../"; export { UserSearch } from "../"; export { Vancouver } from "../"; export { Vault } from "../"; @@ -1365,3 +1374,4 @@ export { Yoga_03 } from "../"; export { Yoga_04 } from "../"; export { ZeroTrust } from "../"; export { Zurich } from "../"; +export { ZurichSwissNationalMuseum } from "../"; diff --git a/types/carbon__pictograms-react/es/masters-leader-board/index.d.ts b/types/carbon__pictograms-react/es/masters-leader-board/index.d.ts new file mode 100644 index 00000000000000..884367daf09c21 --- /dev/null +++ b/types/carbon__pictograms-react/es/masters-leader-board/index.d.ts @@ -0,0 +1 @@ +export { MastersLeaderBoard as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/pencil/index.d.ts b/types/carbon__pictograms-react/es/pencil/index.d.ts new file mode 100644 index 00000000000000..a1c51c14bae985 --- /dev/null +++ b/types/carbon__pictograms-react/es/pencil/index.d.ts @@ -0,0 +1 @@ +export { Pencil as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/product/index.d.ts b/types/carbon__pictograms-react/es/product/index.d.ts new file mode 100644 index 00000000000000..5c74c57306b5bf --- /dev/null +++ b/types/carbon__pictograms-react/es/product/index.d.ts @@ -0,0 +1 @@ +export { Product as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/recruitment--01/index.d.ts b/types/carbon__pictograms-react/es/recruitment--01/index.d.ts new file mode 100644 index 00000000000000..d006dab01bd52e --- /dev/null +++ b/types/carbon__pictograms-react/es/recruitment--01/index.d.ts @@ -0,0 +1 @@ +export { Recruitment_01 as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/software--02/index.d.ts b/types/carbon__pictograms-react/es/software--02/index.d.ts new file mode 100644 index 00000000000000..fcc92edb3f99a8 --- /dev/null +++ b/types/carbon__pictograms-react/es/software--02/index.d.ts @@ -0,0 +1 @@ +export { Software_02 as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/tickets/index.d.ts b/types/carbon__pictograms-react/es/tickets/index.d.ts new file mode 100644 index 00000000000000..2f04b164325d8a --- /dev/null +++ b/types/carbon__pictograms-react/es/tickets/index.d.ts @@ -0,0 +1 @@ +export { Tickets as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/user--research-tools/index.d.ts b/types/carbon__pictograms-react/es/user--research-tools/index.d.ts new file mode 100644 index 00000000000000..a4b452776c213a --- /dev/null +++ b/types/carbon__pictograms-react/es/user--research-tools/index.d.ts @@ -0,0 +1 @@ +export { UserResearchTools as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/zurich--swiss-national-museum/index.d.ts b/types/carbon__pictograms-react/es/zurich--swiss-national-museum/index.d.ts new file mode 100644 index 00000000000000..1f1c5a63212eba --- /dev/null +++ b/types/carbon__pictograms-react/es/zurich--swiss-national-museum/index.d.ts @@ -0,0 +1 @@ +export { ZurichSwissNationalMuseum as default } from "../../"; diff --git a/types/carbon__pictograms-react/index.d.ts b/types/carbon__pictograms-react/index.d.ts index 5b86342f7b5b2f..2cf9aa7a408a8f 100644 --- a/types/carbon__pictograms-react/index.d.ts +++ b/types/carbon__pictograms-react/index.d.ts @@ -1,4 +1,4 @@ -/** 1367 pictograms in total */ +/** 1377 pictograms in total */ export interface CarbonPictogramProps extends Omit< @@ -386,6 +386,7 @@ export const Delivered: CarbonPictogramType; export const DeliveryTruck: CarbonPictogramType; export const DeployingContainers: CarbonPictogramType; export const Deployment: CarbonPictogramType; +export const Design: CarbonPictogramType; export const DesignLeadership: CarbonPictogramType; export const DesignResearch: CarbonPictogramType; export const DesignAndDevelopment_01: CarbonPictogramType; @@ -651,6 +652,7 @@ export const HongKong: CarbonPictogramType; export const HongKongCityscape: CarbonPictogramType; export const Hospital: CarbonPictogramType; export const Hpi: CarbonPictogramType; +export const HumanInTheLoop: CarbonPictogramType; export const Humid: CarbonPictogramType; export const Hummingbird: CarbonPictogramType; export const Hurricane: CarbonPictogramType; @@ -821,6 +823,7 @@ export const Marketplace: CarbonPictogramType; export const Mas: CarbonPictogramType; export const MassDataMigration: CarbonPictogramType; export const MasterThreatHunting: CarbonPictogramType; +export const MastersLeaderBoard: CarbonPictogramType; export const MathCurve: CarbonPictogramType; export const Maximize: CarbonPictogramType; export const McgillUniversityMorriceHall: CarbonPictogramType; @@ -951,6 +954,7 @@ export const Partnership: CarbonPictogramType; export const Path: CarbonPictogramType; export const Pattern: CarbonPictogramType; export const PayForWhatYouUse: CarbonPictogramType; +export const Pencil: CarbonPictogramType; export const Performance: CarbonPictogramType; export const Perfume: CarbonPictogramType; export const Person_01: CarbonPictogramType; @@ -1004,6 +1008,7 @@ export const PrivateNetwork_03: CarbonPictogramType; export const PrivateNetwork_04: CarbonPictogramType; export const Process: CarbonPictogramType; export const ProcessAutomation: CarbonPictogramType; +export const Product: CarbonPictogramType; export const Productivity: CarbonPictogramType; export const ProfessionalMarketplace: CarbonPictogramType; export const Progress: CarbonPictogramType; @@ -1036,6 +1041,7 @@ export const ReadOnly: CarbonPictogramType; export const RealEstate: CarbonPictogramType; export const RealTime: CarbonPictogramType; export const Receipt: CarbonPictogramType; +export const Recruitment_01: CarbonPictogramType; export const Recycle: CarbonPictogramType; export const RecycleBin: CarbonPictogramType; export const RedHatApplications: CarbonPictogramType; @@ -1150,6 +1156,7 @@ export const Socks: CarbonPictogramType; export const SoftIceCream: CarbonPictogramType; export const SoftlayerEnablement: CarbonPictogramType; export const Software: CarbonPictogramType; +export const Software_02: CarbonPictogramType; export const SolarField: CarbonPictogramType; export const SolarPanel: CarbonPictogramType; export const Solve: CarbonPictogramType; @@ -1264,6 +1271,7 @@ export const TextLayout: CarbonPictogramType; export const TextToSpeech: CarbonPictogramType; export const ThisSideUp: CarbonPictogramType; export const ThreatManagement: CarbonPictogramType; +export const Tickets: CarbonPictogramType; export const Time: CarbonPictogramType; export const TimeLapse: CarbonPictogramType; export const TimePlot: CarbonPictogramType; @@ -1343,6 +1351,7 @@ export const UserInsights: CarbonPictogramType; export const UserInterface: CarbonPictogramType; export const UserMask: CarbonPictogramType; export const UserProfile: CarbonPictogramType; +export const UserResearchTools: CarbonPictogramType; export const UserSearch: CarbonPictogramType; export const Vancouver: CarbonPictogramType; export const Vault: CarbonPictogramType; @@ -1421,3 +1430,4 @@ export const Yoga_03: CarbonPictogramType; export const Yoga_04: CarbonPictogramType; export const ZeroTrust: CarbonPictogramType; export const Zurich: CarbonPictogramType; +export const ZurichSwissNationalMuseum: CarbonPictogramType; diff --git a/types/carbon__pictograms-react/lib/design/index.d.ts b/types/carbon__pictograms-react/lib/design/index.d.ts new file mode 100644 index 00000000000000..c220c230b351c2 --- /dev/null +++ b/types/carbon__pictograms-react/lib/design/index.d.ts @@ -0,0 +1,3 @@ +import { Design } from "../../"; + +export = Design; diff --git a/types/carbon__pictograms-react/lib/human-in-the-loop/index.d.ts b/types/carbon__pictograms-react/lib/human-in-the-loop/index.d.ts new file mode 100644 index 00000000000000..d850615ba6738a --- /dev/null +++ b/types/carbon__pictograms-react/lib/human-in-the-loop/index.d.ts @@ -0,0 +1,3 @@ +import { HumanInTheLoop } from "../../"; + +export = HumanInTheLoop; diff --git a/types/carbon__pictograms-react/lib/index.d.ts b/types/carbon__pictograms-react/lib/index.d.ts index 497c4c3c8d1a2e..7166cb944c772c 100644 --- a/types/carbon__pictograms-react/lib/index.d.ts +++ b/types/carbon__pictograms-react/lib/index.d.ts @@ -362,6 +362,7 @@ export { Delivered } from "../"; export { DeliveryTruck } from "../"; export { DeployingContainers } from "../"; export { Deployment } from "../"; +export { Design } from "../"; export { DesignLeadership } from "../"; export { DesignResearch } from "../"; export { DesignAndDevelopment_01 } from "../"; @@ -619,6 +620,7 @@ export { HongKong } from "../"; export { HongKongCityscape } from "../"; export { Hospital } from "../"; export { Hpi } from "../"; +export { HumanInTheLoop } from "../"; export { Humid } from "../"; export { Hummingbird } from "../"; export { Hurricane } from "../"; @@ -777,6 +779,7 @@ export { Marketplace } from "../"; export { Mas } from "../"; export { MassDataMigration } from "../"; export { MasterThreatHunting } from "../"; +export { MastersLeaderBoard } from "../"; export { MathCurve } from "../"; export { Maximize } from "../"; export { McgillUniversityMorriceHall } from "../"; @@ -907,6 +910,7 @@ export { Partnership } from "../"; export { Path } from "../"; export { Pattern } from "../"; export { PayForWhatYouUse } from "../"; +export { Pencil } from "../"; export { Performance } from "../"; export { Perfume } from "../"; export { Person_01 } from "../"; @@ -960,6 +964,7 @@ export { PrivateNetwork_03 } from "../"; export { PrivateNetwork_04 } from "../"; export { Process } from "../"; export { ProcessAutomation } from "../"; +export { Product } from "../"; export { Productivity } from "../"; export { ProfessionalMarketplace } from "../"; export { Progress } from "../"; @@ -992,6 +997,7 @@ export { ReadOnly } from "../"; export { RealEstate } from "../"; export { RealTime } from "../"; export { Receipt } from "../"; +export { Recruitment_01 } from "../"; export { Recycle } from "../"; export { RecycleBin } from "../"; export { RedHatApplications } from "../"; @@ -1106,6 +1112,7 @@ export { Socks } from "../"; export { SoftIceCream } from "../"; export { SoftlayerEnablement } from "../"; export { Software } from "../"; +export { Software_02 } from "../"; export { SolarField } from "../"; export { SolarPanel } from "../"; export { Solve } from "../"; @@ -1216,6 +1223,7 @@ export { TextLayout } from "../"; export { TextToSpeech } from "../"; export { ThisSideUp } from "../"; export { ThreatManagement } from "../"; +export { Tickets } from "../"; export { Time } from "../"; export { TimeLapse } from "../"; export { TimePlot } from "../"; @@ -1291,6 +1299,7 @@ export { UserInsights } from "../"; export { UserInterface } from "../"; export { UserMask } from "../"; export { UserProfile } from "../"; +export { UserResearchTools } from "../"; export { UserSearch } from "../"; export { Vancouver } from "../"; export { Vault } from "../"; @@ -1365,3 +1374,4 @@ export { Yoga_03 } from "../"; export { Yoga_04 } from "../"; export { ZeroTrust } from "../"; export { Zurich } from "../"; +export { ZurichSwissNationalMuseum } from "../"; diff --git a/types/carbon__pictograms-react/lib/masters-leader-board/index.d.ts b/types/carbon__pictograms-react/lib/masters-leader-board/index.d.ts new file mode 100644 index 00000000000000..b311cf5954881e --- /dev/null +++ b/types/carbon__pictograms-react/lib/masters-leader-board/index.d.ts @@ -0,0 +1,3 @@ +import { MastersLeaderBoard } from "../../"; + +export = MastersLeaderBoard; diff --git a/types/carbon__pictograms-react/lib/pencil/index.d.ts b/types/carbon__pictograms-react/lib/pencil/index.d.ts new file mode 100644 index 00000000000000..b22262961f4644 --- /dev/null +++ b/types/carbon__pictograms-react/lib/pencil/index.d.ts @@ -0,0 +1,3 @@ +import { Pencil } from "../../"; + +export = Pencil; diff --git a/types/carbon__pictograms-react/lib/product/index.d.ts b/types/carbon__pictograms-react/lib/product/index.d.ts new file mode 100644 index 00000000000000..271f9cac900a44 --- /dev/null +++ b/types/carbon__pictograms-react/lib/product/index.d.ts @@ -0,0 +1,3 @@ +import { Product } from "../../"; + +export = Product; diff --git a/types/carbon__pictograms-react/lib/recruitment--01/index.d.ts b/types/carbon__pictograms-react/lib/recruitment--01/index.d.ts new file mode 100644 index 00000000000000..b6dadd29621e41 --- /dev/null +++ b/types/carbon__pictograms-react/lib/recruitment--01/index.d.ts @@ -0,0 +1,3 @@ +import { Recruitment_01 } from "../../"; + +export = Recruitment_01; diff --git a/types/carbon__pictograms-react/lib/software--02/index.d.ts b/types/carbon__pictograms-react/lib/software--02/index.d.ts new file mode 100644 index 00000000000000..de76db31989157 --- /dev/null +++ b/types/carbon__pictograms-react/lib/software--02/index.d.ts @@ -0,0 +1,3 @@ +import { Software_02 } from "../../"; + +export = Software_02; diff --git a/types/carbon__pictograms-react/lib/tickets/index.d.ts b/types/carbon__pictograms-react/lib/tickets/index.d.ts new file mode 100644 index 00000000000000..1d0c4b4a18a033 --- /dev/null +++ b/types/carbon__pictograms-react/lib/tickets/index.d.ts @@ -0,0 +1,3 @@ +import { Tickets } from "../../"; + +export = Tickets; diff --git a/types/carbon__pictograms-react/lib/user--research-tools/index.d.ts b/types/carbon__pictograms-react/lib/user--research-tools/index.d.ts new file mode 100644 index 00000000000000..6e7d797ba67bb5 --- /dev/null +++ b/types/carbon__pictograms-react/lib/user--research-tools/index.d.ts @@ -0,0 +1,3 @@ +import { UserResearchTools } from "../../"; + +export = UserResearchTools; diff --git a/types/carbon__pictograms-react/lib/zurich--swiss-national-museum/index.d.ts b/types/carbon__pictograms-react/lib/zurich--swiss-national-museum/index.d.ts new file mode 100644 index 00000000000000..e3b277cda4282e --- /dev/null +++ b/types/carbon__pictograms-react/lib/zurich--swiss-national-museum/index.d.ts @@ -0,0 +1,3 @@ +import { ZurichSwissNationalMuseum } from "../../"; + +export = ZurichSwissNationalMuseum; diff --git a/types/node/v22/buffer.d.ts b/types/node/v22/buffer.d.ts index ae76cc550a0e49..2a561c06b229c6 100644 --- a/types/node/v22/buffer.d.ts +++ b/types/node/v22/buffer.d.ts @@ -118,7 +118,6 @@ declare module "buffer" { * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using * a prior call to `URL.createObjectURL()`. * @since v16.7.0 - * @experimental * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. */ export function resolveObjectURL(id: string): Blob | undefined; diff --git a/types/node/v22/crypto.d.ts b/types/node/v22/crypto.d.ts index 55f25de1ee642c..859d4c4900cd40 100644 --- a/types/node/v22/crypto.d.ts +++ b/types/node/v22/crypto.d.ts @@ -3764,7 +3764,23 @@ declare module "crypto" { */ checkIP(ip: string): string | undefined; /** - * Checks whether this certificate was issued by the given `otherCert`. + * Checks whether this certificate was potentially issued by the given `otherCert` + * by comparing the certificate metadata. + * + * This is useful for pruning a list of possible issuer certificates which have been + * selected using a more rudimentary filtering routine, i.e. just based on subject + * and issuer names. + * + * Finally, to verify that this certificate's signature was produced by a private key + * corresponding to `otherCert`'s public key use `x509.verify(publicKey)` + * with `otherCert`'s public key represented as a `KeyObject` + * like so + * + * ```js + * if (!x509.verify(otherCert.publicKey)) { + * throw new Error('otherCert did not issue x509'); + * } + * ``` * @since v15.6.0 */ checkIssued(otherCert: X509Certificate): boolean; diff --git a/types/node/v22/fs.d.ts b/types/node/v22/fs.d.ts index 12da96019920df..ca3b0502ca34a2 100644 --- a/types/node/v22/fs.d.ts +++ b/types/node/v22/fs.d.ts @@ -243,8 +243,8 @@ declare module "fs" { */ name: Name; /** - * The base path that this `fs.Dirent` object refers to. - * @since v20.12.0 + * The path to the parent directory of the file this `fs.Dirent` object refers to. + * @since v20.12.0, v18.20.0 */ parentPath: string; /** @@ -328,6 +328,19 @@ declare module "fs" { * @since v12.12.0 */ readSync(): Dirent | null; + /** + * Calls `dir.close()` and returns a promise that fulfills when the + * dir is closed. + * @since v22.17.0 + * @experimental + */ + [Symbol.asyncDispose](): Promise; + /** + * Calls `dir.closeSync()` and returns `undefined`. + * @since v22.17.0 + * @experimental + */ + [Symbol.dispose](): void; } /** * Class: fs.StatWatcher @@ -4200,7 +4213,6 @@ declare module "fs" { * blob.stream(); * ``` * @since v19.8.0 - * @experimental */ export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; @@ -4361,7 +4373,7 @@ declare module "fs" { * Current working directory. * @default process.cwd() */ - cwd?: string | undefined; + cwd?: string | URL | undefined; /** * `true` if the glob should return paths as `Dirent`s, `false` otherwise. * @default false @@ -4386,13 +4398,23 @@ declare module "fs" { /** * Retrieves the files matching the specified pattern. + * + * ```js + * import { glob } from 'node:fs'; + * + * glob('*.js', (err, matches) => { + * if (err) throw err; + * console.log(matches); + * }); + * ``` + * @since v22.0.0 */ export function glob( - pattern: string | string[], + pattern: string | readonly string[], callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void, ): void; export function glob( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptionsWithFileTypes, callback: ( err: NodeJS.ErrnoException | null, @@ -4400,7 +4422,7 @@ declare module "fs" { ) => void, ): void; export function glob( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptionsWithoutFileTypes, callback: ( err: NodeJS.ErrnoException | null, @@ -4408,7 +4430,7 @@ declare module "fs" { ) => void, ): void; export function glob( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptions, callback: ( err: NodeJS.ErrnoException | null, @@ -4416,19 +4438,25 @@ declare module "fs" { ) => void, ): void; /** - * Retrieves the files matching the specified pattern. + * ```js + * import { globSync } from 'node:fs'; + * + * console.log(globSync('*.js')); + * ``` + * @since v22.0.0 + * @returns paths of files that match the pattern. */ - export function globSync(pattern: string | string[]): string[]; + export function globSync(pattern: string | readonly string[]): string[]; export function globSync( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptionsWithFileTypes, ): Dirent[]; export function globSync( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptionsWithoutFileTypes, ): string[]; export function globSync( - pattern: string | string[], + pattern: string | readonly string[], options: GlobOptions, ): Dirent[] | string[]; } diff --git a/types/node/v22/fs/promises.d.ts b/types/node/v22/fs/promises.d.ts index c8d84231a3679d..b8186e93eb16b1 100644 --- a/types/node/v22/fs/promises.d.ts +++ b/types/node/v22/fs/promises.d.ts @@ -88,6 +88,9 @@ declare module "fs/promises" { highWaterMark?: number | undefined; flush?: boolean | undefined; } + interface ReadableWebStreamOptions { + autoClose?: boolean | undefined; + } // TODO: Add `EventEmitter` close interface FileHandle { /** @@ -260,9 +263,8 @@ declare module "fs/promises" { * While the `ReadableStream` will read the file to completion, it will not * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. * @since v17.0.0 - * @experimental */ - readableWebStream(): ReadableStream; + readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; /** * Asynchronously reads the entire contents of a file. * @@ -475,7 +477,8 @@ declare module "fs/promises" { */ close(): Promise; /** - * An alias for {@link FileHandle.close()}. + * Calls `filehandle.close()` and returns a promise that fulfills when the + * filehandle is closed. * @since v20.4.0 */ [Symbol.asyncDispose](): Promise; @@ -1252,20 +1255,28 @@ declare module "fs/promises" { */ function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; /** - * Retrieves the files matching the specified pattern. + * ```js + * import { glob } from 'node:fs/promises'; + * + * for await (const entry of glob('*.js')) + * console.log(entry); + * ``` + * @since v22.0.0 + * @returns An AsyncIterator that yields the paths of files + * that match the pattern. */ - function glob(pattern: string | string[]): NodeJS.AsyncIterator; + function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator; function glob( - pattern: string | string[], - opt: GlobOptionsWithFileTypes, + pattern: string | readonly string[], + options: GlobOptionsWithFileTypes, ): NodeJS.AsyncIterator; function glob( - pattern: string | string[], - opt: GlobOptionsWithoutFileTypes, + pattern: string | readonly string[], + options: GlobOptionsWithoutFileTypes, ): NodeJS.AsyncIterator; function glob( - pattern: string | string[], - opt: GlobOptions, + pattern: string | readonly string[], + options: GlobOptions, ): NodeJS.AsyncIterator; } declare module "node:fs/promises" { diff --git a/types/node/v22/http2.d.ts b/types/node/v22/http2.d.ts index 48d1f7d9a41e01..e60f0e1ca47ea6 100644 --- a/types/node/v22/http2.d.ts +++ b/types/node/v22/http2.d.ts @@ -965,7 +965,10 @@ declare module "http2" { * * `:path` \= `/` * @since v8.4.0 */ - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; + request( + headers?: OutgoingHttpHeaders | readonly string[], + options?: ClientSessionRequestOptions, + ): ClientHttp2Stream; addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; addListener(event: "origin", listener: (origins: string[]) => void): this; addListener( @@ -1291,6 +1294,14 @@ declare module "http2" { * @default 100000 */ unknownProtocolTimeout?: number | undefined; + /** + * If `true`, it turns on strict leading + * and trailing whitespace validation for HTTP/2 header field names and values + * as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1). + * @since v24.2.0 + * @default true + */ + strictFieldWhitespaceValidation?: boolean | undefined; } export interface ClientSessionOptions extends SessionOptions { /** diff --git a/types/node/v22/inspector.d.ts b/types/node/v22/inspector.d.ts index 6682448131d2ce..ebcdb7a10e1b7e 100644 --- a/types/node/v22/inspector.d.ts +++ b/types/node/v22/inspector.d.ts @@ -1768,12 +1768,26 @@ declare module 'inspector' { status: number; statusText: string; headers: Headers; + mimeType: string; + charset: string; } /** * Request / response headers as keys / values of JSON object. */ interface Headers { } + interface StreamResourceContentParameterType { + /** + * Identifier of the request to stream. + */ + requestId: RequestId; + } + interface StreamResourceContentReturnType { + /** + * Data that has been buffered until streaming is enabled. + */ + bufferedData: never; + } interface RequestWillBeSentEventDataType { /** * Request identifier. @@ -1842,12 +1856,59 @@ declare module 'inspector' { */ timestamp: MonotonicTime; } + interface DataReceivedEventDataType { + /** + * Request identifier. + */ + requestId: RequestId; + /** + * Timestamp. + */ + timestamp: MonotonicTime; + /** + * Data chunk length. + */ + dataLength: number; + /** + * Actual bytes received (might be less than dataLength for compressed encodings). + */ + encodedDataLength: number; + /** + * Data that was received. + * @experimental + */ + data?: never | undefined; + } } namespace NodeRuntime { interface NotifyWhenWaitingForDisconnectParameterType { enabled: boolean; } } + namespace Target { + type SessionID = string; + type TargetID = string; + interface TargetInfo { + targetId: TargetID; + type: string; + title: string; + url: string; + attached: boolean; + canAccessOpener: boolean; + } + interface SetAutoAttachParameterType { + autoAttach: boolean; + waitForDebuggerOnStart: boolean; + } + interface TargetCreatedEventDataType { + targetInfo: TargetInfo; + } + interface AttachedToTargetEventDataType { + sessionId: SessionID; + targetInfo: TargetInfo; + waitingForDebugger: boolean; + } + } /** * The `inspector.Session` is used for dispatching messages to the V8 inspector @@ -2224,6 +2285,17 @@ declare module 'inspector' { * Enables network tracking, network events will now be delivered to the client. */ post(method: 'Network.enable', callback?: (err: Error | null) => void): void; + /** + * Enables streaming of the response for the given requestId. + * If enabled, the dataReceived event contains the data that was received during streaming. + * @experimental + */ + post( + method: 'Network.streamResourceContent', + params?: Network.StreamResourceContentParameterType, + callback?: (err: Error | null, params: Network.StreamResourceContentReturnType) => void + ): void; + post(method: 'Network.streamResourceContent', callback?: (err: Error | null, params: Network.StreamResourceContentReturnType) => void): void; /** * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. */ @@ -2237,6 +2309,8 @@ declare module 'inspector' { */ post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; + post(method: 'Target.setAutoAttach', params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Target.setAutoAttach', callback?: (err: Error | null) => void): void; addListener(event: string, listener: (...args: any[]) => void): this; /** @@ -2343,6 +2417,10 @@ declare module 'inspector' { addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + addListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2355,6 +2433,8 @@ declare module 'inspector' { * example, when inspector.waitingForDebugger is called */ addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + addListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: 'inspectorNotification', message: InspectorNotification): boolean; emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; @@ -2386,8 +2466,11 @@ declare module 'inspector' { emit(event: 'Network.responseReceived', message: InspectorNotification): boolean; emit(event: 'Network.loadingFailed', message: InspectorNotification): boolean; emit(event: 'Network.loadingFinished', message: InspectorNotification): boolean; + emit(event: 'Network.dataReceived', message: InspectorNotification): boolean; emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; emit(event: 'NodeRuntime.waitingForDebugger'): boolean; + emit(event: 'Target.targetCreated', message: InspectorNotification): boolean; + emit(event: 'Target.attachedToTarget', message: InspectorNotification): boolean; on(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -2493,6 +2576,10 @@ declare module 'inspector' { on(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; on(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; on(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + on(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2505,6 +2592,8 @@ declare module 'inspector' { * example, when inspector.waitingForDebugger is called */ on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + on(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + on(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; once(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -2610,6 +2699,10 @@ declare module 'inspector' { once(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; once(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; once(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + once(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2622,6 +2715,8 @@ declare module 'inspector' { * example, when inspector.waitingForDebugger is called */ once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + once(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + once(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -2727,6 +2822,10 @@ declare module 'inspector' { prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + prependListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2739,6 +2838,8 @@ declare module 'inspector' { * example, when inspector.waitingForDebugger is called */ prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -2844,6 +2945,10 @@ declare module 'inspector' { prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + prependOnceListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -2856,6 +2961,8 @@ declare module 'inspector' { * example, when inspector.waitingForDebugger is called */ prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependOnceListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; } /** @@ -2942,13 +3049,20 @@ declare module 'inspector' { // DevTools protocol event broadcast methods namespace Network { + /** + * This feature is only available with the `--experimental-network-inspection` flag enabled. + * + * Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if + * `Network.streamResourceContent` command was not invoked for the given request yet. + * @since v22.17.0 + */ + function dataReceived(params: DataReceivedEventDataType): void; /** * This feature is only available with the `--experimental-network-inspection` flag enabled. * * Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that * the application is about to send an HTTP request. * @since v22.6.0 - * @experimental */ function requestWillBeSent(params: RequestWillBeSentEventDataType): void; /** @@ -2957,7 +3071,6 @@ declare module 'inspector' { * Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that * HTTP response is available. * @since v22.6.0 - * @experimental */ function responseReceived(params: ResponseReceivedEventDataType): void; /** @@ -2966,7 +3079,6 @@ declare module 'inspector' { * Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that * HTTP request has finished loading. * @since v22.6.0 - * @experimental */ function loadingFinished(params: LoadingFinishedEventDataType): void; /** @@ -2975,7 +3087,6 @@ declare module 'inspector' { * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that * HTTP request has failed to load. * @since v22.7.0 - * @experimental */ function loadingFailed(params: LoadingFailedEventDataType): void; } @@ -3014,6 +3125,7 @@ declare module 'inspector/promises' { NodeWorker, Network, NodeRuntime, + Target, } from 'inspector'; /** @@ -3338,6 +3450,12 @@ declare module 'inspector/promises' { * Enables network tracking, network events will now be delivered to the client. */ post(method: 'Network.enable'): Promise; + /** + * Enables streaming of the response for the given requestId. + * If enabled, the dataReceived event contains the data that was received during streaming. + * @experimental + */ + post(method: 'Network.streamResourceContent', params?: Network.StreamResourceContentParameterType): Promise; /** * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. */ @@ -3350,6 +3468,7 @@ declare module 'inspector/promises' { * Enable the `NodeRuntime.waitingForDisconnect`. */ post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; + post(method: 'Target.setAutoAttach', params?: Target.SetAutoAttachParameterType): Promise; addListener(event: string, listener: (...args: any[]) => void): this; /** @@ -3456,6 +3575,10 @@ declare module 'inspector/promises' { addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + addListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3468,6 +3591,8 @@ declare module 'inspector/promises' { * example, when inspector.waitingForDebugger is called */ addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + addListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: 'inspectorNotification', message: InspectorNotification): boolean; emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; @@ -3499,8 +3624,11 @@ declare module 'inspector/promises' { emit(event: 'Network.responseReceived', message: InspectorNotification): boolean; emit(event: 'Network.loadingFailed', message: InspectorNotification): boolean; emit(event: 'Network.loadingFinished', message: InspectorNotification): boolean; + emit(event: 'Network.dataReceived', message: InspectorNotification): boolean; emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; emit(event: 'NodeRuntime.waitingForDebugger'): boolean; + emit(event: 'Target.targetCreated', message: InspectorNotification): boolean; + emit(event: 'Target.attachedToTarget', message: InspectorNotification): boolean; on(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -3606,6 +3734,10 @@ declare module 'inspector/promises' { on(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; on(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; on(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + on(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3618,6 +3750,8 @@ declare module 'inspector/promises' { * example, when inspector.waitingForDebugger is called */ on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + on(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + on(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; once(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -3723,6 +3857,10 @@ declare module 'inspector/promises' { once(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; once(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; once(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + once(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3735,6 +3873,8 @@ declare module 'inspector/promises' { * example, when inspector.waitingForDebugger is called */ once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + once(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + once(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -3840,6 +3980,10 @@ declare module 'inspector/promises' { prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + prependListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3852,6 +3996,8 @@ declare module 'inspector/promises' { * example, when inspector.waitingForDebugger is called */ prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -3957,6 +4103,10 @@ declare module 'inspector/promises' { prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification) => void): this; prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification) => void): this; + /** + * Fired when data chunk was received over the network. + */ + prependOnceListener(event: 'Network.dataReceived', listener: (message: InspectorNotification) => void): this; /** * This event is fired instead of `Runtime.executionContextDestroyed` when * enabled. @@ -3969,6 +4119,8 @@ declare module 'inspector/promises' { * example, when inspector.waitingForDebugger is called */ prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this; + prependOnceListener(event: 'Target.targetCreated', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification) => void): this; } export { @@ -3989,6 +4141,7 @@ declare module 'inspector/promises' { NodeWorker, Network, NodeRuntime, + Target, }; } diff --git a/types/node/v22/package.json b/types/node/v22/package.json index c9b04ac420347c..9578139decdfe2 100644 --- a/types/node/v22/package.json +++ b/types/node/v22/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/node", - "version": "22.16.9999", + "version": "22.17.9999", "nonNpm": "conflict", "nonNpmDescription": "Node.js", "projects": [ diff --git a/types/node/v22/readline/promises.d.ts b/types/node/v22/readline/promises.d.ts index 86754bba08ef6a..c0ebf4ba58ff12 100644 --- a/types/node/v22/readline/promises.d.ts +++ b/types/node/v22/readline/promises.d.ts @@ -1,6 +1,5 @@ /** * @since v17.0.0 - * @experimental */ declare module "readline/promises" { import { Abortable } from "node:events"; diff --git a/types/node/v22/stream.d.ts b/types/node/v22/stream.d.ts index 96176444d461f1..27802174817644 100644 --- a/types/node/v22/stream.d.ts +++ b/types/node/v22/stream.d.ts @@ -76,7 +76,6 @@ declare module "stream" { /** * A utility method for creating a `Readable` from a web `ReadableStream`. * @since v17.0.0 - * @experimental */ static fromWeb( readableStream: streamWeb.ReadableStream, @@ -85,7 +84,6 @@ declare module "stream" { /** * A utility method for creating a web `ReadableStream` from a `Readable`. * @since v17.0.0 - * @experimental */ static toWeb( streamReadable: Readable, @@ -101,7 +99,6 @@ declare module "stream" { /** * Returns whether the stream was destroyed or errored before emitting `'end'`. * @since v16.8.0 - * @experimental */ readonly readableAborted: boolean; /** @@ -113,7 +110,6 @@ declare module "stream" { /** * Returns whether `'data'` has been emitted. * @since v16.7.0, v14.18.0 - * @experimental */ readonly readableDidRead: boolean; /** @@ -719,7 +715,6 @@ declare module "stream" { /** * A utility method for creating a `Writable` from a web `WritableStream`. * @since v17.0.0 - * @experimental */ static fromWeb( writableStream: streamWeb.WritableStream, @@ -728,7 +723,6 @@ declare module "stream" { /** * A utility method for creating a web `WritableStream` from a `Writable`. * @since v17.0.0 - * @experimental */ static toWeb(streamWritable: Writable): streamWeb.WritableStream; /** @@ -740,7 +734,6 @@ declare module "stream" { /** * Returns whether the stream was destroyed or errored before emitting `'finish'`. * @since v18.0.0, v16.17.0 - * @experimental */ readonly writableAborted: boolean; /** @@ -1090,7 +1083,6 @@ declare module "stream" { /** * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. * @since v17.0.0 - * @experimental */ static toWeb(streamDuplex: Duplex): { readable: streamWeb.ReadableStream; @@ -1099,7 +1091,6 @@ declare module "stream" { /** * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. * @since v17.0.0 - * @experimental */ static fromWeb( duplexStream: { @@ -1650,13 +1641,11 @@ declare module "stream" { /** * Returns whether the stream has encountered an error. * @since v17.3.0, v16.14.0 - * @experimental */ function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; /** * Returns whether the stream is readable. * @since v17.4.0, v16.14.0 - * @experimental */ function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; } diff --git a/types/node/v22/test.d.ts b/types/node/v22/test.d.ts index 502e7d7a6ed03b..5bd292699e0774 100644 --- a/types/node/v22/test.d.ts +++ b/types/node/v22/test.d.ts @@ -502,6 +502,14 @@ declare module "node:test" { * The nesting level of the test. */ nesting: number; + /** + * The severity level of the diagnostic message. + * Possible values are: + * * `'info'`: Informational messages. + * * `'warn'`: Warnings. + * * `'error'`: Errors. + */ + level: "info" | "warn" | "error"; } interface TestCoverage { /** diff --git a/types/node/v22/test/fs.ts b/types/node/v22/test/fs.ts index 5986ffb3a19d67..51073b57a4aea3 100644 --- a/types/node/v22/test/fs.ts +++ b/types/node/v22/test/fs.ts @@ -627,6 +627,7 @@ async function testPromisify() { await handle.write(Buffer.from("hurr"), { position: 1 }); handle.readableWebStream(); + handle.readableWebStream({ autoClose: true }); handle.readLines()[Symbol.asyncIterator](); // $ExpectType AsyncIterator }); @@ -1030,6 +1031,9 @@ const anyStatFs: fs.StatsFs | fs.BigIntStatsFs = fs.statfsSync(".", { bigint: Ma glob("**/*.js", (err, matches) => { matches; // $ExpectType string[] }); + glob("**/*.js", { cwd: new URL("") }, (err, matches) => { + matches; // $ExpectType string[] + }); glob("**/*.js", { withFileTypes: true }, (err, matches) => { matches; // $ExpectType Dirent[] }); diff --git a/types/node/v22/test/http2.ts b/types/node/v22/test/http2.ts index 04412140a4f7ba..09eec774c35227 100644 --- a/types/node/v22/test/http2.ts +++ b/types/node/v22/test/http2.ts @@ -90,6 +90,7 @@ import { URL } from "node:url"; http2Session.ref(); http2Session.unref(); + const clientHttp2Session = http2Session as ClientHttp2Session; const headers: OutgoingHttpHeaders = {}; const options: ClientSessionRequestOptions = { endStream: true, @@ -99,9 +100,10 @@ import { URL } from "node:url"; waitForTrailers: true, signal: new AbortController().signal, }; - (http2Session as ClientHttp2Session).request(); - (http2Session as ClientHttp2Session).request(headers); - (http2Session as ClientHttp2Session).request(headers, options); + clientHttp2Session.request(); + clientHttp2Session.request(headers); + clientHttp2Session.request(headers, options); + clientHttp2Session.request([":method", "GET", ":path", "/foobar"]); const stream: Http2Stream = {} as any; http2Session.setLocalWindowSize(2 ** 20); @@ -271,6 +273,7 @@ import { URL } from "node:url"; unknownProtocolTimeout: 100000, streamResetBurst: 1000, streamResetRate: 33, + strictFieldWhitespaceValidation: false, }; const secureServerOptions: SecureServerOptions = { ...serverOptions, ca: "..." }; const onRequestHandler = (request: Http2ServerRequest, response: Http2ServerResponse) => { @@ -399,6 +402,7 @@ import { URL } from "node:url"; return new Duplex(); }, protocol: "https:", + strictFieldWhitespaceValidation: false, }; const secureClientSessionOptions: SecureClientSessionOptions = { ...clientSessionOptions, ca: "..." }; const onConnectHandler = (session: Http2Session, socket: Socket) => {}; @@ -502,6 +506,7 @@ import { URL } from "node:url"; unknownProtocolTimeout: 100000, streamResetBurst: 1000, streamResetRate: 33, + strictFieldWhitespaceValidation: false, }; const http2Stream: Http2Stream = {} as any; diff --git a/types/node/v22/test/test.ts b/types/node/v22/test/test.ts index ae2798ac3bb005..fe042dc75ed975 100644 --- a/types/node/v22/test/test.ts +++ b/types/node/v22/test/test.ts @@ -883,8 +883,8 @@ class TestReporter extends Transform { break; } case "test:diagnostic": { - const { file, column, line, message, nesting } = event.data; - callback(null, `${message}/${nesting}/${file}/${column}/${line}`); + const { file, column, line, message, nesting, level } = event.data; + callback(null, `${message}/${nesting}/${file}/${column}/${line}/${level}`); break; } case "test:enqueue": { diff --git a/types/node/v22/url.d.ts b/types/node/v22/url.d.ts index 72232c7a2cb8fe..b1f84d98a979b2 100644 --- a/types/node/v22/url.d.ts +++ b/types/node/v22/url.d.ts @@ -420,14 +420,12 @@ declare module "url" { * Threads, `Blob` objects registered within one Worker will not be available * to other workers or the main thread. * @since v16.7.0 - * @experimental */ static createObjectURL(blob: NodeBlob): string; /** * Removes the stored `Blob` identified by the given ID. Attempting to revoke a * ID that isn't registered will silently fail. * @since v16.7.0 - * @experimental * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. */ static revokeObjectURL(id: string): void; @@ -828,7 +826,7 @@ declare module "url" { * Returns an ES6 `Iterator` over each of the name-value pairs in the query. * Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`. * - * Alias for `urlSearchParams[@@iterator]()`. + * Alias for `urlSearchParams[Symbol.iterator]()`. */ entries(): URLSearchParamsIterator<[string, string]>; /** diff --git a/types/node/v22/util.d.ts b/types/node/v22/util.d.ts index b427f5ed735bbe..68c624dbe9987e 100644 --- a/types/node/v22/util.d.ts +++ b/types/node/v22/util.d.ts @@ -444,8 +444,8 @@ declare module "util" { * intended for debugging. The output of `util.inspect` may change at any time * and should not be depended upon programmatically. Additional `options` may be * passed that alter the result. - * `util.inspect()` will use the constructor's name and/or `@@toStringTag` to make - * an identifiable tag for an inspected value. + * `util.inspect()` will use the constructor's name and/or `Symbol.toStringTag` + * property to make an identifiable tag for an inspected value. * * ```js * class Foo { @@ -1461,6 +1461,7 @@ declare module "util" { | "hidden" | "inverse" | "italic" + | "none" | "overlined" | "reset" | "strikethrough" @@ -1517,6 +1518,8 @@ declare module "util" { * ); * ``` * + * The special format value `none` applies no additional styling to the text. + * * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers). * @param format A text format or an Array of text formats defined in `util.inspect.colors`. * @param text The text to to be formatted. diff --git a/types/node/v22/v8.d.ts b/types/node/v22/v8.d.ts index 8d66aea388a772..8f7106e7781a52 100644 --- a/types/node/v22/v8.d.ts +++ b/types/node/v22/v8.d.ts @@ -581,7 +581,6 @@ declare module "v8" { /** * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once. * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information. - * @experimental * @since v18.10.0, v16.18.0 */ function setHeapSnapshotNearHeapLimit(limit: number): void; @@ -807,33 +806,6 @@ declare module "v8" { */ const promiseHooks: PromiseHooks; type StartupSnapshotCallbackFn = (args: any) => any; - interface StartupSnapshot { - /** - * Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. - * This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization. - * @since v18.6.0, v16.17.0 - */ - addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * Add a callback that will be called when the Node.js instance is deserialized from a snapshot. - * The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or - * to re-acquire resources that the application needs when the application is restarted from the snapshot. - * @since v18.6.0, v16.17.0 - */ - addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. - * If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized - * data (if provided), otherwise an entry point script still needs to be provided to the deserialized application. - * @since v18.6.0, v16.17.0 - */ - setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void; - /** - * Returns true if the Node.js instance is run to build a snapshot. - * @since v18.6.0, v16.17.0 - */ - isBuildingSnapshot(): boolean; - } /** * The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots. * @@ -912,10 +884,35 @@ declare module "v8" { * * Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot. * - * @experimental * @since v18.6.0, v16.17.0 */ - const startupSnapshot: StartupSnapshot; + namespace startupSnapshot { + /** + * Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. + * This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization. + * @since v18.6.0, v16.17.0 + */ + function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * Add a callback that will be called when the Node.js instance is deserialized from a snapshot. + * The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or + * to re-acquire resources that the application needs when the application is restarted from the snapshot. + * @since v18.6.0, v16.17.0 + */ + function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. + * If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized + * data (if provided), otherwise an entry point script still needs to be provided to the deserialized application. + * @since v18.6.0, v16.17.0 + */ + function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void; + /** + * Returns true if the Node.js instance is run to build a snapshot. + * @since v18.6.0, v16.17.0 + */ + function isBuildingSnapshot(): boolean; + } } declare module "node:v8" { export * from "v8"; diff --git a/types/node/v22/worker_threads.d.ts b/types/node/v22/worker_threads.d.ts index 6f11c4a54ea2b4..979c234db5a797 100644 --- a/types/node/v22/worker_threads.d.ts +++ b/types/node/v22/worker_threads.d.ts @@ -187,6 +187,11 @@ declare module "worker_threads" { * @since v10.5.0 */ postMessage(value: any, transferList?: readonly Transferable[]): void; + /** + * If true, the `MessagePort` object will keep the Node.js event loop active. + * @since v18.1.0, v16.17.0 + */ + hasRef(): boolean; /** * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default * behavior). If the port is `ref()`ed, calling `ref()` again has no effect. diff --git a/types/node/v22/zlib.d.ts b/types/node/v22/zlib.d.ts index b71d553fe76cf9..16525553032e15 100644 --- a/types/node/v22/zlib.d.ts +++ b/types/node/v22/zlib.d.ts @@ -147,6 +147,10 @@ declare module "zlib" { * @default buffer.kMaxLength */ maxOutputLength?: number | undefined; + /** + * If `true`, returns an object with `buffer` and `engine`. + */ + info?: boolean | undefined; } interface ZstdOptions { /** @@ -172,6 +176,10 @@ declare module "zlib" { * @default buffer.kMaxLength */ maxOutputLength?: number | undefined; + /** + * If `true`, returns an object with `buffer` and `engine`. + */ + info?: boolean | undefined; } interface Zlib { /** @deprecated Use bytesWritten instead. */ @@ -612,8 +620,6 @@ declare module "zlib" { const Z_FINISH: number; /** @deprecated Use `constants.Z_BLOCK` */ const Z_BLOCK: number; - /** @deprecated Use `constants.Z_TREES` */ - const Z_TREES: number; // Return codes for the compression/decompression functions. // Negative values are errors, positive values are used for special but normal events. /** @deprecated Use `constants.Z_OK` */ diff --git a/types/telegram-web-app/index.d.ts b/types/telegram-web-app/index.d.ts index b649c25dc82067..79ea147d6a4aec 100644 --- a/types/telegram-web-app/index.d.ts +++ b/types/telegram-web-app/index.d.ts @@ -1,12 +1,16 @@ -declare var Telegram: Telegram; +declare global { + interface Window { + Telegram: Telegram; + } +} -type Color = string | false; +export type Color = string | false; -interface Telegram { +export interface Telegram { WebApp: WebApp; } -interface WebApp { +export interface WebApp { /** * A string with raw data transferred to the Web App, convenient for * validating data. WARNING: Validate data from this field before using it @@ -36,6 +40,13 @@ interface WebApp { * An object containing the current theme settings used in the Telegram app. */ themeParams: ThemeParams; + /** + * **Bot API 8.0+** + * + * True, if the Mini App is currently active. + * False, if the Mini App is minimized. + */ + isActive: boolean; /** * True if the Web App is expanded to the maximum available height. * False, if the Web App occupies part of the screen and can be expanded to the @@ -95,6 +106,25 @@ interface WebApp { * close the Web App. False, if the confirmation dialog is disabled. */ isClosingConfirmationEnabled: boolean; + /** + * True, if the Mini App is currently being displayed in fullscreen mode. + */ + isFullscreen: boolean; + /** + * True, if the Mini App’s orientation is currently locked. + * False, if orientation changes freely based on the device’s rotation. + */ + isOrientationLocked: boolean; + /** + * An object representing the device's safe area insets, + * accounting for system UI elements like notches or navigation bars. + */ + safeAreaInset: SafeAreaInset; + /** + * An object representing the safe area for displaying content within the app, + * free from overlapping Telegram UI elements. + */ + contentSafeAreaInset: ContentSafeAreaInset; /** * An object for controlling the back button which can be displayed in the * header of the Web App in the Telegram interface. @@ -127,20 +157,43 @@ interface WebApp { * An object for controlling biometrics on the device. */ BiometricManager: BiometricManager; + /** + * An object for accessing device orientation data on the device. + */ + Accelerometer: Accelerometer; + /** + * An object for accessing device orientation data on the device. + */ + DeviceOrientation: DeviceOrientation; + /** + * An object for accessing gyroscope data on the device. + */ + Gyroscope: Gyroscope; + /** + * An object for controlling location on the device. + */ + LocationManager: LocationManager; + /** + * An object for storing and retrieving data from the device's local storage. + */ + DeviceStorage: DeviceStorage; + /** + * An object for storing and retrieving data from the device's secure storage. + */ + SecureStorage: SecureStorage; /** * Returns true if the user's app supports a version of the Bot API that is * equal to or higher than the version passed as the parameter. */ isVersionAtLeast(version: string): boolean; /** - * A method that sets the app header color in the `#RRGGBB` format. You can - * also use keywords bg_color and secondary_bg_color. + * A method that sets the app header color in the `#RRGGBB` format. + * You can also use keywords bg_color and secondary_bg_color. */ - // string & {} prevents this from eagerly collapsing into just string setHeaderColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void; /** - * A method that sets the app background color in the `#RRGGBB` format or - * you can use keywords bg_color, secondary_bg_color instead. + * A method that sets the app background color in the `#RRGGBB` format + * or you can use keywords bg_color, secondary_bg_color instead. */ setBackgroundColor(color: "bg_color" | "secondary_bg_color" | "bottom_bar_bg_color" | (string & {})): void; /** @@ -162,14 +215,18 @@ interface WebApp { * A method that sets the app event handler. Check the list of available * events. */ + onEvent(eventType: "activated", eventHandler: ActivatedCallback): void; + onEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void; onEvent(eventType: "themeChanged", eventHandler: ThemeChangedCallback): void; + onEvent(eventType: "viewportChanged", eventHandler: ViewportChangedCallback): void; + onEvent(eventType: "safeAreaChanged", eventHandler: SafeAreaChangedChangedCallback): void; + onEvent(eventType: "contentSafeAreaChanged", eventHandler: ContentSafeAreaChangedCallback): void; onEvent(eventType: "mainButtonClicked", eventHandler: MainButtonClickedCallback): void; onEvent(eventType: "secondaryButtonClicked", eventHandler: SecondaryButtonClickedCallback): void; onEvent(eventType: "backButtonClicked", eventHandler: BackButtonClickedCallback): void; onEvent(eventType: "settingsButtonClicked", eventHandler: SettingsButtonClickedCallback): void; - onEvent(eventType: "popupClosed", eventHandler: PopupClosedCallback): void; - onEvent(eventType: "viewportChanged", eventHandler: ViewportChangedCallback): void; onEvent(eventType: "invoiceClosed", eventHandler: InvoiceClosedCallback): void; + onEvent(eventType: "popupClosed", eventHandler: PopupClosedCallback): void; onEvent(eventType: "qrTextReceived", eventHandler: QrTextReceivedCallback): void; onEvent(eventType: "scanQrPopupClosed", eventHandler: ScanQrPopupClosedCallback): void; onEvent(eventType: "clipboardTextReceived", eventHandler: ClipboardTextReceivedCallback): void; @@ -178,15 +235,44 @@ interface WebApp { onEvent(eventType: "biometricManagerUpdated", eventHandler: BiometricManagerUpdatedCallback): void; onEvent(eventType: "biometricAuthRequested", eventHandler: BiometricAuthRequestedCallback): void; onEvent(eventType: "biometricTokenUpdated", eventHandler: BiometricTokenUpdatedCallback): void; + onEvent(eventType: "fullscreenChanged", eventHandler: FullscreenChangedCallback): void; + onEvent(eventType: "fullscreenFailed", eventHandler: FullscreenFailedCallback): void; + onEvent(eventType: "homeScreenAdded", eventHandler: HomeScreenAddedCallback): void; + onEvent(eventType: "homeScreenChecked", eventHandler: HomeScreenCheckedCallback): void; + onEvent(eventType: "accelerometerStarted", eventHandler: AccelerometerStartedCallback): void; + onEvent(eventType: "accelerometerStopped", eventHandler: AccelerometerStoppedCallback): void; + onEvent(eventType: "accelerometerChanged", eventHandler: AccelerometerChangedCallback): void; + onEvent(eventType: "accelerometerFailed", eventHandler: AccelerometerFailedCallback): void; + onEvent(eventType: "deviceOrientationStarted", eventHandler: DeviceOrientationStartedCallback): void; + onEvent(eventType: "deviceOrientationStopped", eventHandler: DeviceOrientationStoppedCallback): void; + onEvent(eventType: "deviceOrientationChanged", eventHandler: DeviceOrientationChangedCallback): void; + onEvent(eventType: "deviceOrientationFailed", eventHandler: DeviceOrientationFailedCallback): void; + onEvent(eventType: "gyroscopeStarted", eventHandler: GyroscopeStartedCallback): void; + onEvent(eventType: "gyroscopeStopped", eventHandler: GyroscopeStoppedCallback): void; + onEvent(eventType: "gyroscopeChanged", eventHandler: GyroscopeChangedCallback): void; + onEvent(eventType: "gyroscopeFailed", eventHandler: GyroscopeFailedCallback): void; + onEvent(eventType: "locationManagerUpdated", eventHandler: LocationManagerUpdatedCallback): void; + onEvent(eventType: "locationRequested", eventHandler: LocationRequestedCallback): void; + onEvent(eventType: "shareMessageSent", eventHandler: ShareMessageSentCallback): void; + onEvent(eventType: "shareMessageFailed", eventHandler: ShareMessageFailedCallback): void; + onEvent(eventType: "emojiStatusSet", eventHandler: EmojiStatusSetCallback): void; + onEvent(eventType: "emojiStatusFailed", eventHandler: EmojiStatusFailedCallback): void; + onEvent(eventType: "emojiStatusAccessRequested", eventHandler: EmojiStatusAccessRequestedCallback): void; + onEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void; /** A method that deletes a previously set event handler. */ + offEvent(eventType: "activated", eventHandler: ActivatedCallback): void; + offEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void; offEvent(eventType: "themeChanged", eventHandler: ThemeChangedCallback): void; + offEvent(eventType: "viewportChanged", eventHandler: ViewportChangedCallback): void; + offEvent(eventType: "safeAreaChanged", eventHandler: SafeAreaChangedChangedCallback): void; + offEvent(eventType: "contentSafeAreaChanged", eventHandler: ContentSafeAreaChangedCallback): void; offEvent(eventType: "mainButtonClicked", eventHandler: MainButtonClickedCallback): void; + offEvent(eventType: "secondaryButtonClicked", eventHandler: SecondaryButtonClickedCallback): void; offEvent(eventType: "backButtonClicked", eventHandler: BackButtonClickedCallback): void; offEvent(eventType: "settingsButtonClicked", eventHandler: SettingsButtonClickedCallback): void; - offEvent(eventType: "popupClosed", eventHandler: PopupClosedCallback): void; - offEvent(eventType: "viewportChanged", eventHandler: ViewportChangedCallback): void; offEvent(eventType: "invoiceClosed", eventHandler: InvoiceClosedCallback): void; + offEvent(eventType: "popupClosed", eventHandler: PopupClosedCallback): void; offEvent(eventType: "qrTextReceived", eventHandler: QrTextReceivedCallback): void; offEvent(eventType: "scanQrPopupClosed", eventHandler: ScanQrPopupClosedCallback): void; offEvent(eventType: "clipboardTextReceived", eventHandler: ClipboardTextReceivedCallback): void; @@ -195,6 +281,30 @@ interface WebApp { offEvent(eventType: "biometricManagerUpdated", eventHandler: BiometricManagerUpdatedCallback): void; offEvent(eventType: "biometricAuthRequested", eventHandler: BiometricAuthRequestedCallback): void; offEvent(eventType: "biometricTokenUpdated", eventHandler: BiometricTokenUpdatedCallback): void; + offEvent(eventType: "fullscreenChanged", eventHandler: FullscreenChangedCallback): void; + offEvent(eventType: "fullscreenFailed", eventHandler: FullscreenFailedCallback): void; + offEvent(eventType: "homeScreenAdded", eventHandler: HomeScreenAddedCallback): void; + offEvent(eventType: "homeScreenChecked", eventHandler: HomeScreenCheckedCallback): void; + offEvent(eventType: "accelerometerStarted", eventHandler: AccelerometerStartedCallback): void; + offEvent(eventType: "accelerometerStopped", eventHandler: AccelerometerStoppedCallback): void; + offEvent(eventType: "accelerometerChanged", eventHandler: AccelerometerChangedCallback): void; + offEvent(eventType: "accelerometerFailed", eventHandler: AccelerometerFailedCallback): void; + offEvent(eventType: "deviceOrientationStarted", eventHandler: DeviceOrientationStartedCallback): void; + offEvent(eventType: "deviceOrientationStopped", eventHandler: DeviceOrientationStoppedCallback): void; + offEvent(eventType: "deviceOrientationChanged", eventHandler: DeviceOrientationChangedCallback): void; + offEvent(eventType: "deviceOrientationFailed", eventHandler: DeviceOrientationFailedCallback): void; + offEvent(eventType: "gyroscopeStarted", eventHandler: GyroscopeStartedCallback): void; + offEvent(eventType: "gyroscopeStopped", eventHandler: GyroscopeStoppedCallback): void; + offEvent(eventType: "gyroscopeChanged", eventHandler: GyroscopeChangedCallback): void; + offEvent(eventType: "gyroscopeFailed", eventHandler: GyroscopeFailedCallback): void; + offEvent(eventType: "locationManagerUpdated", eventHandler: LocationManagerUpdatedCallback): void; + offEvent(eventType: "locationRequested", eventHandler: LocationRequestedCallback): void; + offEvent(eventType: "shareMessageSent", eventHandler: ShareMessageSentCallback): void; + offEvent(eventType: "shareMessageFailed", eventHandler: ShareMessageFailedCallback): void; + offEvent(eventType: "emojiStatusSet", eventHandler: EmojiStatusSetCallback): void; + offEvent(eventType: "emojiStatusFailed", eventHandler: EmojiStatusFailedCallback): void; + offEvent(eventType: "emojiStatusAccessRequested", eventHandler: EmojiStatusAccessRequestedCallback): void; + offEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void; /** * A method used to send data to the bot. When this method is called, a @@ -239,10 +349,7 @@ interface WebApp { * optional callback parameter was passed, the callback function will be * called and the invoice status will be passed as the first argument. */ - openInvoice( - url: string, - callback: (status: "paid" | "cancelled" | "failed" | "pending") => void, - ): void; + openInvoice(url: string, callback: (status: "paid" | "cancelled" | "failed" | "pending") => void): void; /** * A method that shows a native popup described by the params argument of * the type PopupParams. The Web App will receive the event popupClosed when @@ -288,10 +395,52 @@ interface WebApp { * the type StoryShareParams describes additional sharing settings. */ shareToStory(media_url: string, params?: StoryShareParams): void; /** - * A method that requests text from the clipboard. The Web App will receive - * the event clipboardTextReceived. If an optional callback parameter was - * passed, the callback function will be called and the text from the - * clipboard will be passed as the first argument. + * **Bot API 8.0+** + * + * A method that opens a dialog allowing the user to share a message provided by the bot. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean as the first argument, + * indicating whether the message was successfully sent. + */ + shareMessage(msg_id: number, callback?: (success: boolean) => void): void; + /** + * **Bot API 8.0+** + * + * A method that opens a dialog allowing the user to set the specified custom emoji as their status. + * An optional params argument of type EmojiStatusParams specifies additional settings,such as duration. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean as the first argument, + * indicating whether the status was set. + * + * Note: this method opens a native dialog and cannot be used to set the emoji status without manual user interaction. + * For fully programmatic changes, you should instead use the Bot API method setUserEmojiStatus + * after obtaining authorization to do so via the Mini App method requestEmojiStatusAccess. + */ + setEmojiStatus(custom_emoji_id: string, params?: EmojiStatusParams, callback?: (success: boolean) => void): void; + /** + * **Bot API 8.0+** + * + * A method that shows a native popup requesting permission for the bot to manage user's emoji status. + * If an optional callback parameter was passed, + * the callback function will be called when the popup is closed + * and the first argument will be a boolean indicating whether the user granted this access. + */ + requestEmojiStatusAccess(callback?: (success: boolean) => void): void; + /** + * **Bot API 8.0+** + * + * A method that displays a native popup prompting the user to download a file + * specified by the params argument of type DownloadFileParams. + * If an optional callback parameter is provided, + * the callback function will be called when the popup is closed, + * with the first argument as a boolean indicating whether the user accepted the download request. + */ + downloadFile(params: DownloadFileParams, callback?: (success: boolean) => void): void; + /** + * A method that requests text from the clipboard. + * The Web App will receive the event clipboardTextReceived. + * If an optional callback parameter was passed, + * the callback function will be called and the text from the clipboard will be passed as the first argument. * * Note: this method can be called only for Web Apps launched from the * attachment menu and only in response to a user interaction with the Web @@ -318,9 +467,7 @@ interface WebApp { * number. The second argument, contingent upon success, will be an object * detailing the shared contact information or a cancellation response. */ - requestContact( - callback?: (success: boolean, response: RequestContactResponse) => void, - ): void; + requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void; /** * A method that informs the Telegram app that the Web App is ready to be * displayed. It is recommended to call this method as early as possible, as @@ -346,43 +493,146 @@ interface WebApp { */ isVerticalSwipesEnabled: boolean; /** - * **Bot API 7.7+** A method that enables vertical swipes to close or - * minimize the Mini App. For user convenience, it is recommended to always - * enable swipes unless they conflict with the Mini App's own gestures. + * **Bot API 7.7+** + * A method that enables vertical swipes to close or minimize the Mini App. + * For user convenience, it is recommended to always enable swipes unless they conflict + * with the Mini App's own gestures. */ enableVerticalSwipes(): void; /** - * **Bot API 7.7+** A method that disables vertical swipes to close or - * minimize the Mini App. This method is useful if your Mini App uses swipe - * gestures that may conflict with the gestures for minimizing and closing - * the app. + * **Bot API 7.7+** + * A method that disables vertical swipes to close or minimize the Mini App. + * This method is useful if your Mini App uses swipe gestures that may conflict + * with the gestures for minimizing and closing the app. */ disableVerticalSwipes(): void; + /** + * **Bot API 8.0+** + * + * A method that requests opening the Mini App in fullscreen mode. + * Although the header is transparent in fullscreen mode, + * it is recommended that the Mini App sets the header color using the setHeaderColor method. + * This color helps determine a contrasting color for the status bar and other UI controls. + */ + requestFullscreen(): void; + /** + * **Bot API 8.0+** + * + * A method that requests exiting fullscreen mode. + */ + exitFullscreen(): void; + /** + * **Bot API 8.0+** + * + * A method that locks the Mini App’s orientation to its current mode (either portrait or landscape). + * Once locked, the orientation remains fixed, regardless of device rotation. + * This is useful if a stable orientation is needed during specific interactions. + */ + lockOrientation(): void; + /** + * **Bot API 8.0+** + * + * A method that unlocks the Mini App’s orientation, allowing it to follow the device's rotation freely. + * Use this to restore automatic orientation adjustments based on the device orientation. + */ + unlockOrientation(): void; + /** + * **Bot API 8.0+** + * + * A method that prompts the user to add the Mini App to the home screen. + * After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device. + * Note that if the device cannot determine the installation status, + * the event may not be received even if the icon has been added. + */ + addToHomeScreen(): void; + /** + * **Bot API 8.0+** + * + * A method that checks if adding to the home screen is supported and if the Mini App has already been added. + * If an optional callback parameter is provided, + * the callback function will be called with a single argument status, + * which is a string indicating the home screen status. + */ + checkHomeScreenStatus(callback?: (status: "unsupported" | "unknown" | "added" | "missed") => void): void; } -type ThemeChangedCallback = () => void; -type ViewportChangedCallback = (eventData: { isStateStable: boolean }) => void; -type MainButtonClickedCallback = () => void; -type SecondaryButtonClickedCallback = () => void; -type BackButtonClickedCallback = () => void; -type SettingsButtonClickedCallback = () => void; -type InvoiceClosedCallback = (eventData: { url: string; status: "paid" | "cancelled" | "failed" | "pending" }) => void; -type PopupClosedCallback = (eventData: { button_id: string | null }) => void; -type QrTextReceivedCallback = (eventData: { data: string }) => void; -type ScanQrPopupClosedCallback = () => void; -type ClipboardTextReceivedCallback = (eventData: { data: string | null }) => void; -type WriteAccessRequestedCallback = (eventData: { status: "allowed" | "cancelled" }) => void; -type ContactRequestedCallback = (eventData: RequestContactResponse) => void; -type BiometricManagerUpdatedCallback = () => void; -type BiometricAuthRequestedCallback = (eventData: { isAuthenticated: boolean; biometricToken?: string }) => void; -type BiometricTokenUpdatedCallback = (eventData: { isUpdated: boolean }) => void; +export type ActivatedCallback = () => void; +export type DeactivatedCallback = () => void; +export type ThemeChangedCallback = () => void; +export type ViewportChangedCallback = (eventData: { isStateStable: boolean }) => void; +export type SafeAreaChangedChangedCallback = () => void; +export type ContentSafeAreaChangedCallback = () => void; +export type MainButtonClickedCallback = () => void; +export type SecondaryButtonClickedCallback = () => void; +export type BackButtonClickedCallback = () => void; +export type SettingsButtonClickedCallback = () => void; +export type InvoiceClosedCallback = (eventData: { + url: string; + status: "paid" | "cancelled" | "failed" | "pending"; +}) => void; +export type PopupClosedCallback = (eventData: { button_id: string | null }) => void; +export type QrTextReceivedCallback = (eventData: { data: string }) => void; +export type ScanQrPopupClosedCallback = () => void; +export type ClipboardTextReceivedCallback = (eventData: { data: string | null }) => void; +export type WriteAccessRequestedCallback = (eventData: { + status: "allowed" | "cancelled"; +}) => void; +export type ContactRequestedCallback = (eventData: RequestContactResponse) => void; +export type BiometricManagerUpdatedCallback = () => void; +export type BiometricAuthRequestedCallback = (eventData: { + isAuthenticated: boolean; + biometricToken?: string; +}) => void; +export type BiometricTokenUpdatedCallback = (eventData: { isUpdated: boolean }) => void; +export type FullscreenChangedCallback = () => void; +export type FullscreenFailedCallback = (eventData: { + error: "UNSUPPORTED" | "ALREADY_FULLSCREEN"; +}) => void; +export type HomeScreenAddedCallback = () => void; +export type HomeScreenCheckedCallback = (eventData: { + status: "unsupported" | "unknown" | "added" | "missed"; +}) => void; +export type AccelerometerStartedCallback = () => void; +export type AccelerometerStoppedCallback = () => void; +export type AccelerometerChangedCallback = () => void; +export type AccelerometerFailedCallback = (eventData: { error: "UNSUPPORTED" }) => void; +export type DeviceOrientationStartedCallback = () => void; +export type DeviceOrientationStoppedCallback = () => void; +export type DeviceOrientationChangedCallback = () => void; +export type DeviceOrientationFailedCallback = (eventData: { error: "UNSUPPORTED" }) => void; +export type GyroscopeStartedCallback = () => void; +export type GyroscopeStoppedCallback = () => void; +export type GyroscopeChangedCallback = () => void; +export type GyroscopeFailedCallback = (eventData: { error: "UNSUPPORTED" }) => void; +export type LocationManagerUpdatedCallback = () => void; +export type LocationRequestedCallback = (eventData: { locationData: LocationData }) => void; +export type ShareMessageSentCallback = () => void; +export type ShareMessageFailedCallback = (eventData: { + error: "UNSUPPORTED" | "MESSAGE_EXPIRED" | "MESSAGE_SEND_FAILED" | "USER_DECLINED" | "UNKNOWN_ERROR"; +}) => void; +export type EmojiStatusSetCallback = () => void; +export type EmojiStatusFailedCallback = (eventData: { + error: + | "UNSUPPORTED" + | "SUGGESTED_EMOJI_INVALID" + | "DURATION_INVALID" + | "USER_DECLINED" + | "SERVER_ERROR" + | "UNKNOWN_ERROR"; +}) => void; +export type EmojiStatusAccessRequestedCallback = (eventData: { + status: "allowed" | "cancelled"; +}) => void; +export type FileDownloadRequestedCallback = (eventData: { + status: "downloading" | "cancelled"; +}) => void; /** * Web Apps can adjust the appearance of the interface to match the Telegram * user's app in real time. This object contains the user's current theme * settings: */ -interface ThemeParams { +export interface ThemeParams { /** * Background color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-bg-color)`. @@ -414,48 +664,66 @@ interface ThemeParams { */ button_text_color?: string; /** - * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format. + * **Bot API 6.1+** + * + * Secondary background color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`. */ secondary_bg_color?: string; /** - * **Bot API 7.0+** Header background color in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Header background color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-header-bg-color)`. */ header_bg_color?: string; /** - * **Bot API 7.10+** Bottom background color in the #RRGGBB format. + * **Bot API 7.10+** + * + * Bottom background color in the #RRGGBB format. * Also available as the CSS variable var(--tg-theme-bottom-bar-bg-color). */ bottom_bar_bg_color?: string; /** - * **Bot API 7.0+** Accent text color in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Accent text color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-accent-text-color)`. */ accent_text_color?: string; /** - * **Bot API 7.0+** Background color for the section in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Background color for the section in the `#RRGGBB` format. * It is recommended to use this in conjunction with *secondary_bg_color*. * Also available as the CSS variable `var(--tg-theme-section-bg-color)`. */ section_bg_color?: string; /** - * **Bot API 7.0+** Header text color for the section in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Header text color for the section in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`. */ section_header_text_color?: `#${string}`; /** - * **Bot API 7.6+** Section separator color in the `#RRGGBB` format. + * **Bot API 7.6+** + * + * Section separator color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-section-separator-color)`. */ section_separator_color?: string; /** - * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Subtitle text color in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`. */ subtitle_text_color?: string; /** - * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB` format. + * **Bot API 7.0+** + * + * Text color for destructive actions in the `#RRGGBB` format. * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`. */ destructive_text_color?: string; @@ -464,7 +732,7 @@ interface ThemeParams { /** * This object describes the native popup. */ -interface PopupParams { +export interface PopupParams { /** * The text to be displayed in the popup title, 0-64 characters. */ @@ -483,12 +751,11 @@ interface PopupParams { /** * This object describes the native popup button. */ -type PopupButton = +export type PopupButton = & { /** - * Identifier of the button, 0-64 characters. Set to empty string by - * default. If the button is pressed, its id is returned in the callback - * and the popupClosed event. + * Identifier of the button, 0-64 characters. Set to empty string by default. + * If the button is pressed, its id is returned in the callback and the popupClosed event. */ id?: string; /** @@ -498,8 +765,7 @@ type PopupButton = * - `ok`, a button with the localized text “OK”, * - `close`, a button with the localized text “Close”, * - `cancel`, a button with the localized text “Cancel”, - * - `destructive`, a button with a style that indicates a destructive - * action (e.g. “Remove”, “Delete”, etc.). + * - `destructive`, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.). */ type?: "default" | "ok" | "close" | "cancel" | "destructive"; /** @@ -523,7 +789,7 @@ type PopupButton = * This object controls the back button, which can be displayed in the header of * the Web App in the Telegram interface. */ -interface BackButton { +export interface BackButton { /** * Shows whether the button is visible. Set to false by default. */ @@ -552,7 +818,7 @@ interface BackButton { * This object controls the main button, which is displayed at the bottom of the * Web App in the Telegram interface. */ -interface BottomButton { +export interface BottomButton { /** Current button text. Set to CONTINUE by default. */ text: string; /** Current button color. Set to themeParams.button_color by default. */ @@ -622,7 +888,7 @@ interface BottomButton { setParams(params: MainButtonParams): BottomButton; } -interface MainButtonParams { +export interface MainButtonParams { /** button text */ text?: string; /** button color */ @@ -643,30 +909,35 @@ interface MainButtonParams { * This object controls the Settings item in the context menu of the Mini App in * the Telegram interface. */ -interface SettingsButton { +export interface SettingsButton { /** * Shows whether the context menu item is visible. Set to false by default. */ isVisible: boolean; /** - * **Bot API 7.0+** A method that sets the press event handler for the - * Settings item in the context menu. An alias for - * `Telegram.WebApp.onEvent('settingsButtonClicked', callback)` + * **Bot API 7.0+** + * + * A method that sets the press event handler for the Settings item in the context menu. + * An alias for `Telegram.WebApp.onEvent('settingsButtonClicked', callback)` */ onClick(callback: () => void): SettingsButton; /** - * **Bot API 7.0+** A method that removes the press event handler from the - * Settings item in the context menu. An alias for - * `Telegram.WebApp.offEvent('settingsButtonClicked', callback)` + * **Bot API 7.0+** + * + * A method that removes the press event handler from the Settings item in the context menu. + * An alias for `Telegram.WebApp.offEvent('settingsButtonClicked', callback)` */ offClick(callback: () => void): SettingsButton; /** - * **Bot API 7.0+** A method to make the Settings item in the context menu - * visible. + * **Bot API 7.0+** + * + * A method to make the Settings item in the context menu visible. */ show(): SettingsButton; /** - * **Bot API 7.0+** A method to hide the Settings item in the context menu. + * **Bot API 7.0+** + * + * A method to hide the Settings item in the context menu. */ hide(): SettingsButton; } @@ -674,7 +945,7 @@ interface SettingsButton { /** * This object controls haptic feedback. */ -interface HapticFeedback { +export interface HapticFeedback { /** * A method tells that an impact occurred. The Telegram app may play the * appropriate haptics based on style value passed. Style can be one of @@ -706,7 +977,7 @@ interface HapticFeedback { selectionChanged(): void; } -interface CloudStorage { +export interface CloudStorage { /** * A method that stores a value in the cloud storage using the specified * key. @@ -783,18 +1054,18 @@ interface CloudStorage { getKeys(callback?: CloudStorageGetKeysCallback): CloudStorage; } -type CloudStorageSetItemCallback = (error: string | null, success: null | true) => void; -type CloudStorageGetItemCallback = (error: string | null, value: null | string) => void; -type CloudStorageGetItemsCallback = (error: string | null, values: null | Record) => void; -type CloudStorageRemoveItemCallback = (error: string | null, success: null | true) => void; -type CloudStorageRemoveItemsCallback = (error: string | null, success: null | true) => void; -type CloudStorageGetKeysCallback = (error: string | null, keys: null | string[]) => void; +export type CloudStorageSetItemCallback = (error: string | null, success: null | true) => void; +export type CloudStorageGetItemCallback = (error: string | null, value: null | string) => void; +export type CloudStorageGetItemsCallback = (error: string | null, values: null | Record) => void; +export type CloudStorageRemoveItemCallback = (error: string | null, success: null | true) => void; +export type CloudStorageRemoveItemsCallback = (error: string | null, success: null | true) => void; +export type CloudStorageGetKeysCallback = (error: string | null, keys: null | string[]) => void; /** * This object controls biometrics on the device. Before the first use of this * object, it needs to be initialized using the init method. */ -interface BiometricManager { +export interface BiometricManager { /** * Shows whether biometrics object is initialized. */ @@ -855,21 +1126,15 @@ interface BiometricManager { * * If so, the second argument will be a biometric token. */ - authenticate: ( - params: BiometricAuthenticateParams, - callback?: BiometricAuthenticateCallback, - ) => BiometricManager; + authenticate: (params: BiometricAuthenticateParams, callback?: BiometricAuthenticateCallback) => BiometricManager; /** - * A method that updates the biometric token in secure storage on the - * device. To remove the token, pass an empty string. If an optional - * callback parameter was passed, the callback function will be called and - * the first argument will be a boolean indicating whether the token was - * updated. + * A method that updates the biometric token in secure storage on the device. + * To remove the token, pass an empty string. + * If an optional callback parameter was passed, + * the callback function will be called + * and the first argument will be a boolean indicating whether the token was updated. */ - updateBiometricToken: ( - token: string, - callback?: BiometricUpdateBiometricTokenCallback, - ) => BiometricManager; + updateBiometricToken: (token: string, callback?: (success: boolean) => void) => BiometricManager; /** * A method that opens the biometric access settings for bots. Useful when * you need to request biometrics access to users who haven't granted it @@ -882,15 +1147,14 @@ interface BiometricManager { openSettings: () => BiometricManager; } -type BiometricRequestAccessCallback = (isAccessGranted: boolean) => void; -type BiometricAuthenticateCallback = (isAuthenticated: boolean, biometricToken?: string) => void; -type BiometricUpdateBiometricTokenCallback = (applied: boolean) => void; +export type BiometricRequestAccessCallback = (isAccessGranted: boolean) => void; +export type BiometricAuthenticateCallback = (isAuthenticated: boolean, biometricToken?: string) => void; /** * This object describes the native popup for requesting permission to use * biometrics. */ -interface BiometricRequestAccessParams { +export interface BiometricRequestAccessParams { /** * The text to be displayed to a user in the popup describing why the bot * needs access to biometrics, 0-128 characters. @@ -902,7 +1166,7 @@ interface BiometricRequestAccessParams { * This object describes the native popup for authenticating the user using * biometrics. */ -interface BiometricAuthenticateParams { +export interface BiometricAuthenticateParams { /** * The text to be displayed to a user in the popup describing why you are * asking them to authenticate and what action you will be taking based on @@ -915,7 +1179,7 @@ interface BiometricAuthenticateParams { * This object contains data that is transferred to the Web App when it is * opened. It is empty if the Web App was launched from a keyboard button. */ -interface WebAppInitData { +export interface WebAppInitData { /** * A unique identifier for the Web App session, required for sending * messages via the answerWebAppQuery method. @@ -970,7 +1234,7 @@ interface WebAppInitData { } /** This object contains the data of the Web App user. */ -interface WebAppUser { +export interface WebAppUser { /** * A unique identifier for the user or bot. This number may have more than * 32 significant bits and some programming languages may have @@ -1005,7 +1269,7 @@ interface WebAppUser { /** * This object represents a chat. */ -interface WebAppChat { +export interface WebAppChat { /** * Unique identifier for this chat. This number may have more than 32 * significant bits and some programming languages may have @@ -1035,7 +1299,7 @@ interface WebAppChat { /** * This object describes the native popup for scanning QR codes. */ -interface ScanQrPopupParams { +export interface ScanQrPopupParams { /** * The text to be displayed under the 'Scan QR' heading, 0-64 characters. */ @@ -1046,7 +1310,7 @@ interface ScanQrPopupParams { * This object describes contact information shared when requestContact was * approved by the user. */ -interface RequestContactResponseSent { +export interface RequestContactResponseSent { /** Status 'sent' indicates that contact information has been shared. */ status: "sent"; /** A status message or result as a string. */ @@ -1076,17 +1340,17 @@ interface RequestContactResponseSent { /** * This object only contains a status to indicate the cancellation. */ -interface RequestContactResponseCancelled { +export interface RequestContactResponseCancelled { /** Status 'cancelled', indicates that user cancelled the contact share * request. */ status: "cancelled"; } -type RequestContactResponse = RequestContactResponseSent | RequestContactResponseCancelled; +export type RequestContactResponse = RequestContactResponseSent | RequestContactResponseCancelled; /** This object describes additional sharing settings for the native story * editor. */ -interface StoryShareParams { +export interface StoryShareParams { /** The caption to be added to the media, 0-200 characters for regular users * and 0-2048 characters for premium subscribers. */ text?: string; @@ -1096,9 +1360,412 @@ interface StoryShareParams { } /** This object describes a widget link to be included in the story. */ -interface StoryWidgetLink { +export interface StoryWidgetLink { /** The URL to be included in the story. */ url: string; /** The name to be displayed for the widget link, 0-48 characters. */ name?: string; } + +export interface LocationData { + /** + * Latitude in degrees. + */ + latitude: number; + /** + * Longitude in degrees. + */ + longitude: number; + /** + * Altitude above sea level in meters. null if altitude data is not available on the device. + */ + altitude: number | null; + /** + * The direction the device is moving in degrees (0 = North, 90 = East, 180 = South, 270 = West). + * null if course data is not available on the device. + */ + course: number | null; + /** + * The speed of the device in m/s. null if speed data is not available on the device. + */ + speed: number | null; + /** + * Accuracy of the latitude and longitude values in meters. + * null if horizontal accuracy data is not available on the device. + */ + horizontal_accuracy: number | null; + /** + * Accuracy of the altitude value in meters. + * null if vertical accuracy data is not available on the device. + */ + vertical_accuracy: number | null; + /** + * Accuracy of the course value in degrees. + * null if course accuracy data is not available on the device. + */ + course_accuracy: number | null; + /** + * Accuracy of the speed value in m/s. + * null if speed accuracy data is not available on the device. + */ + speed_accuracy: number | null; +} + +export interface EmojiStatusParams { + /** + * Optional. The duration for which the status will remain set, in seconds. + */ + duration?: number; +} + +export interface DownloadFileParams { + /** + * The HTTPS URL of the file to be downloaded. + */ + url: string; + /** + * The suggested name for the downloaded file. + */ + file_name: string; +} + +export interface SafeAreaInset { + /** + * The top inset in pixels, representing the space to avoid at the top of the screen. + * Also available as the CSS variable var(--tg-safe-area-inset-top). + */ + top: number; + /** + * The bottom inset in pixels, representing the space to avoid at the bottom of the screen. + * Also available as the CSS variable var(--tg-safe-area-inset-bottom). + */ + bottom: number; + /** + * The left inset in pixels, representing the space to avoid on the left side of the screen. + * Also available as the CSS variable var(--tg-safe-area-inset-left). + */ + left: number; + /** + * The right inset in pixels, representing the space to avoid on the right side of the screen. + * Also available as the CSS variable var(--tg-safe-area-inset-right). + */ + right: number; +} + +export interface ContentSafeAreaInset { + /** + * The top inset in pixels, representing the space to avoid at the top of the content area. + * Also available as the CSS variable var(--tg-content-safe-area-inset-top). + */ + top: number; + /** + * The bottom inset in pixels, representing the space to avoid at the bottom of the content area. + * Also available as the CSS variable var(--tg-content-safe-area-inset-bottom). + */ + bottom: number; + /** + * The left inset in pixels, representing the space to avoid on the left side of the content area. + * Also available as the CSS variable var(--tg-content-safe-area-inset-left). + */ + left: number; + /** + * The right inset in pixels, representing the space to avoid on the right side of the content area. + * Also available as the CSS variable var(--tg-content-safe-area-inset-right). + */ + right: number; +} + +export interface Accelerometer { + /** + * Indicates whether accelerometer tracking is currently active. + */ + isStarted: boolean; + /** + * The current acceleration in the X-axis, measured in m/s². + */ + x: number; + /** + * The current acceleration in the Y-axis, measured in m/s². + */ + y: number; + /** + * The current acceleration in the Z-axis, measured in m/s². + */ + z: number; + /** + * **Bot API 8.0+** + * + * Starts tracking accelerometer data using params of type AccelerometerStartParams. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating whether tracking was successfully started. + */ + start: (params: AccelerometerStartParams, callback?: (success: boolean) => void) => Accelerometer; + /** + * **Bot API 8.0+** + * + * Stops tracking accelerometer data. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating + * whether tracking was successfully stopped. + */ + stop: (callback?: (success: boolean) => void) => Accelerometer; +} + +export interface AccelerometerStartParams { + /** + * Optional. + * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. + * Set to 1000 by default. Note that refresh_rate may not be supported on all platforms, + * so the actual tracking frequency may differ from the specified value. + */ + refresh_rate?: number; +} + +export interface DeviceOrientation { + /** + * Indicates whether device orientation tracking is currently active. + */ + isStarted: boolean; + /** + * A boolean that indicates whether or not the device is providing orientation data in absolute values. + */ + absolute: boolean; + /** + * The rotation around the Z-axis, measured in radians. + */ + alpha: number; + /** + * The rotation around the X-axis, measured in radians. + */ + beta: number; + /** + * The rotation around the Y-axis, measured in radians. + */ + gamma: number; + /** + * **Bot API 8.0+** + * + * Starts tracking device orientation data using params of type DeviceOrientationStartParams. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating whether tracking was successfully started. + */ + start: (params: DeviceOrientationStartParams, callback?: (success: boolean) => void) => DeviceOrientation; + /** + * **Bot API 8.0+** + * + * Stops tracking device orientation data. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating whether tracking was successfully stopped. + */ + stop: (callback?: (success: boolean) => void) => DeviceOrientation; +} + +export interface DeviceOrientationStartParams { + /** + * Optional. + * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. + * Set to 1000 by default. Note that refresh_rate may not be supported on all platforms, + * so the actual tracking frequency may differ from the specified value. + */ + refresh_rate?: number; + /** + * Optional. + * Pass true to receive absolute orientation data, + * allowing you to determine the device's attitude relative to magnetic north. + * Use this option if implementing features like a compass in your app. + * If relative data is sufficient, pass false. Set to false by default. + * + * Note: Keep in mind that some devices may not support absolute orientation data. + * In such cases, you will receive relative data even if need_absolute=true is passed. + * Check the DeviceOrientation.absolute parameter to determine whether the data provided is absolute or relative. + */ + need_absolute?: boolean; +} + +export interface Gyroscope { + /** + * Indicates whether gyroscope tracking is currently active. + */ + isStarted: boolean; + /** + * The current rotation rate around the X-axis, measured in rad/s. + */ + x: number; + /** + * The current rotation rate around the Y-axis, measured in rad/s. + */ + y: number; + /** + * The current rotation rate around the Z-axis, measured in rad/s. + */ + z: number; + /** + * **Bot API 8.0+** + * + * Starts tracking gyroscope data using params of type GyroscopeStartParams. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating whether tracking was successfully started. + */ + start: (params: GyroscopeStartParams, callback?: (success: boolean) => void) => Gyroscope; + /** + * **Bot API 8.0+** + * + * Stops tracking gyroscope data. + * If an optional callback parameter is provided, + * the callback function will be called with a boolean indicating whether tracking was successfully stopped. + */ + stop: (callback?: (success: boolean) => void) => Gyroscope; +} + +export interface GyroscopeStartParams { + /** + * Optional. + * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. + * Set to 1000 by default. Note that refresh_rate may not be supported on all platforms, + * so the actual tracking frequency may differ from the specified value. + */ + refresh_rate?: number; +} + +export interface LocationManager { + /** + * Shows whether the LocationManager object has been initialized. + */ + isInited: boolean; + /** + * Shows whether location services are available on the current device. + */ + isLocationAvailable: boolean; + /** + * Shows whether permission to use location has been requested. + */ + isAccessRequested: boolean; + /** + * Shows whether permission to use location has been granted. + */ + isAccessGranted: boolean; + /** + * Bot API 8.0+ + * + * A method that initializes the LocationManager object. + * It should be called before the object's first use. + * If an optional callback parameter is provided, + * the callback function will be called when the object is initialized. + */ + init: (callback?: () => void) => LocationManager; + /** + * **Bot API 8.0+** + * + * A method that requests location data. + * The callback function will be called with null as the first argument + * if access to location was not granted, + * or an object of type LocationData as the first argument if access was successful. + */ + getLocation: (callback: (locationData: LocationData | null) => void) => LocationManager; + /** + * **Bot API 8.0+** + * + * A method that opens the location access settings for bots. + * Useful when you need to request location access from users who haven't granted it yet. + * + * Note that this method can be called only in response to user interaction with the Mini App interface + * (e.g., a click inside the Mini App or on the main button). + */ + openSettings: () => LocationManager; +} + +export interface DeviceStorage { + /** + * Bot API 9.0+ + * + * A method that stores a value in the device's local storage using the specified key. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. + * In case of success, the first argument will be null and the second argument will be a boolean + * indicating whether the value was stored. + */ + setItem: (key: string, value: string, callback?: (error: string | null, success: boolean) => void) => DeviceStorage; + /** + * Bot API 9.0+ + * + * A method that receives a value from the device's local storage using the specified key. + * In case of an error, the callback function will be called and the first argument will contain the error. + * In case of success, the first argument will be null and the value will be passed as the second argument. + */ + getItem: (key: string, callback?: (error: string | null, item: string) => void) => DeviceStorage; + /** + * Bot API 9.0+ + * + * A method that removes a value from the device's local storage using the specified key. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. + * In case of success, the first argument will be null + * and the second argument will be a boolean indicating whether the value was removed. + */ + removeItem: (key: string, callback?: (error: string | null, success: boolean) => void) => DeviceStorage; + /** + * Bot API 9.0+ + * + * A method that clears all keys previously stored by the bot in the device's local storage. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. + * In case of success, the first argument will be null + * and the second argument will be a boolean indicating whether all values were removed. + */ + clear: (callback?: (error: string | null, success: boolean) => void) => DeviceStorage; +} + +export interface SecureStorage { + /** + * Bot API 9.0+ + * + * A method that stores a value in the device's secure storage using the specified key. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. + * In case of success, the first argument will be null + * and the second argument will be a boolean indicating whether the value was stored. + */ + setItem: (key: string, value: string, callback?: (error: string | null, success: boolean) => void) => SecureStorage; + /** + * Bot API 9.0+ + * + * A method that receives a value from the device's secure storage using the specified key. + * In case of an error, the callback function will be called and the first argument will contain the error. + * In case of success, the first argument will be null and the value will be passed as the second argument. + * If the key was not found, the second argument will be null, + * and the third argument will be a boolean indicating whether the key can be restored from the current device. + */ + getItem: ( + key: string, + callback?: (error: string | null, item: string | null, restorable: boolean) => void, + ) => SecureStorage; + /** + * Bot API 9.0+ + * + * Attempts to restore a key that previously existed on the current device. + * When called, the user will be asked for permission to restore the value. + * If the user declines or an error occurs, the first argument in the callback will contain the error. + * If restored successfully, the first argument will be null and the second argument will contain the restored value. + */ + restoreItem: (key: string, callback?: (error: string | null, item: string) => void) => SecureStorage; + /** + * Bot API 9.0+ + * + * A method that removes a value from the device's secure storage using the specified key. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. + * In case of success, the first argument will be null + * and the second argument will be a boolean indicating whether the value was removed. + */ + removeItem: (key: string, callback?: (error: string | null, success: boolean) => void) => SecureStorage; + /** + * Bot API 9.0+ + * + * A method that clears all keys previously stored by the bot in the device's secure storage. + * If an optional callback parameter was passed, the callback function will be called. + * In case of an error, the first argument will contain the error. In case of success, + * the first argument will be null + * and the second argument will be a boolean indicating whether all values were removed. + */ + clear: (callback?: (error: string | null, success: boolean) => void) => SecureStorage; +} diff --git a/types/telegram-web-app/package.json b/types/telegram-web-app/package.json index 4e738011ff315d..6e079b07cc7638 100644 --- a/types/telegram-web-app/package.json +++ b/types/telegram-web-app/package.json @@ -1,12 +1,10 @@ { "private": true, "name": "@types/telegram-web-app", - "version": "7.10.9999", + "version": "9.0.9999", "nonNpm": "conflict", "nonNpmDescription": "telegram-web-app", - "projects": [ - "https://telegram.org/js/telegram-web-app.js" - ], + "projects": ["https://telegram.org/js/telegram-web-app.js"], "devDependencies": { "@types/telegram-web-app": "workspace:." }, diff --git a/types/telegram-web-app/telegram-web-app-tests.ts b/types/telegram-web-app/telegram-web-app-tests.ts index 442789777984d7..b0aeedd3de9c13 100644 --- a/types/telegram-web-app/telegram-web-app-tests.ts +++ b/types/telegram-web-app/telegram-web-app-tests.ts @@ -116,3 +116,11 @@ app.shareToStory("url", { app.openInvoice("url", (status: "paid" | "cancelled" | "failed" | "pending") => { const test = status; // $ExpectType "paid" | "cancelled" | "failed" | "pending" }); + +app.Accelerometer.isStarted; // $ExpectType boolean + +app.isActive; // $ExpectType boolean + +app.isFullscreen; // $ExpectType boolean + +app.isOrientationLocked; // $ExpectType boolean