diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6e8c1d6481a7da..013a465116b01f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -139,7 +139,7 @@ jobs: id: suggestions-dir run: echo "path=$(node ./scripts/get-suggestions-dir.js)" >> "$GITHUB_OUTPUT" - - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: path: ${{ steps.suggestions-dir.outputs.path }} merge-multiple: true diff --git a/.github/workflows/UpdateCodeowners.yml b/.github/workflows/UpdateCodeowners.yml index 9a0bf84b71169b..3f41aaddc2afab 100644 --- a/.github/workflows/UpdateCodeowners.yml +++ b/.github/workflows/UpdateCodeowners.yml @@ -32,7 +32,7 @@ jobs: - run: pnpm run update-codeowners - - uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0 + - uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0 with: commit_author: 'TypeScript Bot ' commit_message: '🀖 Update CODEOWNERS' diff --git a/.github/workflows/format-and-commit.yml b/.github/workflows/format-and-commit.yml index f0f0f4264e1a00..f85e73985f66bf 100644 --- a/.github/workflows/format-and-commit.yml +++ b/.github/workflows/format-and-commit.yml @@ -40,7 +40,7 @@ jobs: - run: pnpm dprint fmt - - uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0 + - uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0 with: commit_author: 'TypeScript Bot ' commit_message: '🀖 dprint fmt' diff --git a/.github/workflows/support-window.yml b/.github/workflows/support-window.yml index d66d1baf2e2eeb..3c21bfff9db6e5 100644 --- a/.github/workflows/support-window.yml +++ b/.github/workflows/support-window.yml @@ -43,7 +43,7 @@ jobs: - name: Make SVG diagram run: node --experimental-json-modules scripts/support-window > docs/support-window.svg - - uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0 + - uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0 with: commit_author: 'TypeScript Bot ' commit_message: '🀖 Update support window' diff --git a/README.fr.md b/README.fr.md index 8f2c5e824497e5..dcb171d8c3bc67 100644 --- a/README.fr.md +++ b/README.fr.md @@ -17,10 +17,10 @@ Au minimum, vous voudriez peut-être faire un `git clean -fdx` sur le dépÃŽt (o Cette section permet de suivre l'état de santé du référentiel et du processus de publication. Elle peut être utile aux contributeurs qui rencontrent des problÚmes avec leurs PR et leurs packages. -- DerniÚre version [type-checked/linted](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) proprement : [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) -- Tous les packages passent la vérification des types et du linter : [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) -- Tous les packages ont été [publié sur npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) en moins d'une heure et demie : [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) -- [typescript-bot](https://github.com/typescript-bot) a été actif sur Definitely Typed [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) +- DerniÚre version [type-checked/linted](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) proprement: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- Tous les packages passent la vérification des types et du linter: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- Tous les packages ont été [publié sur npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) en moins d'une heure et demie: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- [typescript-bot](https://github.com/typescript-bot) a été actif sur Definitely Typed: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - [Mise à jour de l'état de l'infrastructure](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) actuel Si quelque chose semble incorrect ou si l'un des éléments ci-dessus échoue, merci de nous le faire savoir dans [le canal Definitely Typed sur le serveur Discord de la Communauté TypeScript](https://discord.gg/typescript). diff --git a/README.it.md b/README.it.md index c95f4888a31c8c..de4cb7dff74546 100644 --- a/README.it.md +++ b/README.it.md @@ -11,10 +11,10 @@ _Link per il [manuale dell'amministratore](./docs/admin.md)_ Questa sezione tiene traccia della salute della repository e dello stato di pubblicazione. Può tornare utile per i contributori che stanno avendo problemi con le loro PR e package. -- Ultima build [type-checked/linted](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) pulita: [![Build Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- Tutti i package sono sottoposti a controllo dei tipi e linting con typescript@next: [![Build status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- Tutti i package vengono [pubblicati su npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) in meno di un'ora e mezza: [![Publish Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- Il [bot di Typescript](https://github.com/typescript-bot) Ú stato attivo su Definitely Typed [![Activity Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- Ultima build [type-checked/linted](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) pulita: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- Tutti i package sono sottoposti a controllo dei tipi e linting con typescript@next: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- Tutti i package vengono [pubblicati su npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) in meno di un'ora e mezza: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- Il [bot di Typescript](https://github.com/typescript-bot) Ú stato attivo su Definitely Typed: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - [Aggiornamenti dello stato dell'infrastruttura](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) attuale Se qualcosa sembra sbagliato o una qualunque delle cose qui in alto fallisce, fatecelo sapere [sul canale di Definitely Typed nel server discord della comunità di Typescript](https://discord.gg/typescript): diff --git a/README.ja.md b/README.ja.md index afb7522f0171fc..00c147ac89d915 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,6 +1,6 @@ # Definitely Typed -> 高品質な TypeScript の型定矩甚レポゞトリ +> 高品質な TypeScript の型定矩甚リポゞトリ _この README は[英語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md)・[スペむン語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md)・[韓囜語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md)・[ロシア語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md)・[䞭囜語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.zh-Hans.md)・[ポルトガル語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.pt.md)・[むタリア語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.it.md)でも閲芧できたす_ @@ -8,13 +8,13 @@ _[管理マニュアルぞのリンク](./docs/admin.md)_ ## 珟圚のステヌタス -このセクションではレポゞトリず公開プロセスの皌働状況を远跡できたす。 +このセクションではリポゞトリず公開プロセスの皌働状況を远跡できたす。 PR やパッケヌゞに䜕か䞍具合がある堎合は、これらが圹に立぀かもしれたせん。 -- 盎近のビルドの[型チェックず Lint](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) が正垞終了したか: [![Build Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- 次バヌゞョンの TypeScript 䞊で党パッケヌゞの型チェックず Lint が正垞終了したか: [![Build status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- 1時間以内に党パッケヌゞが [npm に公開](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher)されおいるか: [![Publish Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- Definitely Typed 䞊で [typescript-bot](https://github.com/typescript-bot) がアクティブかどうか: [![Activity Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- 盎近のビルドの[型チェックず Lint](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) が正垞終了したか: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- 次バヌゞョンの TypeScript 䞊で党パッケヌゞの型チェックず Lint が正垞終了したか: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- 1時間以内に党パッケヌゞが [npm に公開](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher)されおいるか: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- Definitely Typed 䞊で [typescript-bot](https://github.com/typescript-bot) がアクティブかどうか: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - 珟圚の[運甚基盀のステヌタス曎新](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) 掲茉されおいるもので䜕かが正垞ではなかったり、結果が倱敗になっおいるものがある堎合は、 [TypeScript コミュニティの Discord サヌバヌの Definitely Typed のチャンネル](https://discord.gg/typescript)たでご連絡ください。 @@ -56,7 +56,7 @@ npm install --save-dev @types/node 叀いバヌゞョンの TypeScript `@types` パッケヌゞには、サポヌトする TypeScript のバヌゞョンを明瀺的に指定するタグがあるため、倚くの堎合はサポヌト期間倖のバヌゞョン甚のパッケヌゞでも入手できたす。 -たずえば、 `npm dist-tags @types/react` を実行するず、 TypeScript 2.5 なら react@16.0 の、 TypeScript 2.6 や 2.7 なら react@16.4 の型定矩がそれぞれ利甚できるこずが確認できたす。 +䟋えば、 `npm dist-tags @types/react` を実行するず、 TypeScript 2.5 なら react@16.0 の、 TypeScript 2.6 や 2.7 なら react@16.4 の型定矩がそれぞれ利甚できるこずを確認できたす。 | タグ | バヌゞョン | | ------ | ---------- | @@ -70,9 +70,9 @@ npm install --save-dev @types/node #### TypeScript 1.xç³» -- このレポゞトリの `master` ブランチから手動でダりンロヌドしお、開発しおいるプロゞェクトに配眮しおください。 +- このリポゞトリの `master` ブランチから手動でダりンロヌドしお、開発しおいるプロゞェクトに配眮しおください。 - ~~[Typings](https://github.com/typings/typings)~~ Typings は非掚奚になったので、他の方匏を䜿甚するこず -- ~~[NuGet](https://nuget.org/packages?q=DefinitelyTyped)~~ NuGet 䞊の DefinitelyTyped の公開は終了したので、他の方匏を䜿甚するこず +- ~~[NuGet](https://nuget.org/packages?q=DefinitelyTyped)~~ NuGet 䞊の Definitely Typed の公開は終了したので、他の方匏を䜿甚するこず 手動で[リファレンス](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html)を远加する必芁がありたす。 @@ -118,9 +118,9 @@ declare module "libname" { 倉曎・新芏䜜成したパッケヌゞを詊し終えたら、 Definitely Typed で共有したしょう。 -たず、このレポゞトリを[フォヌク](https://guides.github.com/activities/forking/)し、 [node](https://nodejs.org/) をむンストヌルし、 `npm install` を実行したす。 +たず、このリポゞトリを[フォヌク](https://guides.github.com/activities/forking/)し、 [node](https://nodejs.org/) をむンストヌルし、 `npm install` を実行したす。 -DefinitelyTyped ぞの倧量の PR を党おセルフサヌビス方匏で凊理するために bot を導入しおいたす。詳しい方法ず理由に぀いおは[こちら](https://devblogs.microsoft.com/typescript/changes-to-how-we-manage-definitelytyped/)英語で確認できたす。䞋図は DefinitelyTyped ぞの PR のラむフサむクルを簡単に瀺したものです。 +Definitely Typed ぞの倧量の PR を党おセルフサヌビス方匏で凊理するために bot を導入しおいたす。詳しい方法ず理由に぀いおは[こちら](https://devblogs.microsoft.com/typescript/changes-to-how-we-manage-definitelytyped/)英語で確認できたす。䞋図は Definitely Typed ぞの PR のラむフサむクルを簡単に瀺したものです。 @@ -133,7 +133,7 @@ DefinitelyTyped ぞの倧量の PR を党おセルフサヌビス方匏で凊理 自分に関連する型パッケヌゞのみを含む、より管理しやすいクロヌンを䜜成するには、gitの [`sparse-checkout`](https://git-scm.com/docs/git-sparse-checkout)、[`--filter`](https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterltfilter-specgt)、および [`--depth`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt) の機胜を䜿甚できたす。これにより、クロヌン時間が短瞮され、gitのパフォヌマンスが向䞊したす。 -> :warning: これには最小限の[gitバヌゞョン2.27.0](https://git-scm.com/downloads)が必芁ですが、これはほずんどのマシンのデフォルトよりも新しいバヌゞョンです。より耇雑な手順が叀いバヌゞョンで利甚可胜ですが、このガむドではカバヌされおいたせん。 +> :warning: これには[gitバヌゞョン2.27.0](https://git-scm.com/downloads)以䞊である必芁がありたすが、これはほずんどのマシンのデフォルトよりも新しいバヌゞョンです。より耇雑な手順により叀いバヌゞョンでも利甚可胜ですが、このガむドではカバヌされおいたせん。 1. `git clone --sparse --filter=blob:none --depth=1 ` - `--sparse` はスパヌスチェックアりトファむルを初期化し、ワヌキングディレクトリがリポゞトリのルヌトにあるファむルのみで開始されたす。 @@ -158,7 +158,7 @@ DefinitelyTyped ぞの倧量の PR を党おセルフサヌビス方匏で凊理 もし、あなたがラむブラリの䜜者で、そのラむブラリが TypeScript で曞かれおいる堎合は、 Definitely Typed で型定矩を公開するのではなく、ラむブラリのパッケヌゞ自䜓に[自動生成された型定矩ファむルをバンドル](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)しおください。 npm のパッケヌゞに型定矩を远加する堎合は、パッケヌゞず同名でディレクトリを䜜成しおください。 -npm 䞊にないパッケヌゞの型定矩を远加したい堎合は、その名前が npm 䞊のパッケヌゞを競合しないか確認しおください。 +npm 䞊にないパッケヌゞの型定矩を远加したい堎合は、その名前が npm 䞊のパッケヌゞず競合しないか確認しおください。 `npm info ` コマンドで、 `` パッケヌゞが存圚するかどうか確認できたす。 型定矩パッケヌゞは次のような構造にする必芁がありたす: @@ -182,16 +182,16 @@ Definitely Typed のメンバヌは垞に新しい PR をチェックしおい パッケヌゞに型定矩が[バンドル](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)されおいる堎合、混乱を避けるために Definitely Typed 偎の型定矩は削陀したす。 -`pnpm run not-needed -- []` を実行するずパッケヌゞを削陀できたす。. +`pnpm run not-needed -- []` を実行するずパッケヌゞを削陀できたす。 - ``: 削陀したいディレクトリ名。 -- ``: `@types/` に察しおスタブstubを公開したいバヌゞョン。珟圚公開䞭のバヌゞョンより新しく、か぀ npm 䞊の `` のバヌゞョンずあわせる必芁がありたす。 +- ``: `@types/` に察しおスタブstubを公開したいバヌゞョン。珟圚公開䞭のバヌゞョンより新しく、か぀ npm 䞊の `` のバヌゞョンず合わせる必芁がありたす。 - ``: Definitely Typed 偎の型定矩の代わりずなる npm のパッケヌゞ名。基本的に `` ず䞀臎し、その堎合は省略できたす。 削陀されたパッケヌゞを参照しおいた、他の Definitely Typed 䞊のパッケヌゞは党お、ラむブラリにバンドルされおいる型定矩を参照するように曎新する必芁がありたす。 `pnpm run test-all` を実行した際の゚ラヌを参照するこずで、曎新が必芁なラむブラリのリストが確認できたす。 ゚ラヌを修正するには、 [`package.json`](#packagejson) を远加し、 `"dependencies": { "": "x.y.z" }` ず蚘述したす。 -たずえば䞋蚘のようになりたす: +䟋えば䞋蚘のようになりたす: ```json { @@ -216,8 +216,8 @@ Definitely Typed のメンバヌは垞に新しい PR をチェックしおい #### 呜名 -もし、npmパッケヌゞの型定矩を远加する堎合、同じ名前のディレクトリを䜜成しおください。 -もし、型定矩を远加するパッケヌゞがnpmに存圚しない堎合、遞択する名前がnpmのパッケヌゞ名ず競合しないこずを確認しおください。 +npmパッケヌゞの型定矩を远加する堎合、同じ名前のディレクトリを䜜成しおください。 +型定矩を远加するパッケヌゞがnpmに存圚しない堎合、遞択する名前がnpmのパッケヌゞ名ず競合しないこずを確認しおください。 `npm info ` を䜿甚しお `` パッケヌゞの存圚を確認できたす。 npmに存圚しないパッケヌゞが既存のnpmパッケヌゞず競合する堎合、名前の末尟に `-browser` を远加しお `-browser` を取埗しおみおください。 @@ -256,7 +256,7 @@ const result = twoslash("//") もしどこからテストコヌドを曞き始めればよいかわからないずきは、そのモゞュヌルの README に曞かれおるサンプルをテストするコヌドから始めるのがよいでしょう。 -レポゞトリのルヌトで `npm test <テストしたいパッケヌゞ名>` を実行するず、このコマンドはファむルが倉曎された状態でテストを実行するので、[倉曎を怜蚌](#テストの実行)するこずができたす。 +リポゞトリのルヌトで `npm test <テストしたいパッケヌゞ名>` を実行するず、このコマンドはファむルが倉曎された状態でテストを実行するので、[倉曎を怜蚌](#テストの実行)するこずができたす。 匏が䞎えられた型であるか確認するには `$ExpectType` を、コンパむル゚ラヌになるかを確認するには `@ts-expect-error` をそれぞれ䜿いたす。 䟋: @@ -309,7 +309,7 @@ const enum Enum { // eslint-disable-line no-const-enum > import Component from "./component"; > ``` > -> `index.d.ts` のむンポヌトのコンパむル時の有効性は、ナヌザヌが継承しないコンパむル蚭定に䟝存しおいるため、DefinitelyTypedでこのパタヌンを䜿甚するず、ナヌザヌに自分自身のコンパむル蚭定を倉曎させるこずが必芁になり、それがランタむム甚に正しくないかもしれたせん。代わりに、広範な、蚭定に䟝存しない互換性を確保するために、CJS゚クスポヌト甚のCJSむンポヌトを曞く必芁がありたす +> `index.d.ts` のむンポヌトのコンパむル時の有効性は、ナヌザヌが継承しないコンパむル蚭定に䟝存しおいるため、Definitely Typedでこのパタヌンを䜿甚するず、ナヌザヌに自分自身のコンパむル蚭定を倉曎させるこずが必芁になり、それがランタむム甚に正しくないかもしれたせん。代わりに、広範な、蚭定に䟝存しない互換性を確保するために、CJS゚クスポヌト甚のCJSむンポヌトを曞く必芁がありたす > > ```ts > // index.d.ts @@ -320,14 +320,14 @@ const enum Enum { // eslint-disable-line no-const-enum #### `package.json` 通垞、これは必芁ありたせん。 -DefinitelyTypedのパッケヌゞパブリッシャヌは、Definitely Typedの倖郚に䟝存しないパッケヌゞ甚に `package.json` を䜜成したす。 +Definitely Typedのパッケヌゞパブリッシャヌは、Definitely Typedの倖郚に䟝存しないパッケヌゞ甚に `package.json` を䜜成したす。 `package.json` は、他の `@types` パッケヌゞでない䟝存関係を指定するために含めるこずができたす。 [Pikadayが良い䟋です。](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json) 独自の `package.json` を曞く堎合でも、䟝存関係のみを指定できたす。 `"description"` などの他のフィヌルドは蚱可されおいたせん。 たた、䟝存関係を [蚱可されたパッケヌゞのリスト](https://github.com/microsoft/DefinitelyTyped-tools/blob/master/packages/definitions-parser/allowedPackageJsonDependencies.txt) に远加する必芁がありたす。 このリストは人間によっお曎新され、`@types` パッケヌゞが悪意のあるパッケヌゞに䟝存しないようにする機䌚を提䟛したす。 -たれなケヌスでは、`@types` パッケヌゞが削陀され、゜ヌスパッケヌゞによっお提䟛される型に眮き換えられ、か぀叀い削陀された `@types` パッケヌゞに䟝存する必芁がある堎合、`@types` パッケヌゞぞの䟝存関係を远加するこずができたす。 +皀なケヌスでは、`@types` パッケヌゞが削陀され、゜ヌスパッケヌゞによっお提䟛される型に眮き換えられ、か぀叀い削陀された `@types` パッケヌゞに䟝存する必芁がある堎合、`@types` パッケヌゞぞの䟝存関係を远加するこずができたす。 蚱可されたパッケヌゞのリストに远加する際に、人間のメンテナヌが䜕が起こっおいるかを理解できるように説明するこずを忘れないでください。 独自の package.json を䜜成する第二の理由は、ESモゞュヌルを指定するこずです。 @@ -340,11 +340,11 @@ DefinitelyTypedのパッケヌゞパブリッシャヌは、Definitely Typedの } ``` -これは、実装パッケヌゞのpackage.jsonに`exports`がある堎合にも適甚される。 +これは、実装パッケヌゞのpackage.jsonに`exports`がある堎合にも適甚されたす。 #### `OTHER_FILES.txt` -もしファむルが `index.d.ts` でテストされおいないし、参照されおいない堎合、それを `OTHER_FILES.txt` ずいうファむルに远加しおください。このファむルは、1行に1぀のファむルを含む、型定矩パッケヌゞに含める必芁のある他のファむルのリストです。 +もしファむルが `index.d.ts` でテストされおおらず、参照されおいない堎合、それを `OTHER_FILES.txt` ずいうファむルに远加しおください。このファむルは、1行に1぀のファむルを含む、型定矩パッケヌゞに含める必芁のある他のファむルのリストです。 #### よくある間違い @@ -366,7 +366,7 @@ DefinitelyTypedのパッケヌゞパブリッシャヌは、Definitely Typedの タむプパラメヌタが受け入れられる䟋: `function id(value: T): T;`。 タむプパラメヌタが受け入れられない䟋: `function parseJson(json: string): T;`。 䟋倖: `new Map()` は問題ありたせん。 -- 型 `Function` ず `Object` を䜿甚するのはほずんどの堎合良いアむデアではありたせん。99%の堎合、より具䜓的な型を指定できたす。関数の堎合は [(x: number) => number](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-type-expressions) など、オブゞェクトの堎合は `{ x: number, y: number }` を指定できたす。型に぀いお党く確実な情報がない堎合は、[`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) を遞択すべきです。型に぀いお唯䞀知られおいる情報が「䜕らかのオブゞェクトである」ずいう堎合は、型 [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type) を䜿甚し、`Object` や `{ [key: string]: any }` を䜿甚しないでください。 +- 型 `Function` ず `Object` を䜿甚するのはほずんどの堎合良いアむデアではありたせん。99%の堎合、より具䜓的な型を指定できたす。関数の堎合は [(x: number) => number](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-type-expressions) など、オブゞェクトの堎合は `{ x: number, y: number }` を指定できたす。型に぀いお確実な情報が党くない堎合は、[`any`](https://www.typescriptlang.org/docs/handbook/basic-types.html#any) を遞択すべきです。型に぀いお唯䞀知られおいる情報が「䜕らかのオブゞェクトである」ずいう堎合は、型 [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type) を䜿甚し、`Object` や `{ [key: string]: any }` を䜿甚しないでください。 - `var foo: string | any`: `any` がナニオン型で䜿甚される堎合、結果の型は䟝然ずしお `any` です。そのため、この型泚釈の `string` 郚分は有甚に芋えるかもしれたせんが、実際には単に `any` を䜿甚するよりも远加の型チェックを提䟛したせん。 意図に応じお、受け入れ可胜な代替手段は `any`、`string`、たたは `string | object` などが考えられたす。 @@ -400,7 +400,7 @@ Definitely TypedはGitHubで最もアクティブなリポゞトリの1぀です ## よくある質問 -#### 厳密には、このレポゞトリず npm 䞊の `@types` パッケヌゞはどう関係しおいたすか +#### 厳密には、このリポゞトリず npm 䞊の `@types` パッケヌゞはどう関係しおいたすか [DefinitelyTyped-tools](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) が、`master` ブランチの内容を自動的に、 npm の `@types` スコヌプに公開しおくれおいたす。 @@ -412,7 +412,7 @@ Definitely TypedはGitHubで最もアクティブなリポゞトリの1぀です > モゞュヌルの型定矩のみの倉曎で、察応するテストもきちんず倉曎されおいる PR は早くマヌゞされる -通䟋、型定矩ファむルのヘッダヌに茉っおいる著者が承認した PR はより早くマヌゞされたす。新しい型定矩の PR は、 DefinitelyTyped のメンテナヌからのレビュヌも必芁になるので時間がかかりたす。各 PR は TypeScript や DefinitelyTyped のチヌムメンバヌがマヌゞ前にレビュヌしたす。人為的芁因で遅れが発生する堎合があるので、しばらくお埅ちください。メンテナヌがオヌプンな PR を凊理しおいる間は、 [Pull Request Status Board](https://github.com/orgs/DefinitelyTyped/projects/1) で進捗を確認できたす。 +通䟋、型定矩ファむルのヘッダヌに茉っおいる著者が承認した PR はより早くマヌゞされたす。新しい型定矩の PR は、 Definitely Typed のメンテナヌからのレビュヌも必芁になるので時間がかかりたす。各 PR は TypeScript や Definitely Typed のチヌムメンバヌがマヌゞ前にレビュヌしたす。人為的芁因で遅れが発生する堎合があるので、しばらくお埅ちください。メンテナヌがオヌプンな PR を凊理しおいる間は、 [Pull Request Status Board](https://github.com/orgs/DefinitelyTyped/projects/1) で進捗を確認できたす。 #### 非垞に人気のあるプロゞェクトぞの倉曎を提出したい堎合、なぜ異なる扱いを受けるのですか @@ -448,7 +448,7 @@ npm パッケヌゞは数分で曎新されたす。もし1時間以䞊かかっ #### マッチするパッケヌゞがない型定矩はどうなるのですか -゜ヌスのJavaScriptコヌドがたったくない堎合、たずえばヘルパヌタむプや仕様のための型を䜜成しおいる堎合、それらの型はDefinitely Typedではなく、自分自身で公開すべきです。 +゜ヌスのJavaScriptコヌドが党くない堎合、䟋えばヘルパヌタむプや仕様のための型を䜜成しおいる堎合、それらの型はDefinitely Typedではなく、自分自身で公開すべきです。 なぜなら、`@types`パッケヌゞは既存のJavaScriptコヌドに察する型を提䟛するこずを意図しおおり、盎接むンポヌトされるこずを想定しおいないからです。 ぀たり、`import type { ... } from "@types/foo"`のように䜿甚されるDefinitely Typedパッケヌゞを䜜成すべきではありたせん。 たた、`foo`がむンストヌルされおいない堎合に`import type { ... } from "foo"`を曞くこずも期埅されおいたせん。 @@ -464,7 +464,7 @@ npm パッケヌゞは数分で曎新されたす。もし1時間以䞊かかっ > error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct -この゚ラヌは、同じ名前の空の名前空間を関数の宣蚀ず䞀緒におくこずで抑制できたすが、この慣䟋は避けるべきです。 +この゚ラヌは、同じ名前の空の名前空間を関数の宣蚀ず䞀緒に眮くこずで抑制できたすが、この慣䟋は避けるべきです。 この件に぀いおはよく [Stack Overflow の回答](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this)が匕甚されおいたす。 `import foo = require("foo");` 構文を䜿っおモゞュヌルをむンポヌトするほうが適切でしょう。 @@ -526,7 +526,7 @@ npm パッケヌゞでは、モゞュヌルを `node -p 'require("foo")'` でむ #### デフォルトでは TypeScript に存圚しない DOM API を远加したいです。 それは [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme) に含めるものかもしれないので、そちらの方針を確認しおください。 -該圓するりェブ暙準の仕様がただ草皿段階なら、このレポゞトリに含められたす。 +該圓するりェブ暙準の仕様がただ草皿段階なら、このリポゞトリに含められたす。 型定矩パッケヌゞ名は `dom-` から始たるようにし、型定矩ヘッダヌの "Project" リンクに仕様曞ぞのリンクを匵っおください。 仕様曞が草皿から脱するず、パッケヌゞは Definitely Typed から削陀され、察応する `@types` パッケヌゞは非掚奚ずなりたす。 @@ -615,7 +615,7 @@ TypeScript ハンドブックには、[型定矩を曞くにあたっおの䞀 型定矩ファむルがグロヌバルにも、むンポヌトされたモゞュヌルずしおも䜿甚できるかをテストするには、次のようにしたす。たず `test` フォルダを䜜成し、そこに `YourLibraryName-global.test.ts` ず `YourLibraryName-module.test.ts` の2぀のファむルを甚意したす。 _global_ テストファむルでは、りェブペヌゞ䞊でスクリプトずしお読み蟌たれ、ラむブラリがグロヌバル スコヌプで䜿甚可胜になるようにテストしたす — このずき、むンポヌト構文は䜿甚しおはいけたせん。 _module_ テストファむルでは、 `import` 構文などを䜿甚し、モゞュヌルずしおむンポヌトする方法に沿っおテストしたす。 `tsconfig.json` ファむル内で `files` プロパティを指定しおいる堎合は、䞡方をテストファむルを含めるのを忘れないでください。 `big.js` の型定矩での[実際のテストファむル](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test)も参考にしおください。 -䞡方のテストファむルで、型定矩に察する完党なテストを行う必芁はありたせん — _global_ テストファむルではグロヌバルな芁玠にアクセスできるかのみをテストし、 _module_ テストファむルで型定矩の完党なテストを行うたたはその逆パタヌンのでもかたいたせん。 +䞡方のテストファむルで、型定矩に察する完党なテストを行う必芁はありたせん — _global_ テストファむルではグロヌバルな芁玠にアクセスできるかのみをテストし、 _module_ テストファむルで型定矩の完党なテストを行うたたはその逆パタヌンのでも構いたせん。 #### スコヌプ付きパッケヌゞに぀いおはどうすればよいですか diff --git a/README.ko.md b/README.ko.md index c3676e933dc680..5d51f05f31567c 100644 --- a/README.ko.md +++ b/README.ko.md @@ -13,10 +13,10 @@ _[ꎀ늬자 섀명서](./docs/admin.md) 링크_ 저장소 및 퍌랔늬싱 곌정의 상태륌 표시합니닀. Ʞ여자분듀읎 작성한 PR 또는 팚킀지에 묞제가 발생했을 겜우 읎 표시륌 볎멎 도움읎 될 수 있습니닀. -- 최신 빌드가 [타입 첎크/며튾](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) 곌정을 깔끔하게 통곌했습니닀: [![Build Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- 몚든 팚킀지가 typescript@next상에서 타입 첎크/며튾 곌정을 깔끔하게 통곌합니닀: [![Build status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- 몚든 팚킀지가 1시간 낎에 [npm에 배포](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher)되었습니닀: [![Publish Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- [typescript-bot](https://github.com/typescript-bot)읎 Definitely Typed에서 잘 돌고 있습니닀 [![Activity Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- 최신 빌드가 [타입 첎크/며튾](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) 곌정을 깔끔하게 통곌했습니닀: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- 몚든 팚킀지가 typescript@next상에서 타입 첎크/며튾 곌정을 깔끔하게 통곌합니닀: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- 몚든 팚킀지가 1시간 낎에 [npm에 배포](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher)되었습니닀: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- [typescript-bot](https://github.com/typescript-bot)읎 Definitely Typed에서 잘 돌고 있습니닀: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) 상태 표시가 비정상읎거나 고장 표시가 발생하멎 [Definitely Typed Discord 채널](https://discord.gg/typescript)에서 읎 묞제륌 알렀죌섞요. diff --git a/README.md b/README.md index b62b8d7fb05fe2..18641b7e7f4389 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ It may be helpful for contributors experiencing any issues with their PRs and pa - Most recent build [type-checked/linted](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) cleanly: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) - All packages are type-checking/linting cleanly: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) - All packages are being [published to npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) in under an hour and a half: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) -- [typescript-bot](https://github.com/typescript-bot) has been active on Definitely Typed [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) +- [typescript-bot](https://github.com/typescript-bot) has been active on Definitely Typed: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - Current [infrastructure status updates](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) If anything here seems wrong or any of the above are failing, please let us know in [the Definitely Typed channel on the TypeScript Community Discord server](https://discord.gg/typescript). diff --git a/README.pt.md b/README.pt.md index bd7cf21fa01da3..2a1c53f3950526 100644 --- a/README.pt.md +++ b/README.pt.md @@ -14,10 +14,10 @@ _Link para o [manual do Admin](./docs/admin.md)_ Essa seção acompanha a saúde do respositório e o processo de publicação. Ela pode servir de ajuda para contribuidores que estejam passando por problemas com suas PRs e pacotes. -- Build mais recente com [tipagem checada/analisada pelo linter](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) de forma limpa: [![Build Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- Todos os pacotes tem seus tipos checados/são analisadas pelo linter no typescript@next: [![Build status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- Todos os pacotes estão sendo [publicados no npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) em menos de uma hora: [![Publish Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- [typescript-bot](https://github.com/typescript-bot) esteve ativo no Definitely Typed [![Activity Status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- Build mais recente com [tipagem checada/analisada pelo linter](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) de forma limpa: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- Todos os pacotes tem seus tipos checados/são analisadas pelo linter no typescript@next: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- Todos os pacotes estão sendo [publicados no npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) em menos de uma hora: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- [typescript-bot](https://github.com/typescript-bot) esteve ativo no Definitely Typed: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - [Atualizações do status da infraestrutura](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) atual Se algo aqui parece estar errado, ou se algum dos itens acima está falhando, por favor fale sobre este problema no [canal do Definitely Typed no Discord](https://discord.gg/typescript). diff --git a/README.ru.md b/README.ru.md index 01e82f27656ad3..4b2c29b6b2f5ef 100644 --- a/README.ru.md +++ b/README.ru.md @@ -13,10 +13,10 @@ _Вы также ЌПжете прПчОтать этПт README Ма [аМгл ЭтПт разЎел ПтслежОвает сПстПяМОе репПзОтПрОя О прПцесс публОкацОО. ЭтП ЌПжет быть пПлезМП Ўля участМОкПв, ОспытывающОх любые прПблеЌы с PR'аЌО О пакетаЌО. -- СаЌая пПслеЎМяя сбПрка [прПшла прПверку-тОпПв/лОМтОМг](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) пПлМПстью: [![Статус сбПркО](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- Все пакеты прПхПЎят прПверку-тОпПв/лОМтОМг пПлМПстью Ма `typescript@next`: [![Build status](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- Все пакеты [публОкуются Ма npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) в течеМОО часа: [![Статус публОкацОО](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- [typescript-bot](https://github.com/typescript-bot) прПявляет актОвМПсть Ма Definitely Typed [![Статус актОвМПстО](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- СаЌая пПслеЎМяя сбПрка [прПшла прПверку-тОпПв/лОМтОМг](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) пПлМПстью: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- Все пакеты прПхПЎят прПверку-тОпПв/лОМтОМг пПлМПстью Ма `typescript@next`: [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- Все пакеты [публОкуются Ма npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher) в течеМОО часа: [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- [typescript-bot](https://github.com/typescript-bot) прПявляет актОвМПсть Ма Definitely Typed: [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) ЕслО чтП-тП зЎесь кажется МеправОльМыЌ ОлО чтП-лОбП Оз вышеперечОслеММПгП Ме рабПтает, пПжалуйста, пПЎМОЌОте прПблеЌу Ма [каМале DefiniteTyped Discord](https://discord.gg/typescript). diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 70b460086d5cfb..5bdaf2416ecb1a 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -16,10 +16,10 @@ Definitely Typed 最近已蜬䞺正确的 `pnpm` monorepo(包含倚项目或暡 歀章节跟螪了圓前仓库及发垃流皋的健康状况。劂果莡献者的 PR 和蜯件包遇到任䜕问题歀倄的内容可胜有垮助。 -- 最新构建党郚通过[类型检查/Lint](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint)[![构建状态](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.DefinitelyTyped?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=1&branchName=master) -- 所有蜯件包圚 typescript@next 版本䞭党郚通过类型检查/Lint[![构建状态](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/Nightly%20dtslint)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=8) -- 所有蜯件包郜圚䞀䞪半小时内[发垃至 npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher): [![发垃状态](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.types-publisher-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=5&branchName=master) -- [typescript-bot](https://github.com/typescript-bot) 圚 Definitely Typed 䞊倄于掻劚状态[![掻劚状态](https://dev.azure.com/definitelytyped/DefinitelyTyped/_apis/build/status/DefinitelyTyped.typescript-bot-watchdog?branchName=master)](https://dev.azure.com/definitelytyped/DefinitelyTyped/_build/latest?definitionId=6&branchName=master) +- 最新构建党郚通过[类型检查/Lint](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/dtslint) [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=push)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Apush) +- 所有蜯件包圚 typescript@next 版本䞭党郚通过类型检查/Lint [![Build status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml/badge.svg?branch=master&event=schedule)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/CI.yml?query=branch%3Amaster+event%3Aschedule) +- 所有蜯件包郜圚䞀䞪半小时内[发垃至 npm](https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/publisher): [![Publish Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-publisher.yml) +- [typescript-bot](https://github.com/typescript-bot) 圚 Definitely Typed 䞊倄于掻劚状态 [![Activity Status](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml/badge.svg)](https://github.com/DefinitelyTyped/DefinitelyTyped/actions/workflows/watchdog-typescript-bot.yml) - [基础讟斜曎新现状](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44317) 劂果歀倄有任䜕错误或䞊述任䜕操䜜倱莥请圚 [TypeScript 瀟矀 Discord 服务噚䞭的 Definitely Typed 频道](https://discord.gg/typescript)提出。 diff --git a/notNeededPackages.json b/notNeededPackages.json index 346ae17ddc74b9..4a1136700217c4 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -716,6 +716,10 @@ "libraryName": "cheap-ruler", "asOfVersion": "2.5.0" }, + "cheerio": { + "libraryName": "cheerio", + "asOfVersion": "1.0.0" + }, "chokidar": { "libraryName": "chokidar", "asOfVersion": "2.1.3" @@ -1989,6 +1993,10 @@ "libraryName": "express-request-id", "asOfVersion": "3.0.0" }, + "express-slow-down": { + "libraryName": "express-slow-down", + "asOfVersion": "2.0.0" + }, "express-unless": { "libraryName": "express-unless", "asOfVersion": "2.0.1" @@ -2801,6 +2809,10 @@ "libraryName": "i18next-xhr-backend", "asOfVersion": "1.4.2" }, + "iamport-react-native": { + "libraryName": "iamport-react-native", + "asOfVersion": "2.0.0" + }, "icon-gen": { "libraryName": "icon-gen", "asOfVersion": "2.1.0" @@ -4513,6 +4525,10 @@ "libraryName": "node-xlsx", "asOfVersion": "0.21.0" }, + "node-zendesk": { + "libraryName": "node-zendesk", + "asOfVersion": "5.0.0" + }, "nodecredstash": { "libraryName": "nodecredstash", "asOfVersion": "3.0.0" @@ -4893,6 +4909,10 @@ "libraryName": "parse-numeric-range", "asOfVersion": "1.3.0" }, + "parse-path": { + "libraryName": "parse-path", + "asOfVersion": "7.1.0" + }, "parse5": { "libraryName": "parse5", "asOfVersion": "7.0.0" @@ -6423,6 +6443,10 @@ "libraryName": "sade", "asOfVersion": "1.8.0" }, + "safe-flat": { + "libraryName": "safe-flat", + "asOfVersion": "2.1.0" + }, "safe-regex-test": { "libraryName": "safe-regex-test", "asOfVersion": "1.1.0" @@ -7991,6 +8015,10 @@ "libraryName": "yog-ral", "asOfVersion": "0.22.1" }, + "yoga-layout": { + "libraryName": "yoga-layout", + "asOfVersion": "3.1.0" + }, "yup": { "libraryName": "yup", "asOfVersion": "0.32.0" diff --git a/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx b/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx index 94eba92d12db6f..5eda5c60c48833 100644 --- a/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx +++ b/types/carbon__pictograms-react/carbon__pictograms-react-tests.tsx @@ -4,6 +4,7 @@ import { AdvancedFraudProtection, AdvocateMask, Agile, + AgileCoaching, Ai, AiExplainability, Airplane, @@ -81,3 +82,4 @@ import * as React from "react"; ; // $ExpectType Element ; // $ExpectType Element ; // $ExpectType Element +; // $ExpectType Element diff --git a/types/carbon__pictograms-react/es/agile--coaching/index.d.ts b/types/carbon__pictograms-react/es/agile--coaching/index.d.ts new file mode 100644 index 00000000000000..6128e4f769efe5 --- /dev/null +++ b/types/carbon__pictograms-react/es/agile--coaching/index.d.ts @@ -0,0 +1 @@ +export { AgileCoaching as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ahmedabad--jama-masjid/index.d.ts b/types/carbon__pictograms-react/es/ahmedabad--jama-masjid/index.d.ts new file mode 100644 index 00000000000000..61e08374889106 --- /dev/null +++ b/types/carbon__pictograms-react/es/ahmedabad--jama-masjid/index.d.ts @@ -0,0 +1 @@ +export { AhmedabadJamaMasjid as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ahmedabad--sabarmati-ashram/index.d.ts b/types/carbon__pictograms-react/es/ahmedabad--sabarmati-ashram/index.d.ts new file mode 100644 index 00000000000000..f981f5beb6b811 --- /dev/null +++ b/types/carbon__pictograms-react/es/ahmedabad--sabarmati-ashram/index.d.ts @@ -0,0 +1 @@ +export { AhmedabadSabarmatiAshram as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/geodesic-montreal-biosphere/index.d.ts b/types/carbon__pictograms-react/es/geodesic-montreal-biosphere/index.d.ts new file mode 100644 index 00000000000000..ee0cab8908d0ac --- /dev/null +++ b/types/carbon__pictograms-react/es/geodesic-montreal-biosphere/index.d.ts @@ -0,0 +1 @@ +export { GeodesicMontrealBiosphere as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-dcc/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-dcc/index.d.ts new file mode 100644 index 00000000000000..491693c57cc859 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-dcc/index.d.ts @@ -0,0 +1 @@ +export { IbmElmDcc as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-gcm/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-gcm/index.d.ts new file mode 100644 index 00000000000000..854545e449c840 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-gcm/index.d.ts @@ -0,0 +1 @@ +export { IbmElmGcm as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-insights/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-insights/index.d.ts new file mode 100644 index 00000000000000..18a16dbfd5da45 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-insights/index.d.ts @@ -0,0 +1 @@ +export { IbmElmInsights as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-method-composer/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-method-composer/index.d.ts new file mode 100644 index 00000000000000..1f2a07e61b95e3 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-method-composer/index.d.ts @@ -0,0 +1 @@ +export { IbmElmMethodComposer as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-publishing/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-publishing/index.d.ts new file mode 100644 index 00000000000000..a61c5c7d87b656 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-publishing/index.d.ts @@ -0,0 +1 @@ +export { IbmElmPublishing as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm-reporting/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm-reporting/index.d.ts new file mode 100644 index 00000000000000..3c64c783e67b74 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm-reporting/index.d.ts @@ -0,0 +1 @@ +export { IbmElmReporting as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--elm/index.d.ts b/types/carbon__pictograms-react/es/ibm--elm/index.d.ts new file mode 100644 index 00000000000000..660b96eff4b91f --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--elm/index.d.ts @@ -0,0 +1 @@ +export { IbmElm as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--engineering-requirement-doors/index.d.ts b/types/carbon__pictograms-react/es/ibm--engineering-requirement-doors/index.d.ts new file mode 100644 index 00000000000000..04c2d3bdd61304 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--engineering-requirement-doors/index.d.ts @@ -0,0 +1 @@ +export { IbmEngineeringRequirementDoors as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts b/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts new file mode 100644 index 00000000000000..fe1dfaa35d81fe --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts @@ -0,0 +1 @@ +export { IbmEngineeringSystemsDesignRhapsodyModelManager as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody/index.d.ts b/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody/index.d.ts new file mode 100644 index 00000000000000..27a766386b0fad --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--engineering-systems-design-rhapsody/index.d.ts @@ -0,0 +1 @@ +export { IbmEngineeringSystemsDesignRhapsody as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--engineering-test-management/index.d.ts b/types/carbon__pictograms-react/es/ibm--engineering-test-management/index.d.ts new file mode 100644 index 00000000000000..a507b476455599 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--engineering-test-management/index.d.ts @@ -0,0 +1 @@ +export { IbmEngineeringTestManagement as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--engineering-workflow-management/index.d.ts b/types/carbon__pictograms-react/es/ibm--engineering-workflow-management/index.d.ts new file mode 100644 index 00000000000000..9ddaa48c0af74e --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--engineering-workflow-management/index.d.ts @@ -0,0 +1 @@ +export { IbmEngineeringWorkflowManagement as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--z17--multi-frame/index.d.ts b/types/carbon__pictograms-react/es/ibm--z17--multi-frame/index.d.ts new file mode 100644 index 00000000000000..13ca768f173d4a --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--z17--multi-frame/index.d.ts @@ -0,0 +1 @@ +export { IbmZ17MultiFrame as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--z17--single-frame/index.d.ts b/types/carbon__pictograms-react/es/ibm--z17--single-frame/index.d.ts new file mode 100644 index 00000000000000..8ec5666c829291 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--z17--single-frame/index.d.ts @@ -0,0 +1 @@ +export { IbmZ17SingleFrame as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/ibm--z17/index.d.ts b/types/carbon__pictograms-react/es/ibm--z17/index.d.ts new file mode 100644 index 00000000000000..e2882ce9cd0823 --- /dev/null +++ b/types/carbon__pictograms-react/es/ibm--z17/index.d.ts @@ -0,0 +1 @@ +export { IbmZ17 as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/index.d.ts b/types/carbon__pictograms-react/es/index.d.ts index 2e50315bddfdb2..bd5d463be85edc 100644 --- a/types/carbon__pictograms-react/es/index.d.ts +++ b/types/carbon__pictograms-react/es/index.d.ts @@ -10,10 +10,13 @@ export { AdvancedThreats } from "../"; export { Advocate } from "../"; export { AdvocateMask } from "../"; export { Agile } from "../"; +export { AgileCoaching } from "../"; export { Agility } from "../"; export { Agility_02 } from "../"; export { AgilityWithHybridMulticloud } from "../"; export { Agriculture } from "../"; +export { AhmedabadJamaMasjid } from "../"; +export { AhmedabadSabarmatiAshram } from "../"; export { Ai } from "../"; export { AiEthics } from "../"; export { AiExplainability } from "../"; @@ -503,6 +506,7 @@ export { Fuel } from "../"; export { FullyManaged } from "../"; export { FunctionsAsAService } from "../"; export { Gear } from "../"; +export { GeodesicMontrealBiosphere } from "../"; export { GeographicFlexibility } from "../"; export { GetAheadOfRiskAndCompliance } from "../"; export { Gift } from "../"; @@ -513,8 +517,8 @@ export { GlobalAssetsAndRecovery_01 } from "../"; export { GlobalAssetsAndRecovery_02 } from "../"; export { GlobalBusinessServices } from "../"; export { GlobalCurrency } from "../"; -export { GlobalExchange } from "../"; export { GlobalCurrency_02 } from "../"; +export { GlobalExchange } from "../"; export { GlobalFinanceEuro } from "../"; export { GlobalFinanceNetwork } from "../"; export { GlobalFinanceSterling } from "../"; @@ -598,8 +602,20 @@ export { HyperProtectDatabaseAsAService } from "../"; export { HyperProtectVirtualServers } from "../"; export { IbmAutomationPlatform } from "../"; export { IbmCloud } from "../"; -export { IbmIbv } from "../"; +export { IbmElm } from "../"; +export { IbmElmDcc } from "../"; +export { IbmElmGcm } from "../"; +export { IbmElmInsights } from "../"; +export { IbmElmMethodComposer } from "../"; +export { IbmElmPublishing } from "../"; +export { IbmElmReporting } from "../"; +export { IbmEngineeringRequirementDoors } from "../"; +export { IbmEngineeringSystemsDesignRhapsody } from "../"; +export { IbmEngineeringSystemsDesignRhapsodyModelManager } from "../"; +export { IbmEngineeringTestManagement } from "../"; +export { IbmEngineeringWorkflowManagement } from "../"; export { IbmGranite } from "../"; +export { IbmIbv } from "../"; export { IbmIx } from "../"; export { IbmOneMadisonAvenue } from "../"; export { IbmRpa } from "../"; @@ -607,17 +623,20 @@ export { IbmUkLabsHursley } from "../"; export { IbmZ } from "../"; export { IbmZPartition } from "../"; export { IbmZAndCloudModernizationStack } from "../"; +export { IbmZAndCloudModernizationStackProvisioning } from "../"; export { IbmZAndLinuxoneMultiFrame } from "../"; export { IbmZAndLinuxoneSingleFrame } from "../"; export { IbmZOpenAutomationUtilities } from "../"; +export { IbmZOpenEnterpriseLanguages } from "../"; export { IbmZOsContainerPlatform } from "../"; export { IbmZOsPackageManager } from "../"; -export { IbmZAndCloudModernizationStackProvisioning } from "../"; -export { IbmZOpenEnterpriseLanguages } from "../"; export { IbmZ16 } from "../"; export { IbmZ16MultiFrame } from "../"; export { IbmZ16PlusCloud } from "../"; export { IbmZ16SingleFrame } from "../"; +export { IbmZ17 } from "../"; +export { IbmZ17MultiFrame } from "../"; +export { IbmZ17SingleFrame } from "../"; export { IdBadge } from "../"; export { Idea } from "../"; export { Ideate } from "../"; @@ -650,13 +669,17 @@ export { Juice } from "../"; export { Justice } from "../"; export { KeepDry } from "../"; export { KeepYourOwnKey } from "../"; +export { KeyLifecycle } from "../"; export { KeyUsers } from "../"; export { Keyboard } from "../"; +export { Keystores } from "../"; +export { KeystoresExternal } from "../"; export { KnowsDarkData } from "../"; export { KochiHouseboat } from "../"; export { KualaLumpur } from "../"; export { Kubernetes } from "../"; export { KubernetesPod } from "../"; +export { LandingPage } from "../"; export { Language_01 } from "../"; export { Language_02 } from "../"; export { Language_03 } from "../"; @@ -717,6 +740,7 @@ export { MassDataMigration } from "../"; export { MasterThreatHunting } from "../"; export { MathCurve } from "../"; export { Maximize } from "../"; +export { McgillUniversityMorriceHall } from "../"; export { Medal_01 } from "../"; export { Medal_02 } from "../"; export { Medal_03 } from "../"; @@ -747,6 +771,7 @@ export { MobilePhone } from "../"; export { Modernize } from "../"; export { Monitor } from "../"; export { MonitoredItemOnConveyor } from "../"; +export { MontrealOlympicStadium } from "../"; export { MoonFull } from "../"; export { MoonCake } from "../"; export { MortarAndPestle } from "../"; @@ -888,8 +913,8 @@ export { Public } from "../"; export { PublicCloudToPrivateCloud } from "../"; export { Puzzle } from "../"; export { QQPlot } from "../"; -export { QrCode } from "../"; export { Qiskit } from "../"; +export { QrCode } from "../"; export { Quantum } from "../"; export { QuantumSafe } from "../"; export { QuantumComputing } from "../"; @@ -1011,6 +1036,7 @@ export { SmallToMediumBusinessSmb } from "../"; export { Sneaker } from "../"; export { Snow } from "../"; export { Snowflake } from "../"; +export { SocialTile } from "../"; export { SocialWork_01 } from "../"; export { SocialWork_02 } from "../"; export { SocialWorker } from "../"; @@ -1025,6 +1051,7 @@ export { Spaceship } from "../"; export { Speech } from "../"; export { SpeechToText } from "../"; export { Speedometer } from "../"; +export { SponsorUserProgram } from "../"; export { Sports } from "../"; export { Spotlight } from "../"; export { Sprout } from "../"; @@ -1095,6 +1122,7 @@ export { TabletDeviceCheck } from "../"; export { Tags } from "../"; export { TaipeiBubbleTea } from "../"; export { TapeStorage } from "../"; +export { TapeStorage_02 } from "../"; export { Target } from "../"; export { TargetArea } from "../"; export { Teacher } from "../"; @@ -1147,6 +1175,7 @@ export { Tractor } from "../"; export { TradeoffAnalytics } from "../"; export { Train } from "../"; export { Training } from "../"; +export { TransactionData } from "../"; export { TransactionalBlockchain } from "../"; export { TransactionalTrust } from "../"; export { Transform_01 } from "../"; @@ -1195,6 +1224,7 @@ export { UserMask } from "../"; export { UserProfile } from "../"; export { UserSearch } from "../"; export { Vancouver } from "../"; +export { Vault } from "../"; export { VenezuelaNationalPantheonOfVenezuela } from "../"; export { Video_01 } from "../"; export { Video_02 } from "../"; @@ -1233,6 +1263,7 @@ export { WatsonxData } from "../"; export { WatsonxGovernance } from "../"; export { WavingHand } from "../"; export { Weather } from "../"; +export { WebBanners } from "../"; export { WebDeveloper } from "../"; export { Webcast } from "../"; export { Websites } from "../"; diff --git a/types/carbon__pictograms-react/es/key--lifecycle/index.d.ts b/types/carbon__pictograms-react/es/key--lifecycle/index.d.ts new file mode 100644 index 00000000000000..3879032016a0f3 --- /dev/null +++ b/types/carbon__pictograms-react/es/key--lifecycle/index.d.ts @@ -0,0 +1 @@ +export { KeyLifecycle as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/keystores--external/index.d.ts b/types/carbon__pictograms-react/es/keystores--external/index.d.ts new file mode 100644 index 00000000000000..19f2766f472256 --- /dev/null +++ b/types/carbon__pictograms-react/es/keystores--external/index.d.ts @@ -0,0 +1 @@ +export { KeystoresExternal as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/keystores/index.d.ts b/types/carbon__pictograms-react/es/keystores/index.d.ts new file mode 100644 index 00000000000000..615efd848929b9 --- /dev/null +++ b/types/carbon__pictograms-react/es/keystores/index.d.ts @@ -0,0 +1 @@ +export { Keystores as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/landing-page/index.d.ts b/types/carbon__pictograms-react/es/landing-page/index.d.ts new file mode 100644 index 00000000000000..6c7d671dee6ca1 --- /dev/null +++ b/types/carbon__pictograms-react/es/landing-page/index.d.ts @@ -0,0 +1 @@ +export { LandingPage as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/mcgill-university--morrice-hall/index.d.ts b/types/carbon__pictograms-react/es/mcgill-university--morrice-hall/index.d.ts new file mode 100644 index 00000000000000..ee100f95acdc55 --- /dev/null +++ b/types/carbon__pictograms-react/es/mcgill-university--morrice-hall/index.d.ts @@ -0,0 +1 @@ +export { McgillUniversityMorriceHall as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/montreal--olympic-stadium/index.d.ts b/types/carbon__pictograms-react/es/montreal--olympic-stadium/index.d.ts new file mode 100644 index 00000000000000..4b6cdf762b6508 --- /dev/null +++ b/types/carbon__pictograms-react/es/montreal--olympic-stadium/index.d.ts @@ -0,0 +1 @@ +export { MontrealOlympicStadium as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/social--tile/index.d.ts b/types/carbon__pictograms-react/es/social--tile/index.d.ts new file mode 100644 index 00000000000000..787bc8bc89c881 --- /dev/null +++ b/types/carbon__pictograms-react/es/social--tile/index.d.ts @@ -0,0 +1 @@ +export { SocialTile as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/sponsor-user-program/index.d.ts b/types/carbon__pictograms-react/es/sponsor-user-program/index.d.ts new file mode 100644 index 00000000000000..b2b12faf46368e --- /dev/null +++ b/types/carbon__pictograms-react/es/sponsor-user-program/index.d.ts @@ -0,0 +1 @@ +export { SponsorUserProgram as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/tape--storage--02/index.d.ts b/types/carbon__pictograms-react/es/tape--storage--02/index.d.ts new file mode 100644 index 00000000000000..cb981c73ec1d89 --- /dev/null +++ b/types/carbon__pictograms-react/es/tape--storage--02/index.d.ts @@ -0,0 +1 @@ +export { TapeStorage_02 as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/transaction-data/index.d.ts b/types/carbon__pictograms-react/es/transaction-data/index.d.ts new file mode 100644 index 00000000000000..3012ce71d5da0a --- /dev/null +++ b/types/carbon__pictograms-react/es/transaction-data/index.d.ts @@ -0,0 +1 @@ +export { TransactionData as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/vault/index.d.ts b/types/carbon__pictograms-react/es/vault/index.d.ts new file mode 100644 index 00000000000000..315498cb0df6ad --- /dev/null +++ b/types/carbon__pictograms-react/es/vault/index.d.ts @@ -0,0 +1 @@ +export { Vault as default } from "../../"; diff --git a/types/carbon__pictograms-react/es/web--banners/index.d.ts b/types/carbon__pictograms-react/es/web--banners/index.d.ts new file mode 100644 index 00000000000000..955ec5eba4951b --- /dev/null +++ b/types/carbon__pictograms-react/es/web--banners/index.d.ts @@ -0,0 +1 @@ +export { WebBanners as default } from "../../"; diff --git a/types/carbon__pictograms-react/index.d.ts b/types/carbon__pictograms-react/index.d.ts index 3768fb33709721..f3d96f965171dd 100644 --- a/types/carbon__pictograms-react/index.d.ts +++ b/types/carbon__pictograms-react/index.d.ts @@ -1,4 +1,4 @@ -/** 1264 pictograms in total */ +/** 1295 pictograms in total */ export interface CarbonPictogramProps extends Omit< @@ -34,10 +34,13 @@ export const AdvancedThreats: CarbonPictogramType; export const Advocate: CarbonPictogramType; export const AdvocateMask: CarbonPictogramType; export const Agile: CarbonPictogramType; +export const AgileCoaching: CarbonPictogramType; export const Agility: CarbonPictogramType; export const Agility_02: CarbonPictogramType; export const AgilityWithHybridMulticloud: CarbonPictogramType; export const Agriculture: CarbonPictogramType; +export const AhmedabadJamaMasjid: CarbonPictogramType; +export const AhmedabadSabarmatiAshram: CarbonPictogramType; export const Ai: CarbonPictogramType; export const AiEthics: CarbonPictogramType; export const AiExplainability: CarbonPictogramType; @@ -527,6 +530,7 @@ export const Fuel: CarbonPictogramType; export const FullyManaged: CarbonPictogramType; export const FunctionsAsAService: CarbonPictogramType; export const Gear: CarbonPictogramType; +export const GeodesicMontrealBiosphere: CarbonPictogramType; export const GeographicFlexibility: CarbonPictogramType; export const GetAheadOfRiskAndCompliance: CarbonPictogramType; export const Gift: CarbonPictogramType; @@ -537,8 +541,8 @@ export const GlobalAssetsAndRecovery_01: CarbonPictogramType; export const GlobalAssetsAndRecovery_02: CarbonPictogramType; export const GlobalBusinessServices: CarbonPictogramType; export const GlobalCurrency: CarbonPictogramType; -export const GlobalExchange: CarbonPictogramType; export const GlobalCurrency_02: CarbonPictogramType; +export const GlobalExchange: CarbonPictogramType; export const GlobalFinanceEuro: CarbonPictogramType; export const GlobalFinanceNetwork: CarbonPictogramType; export const GlobalFinanceSterling: CarbonPictogramType; @@ -622,8 +626,20 @@ export const HyperProtectDatabaseAsAService: CarbonPictogramType; export const HyperProtectVirtualServers: CarbonPictogramType; export const IbmAutomationPlatform: CarbonPictogramType; export const IbmCloud: CarbonPictogramType; -export const IbmIbv: CarbonPictogramType; +export const IbmElm: CarbonPictogramType; +export const IbmElmDcc: CarbonPictogramType; +export const IbmElmGcm: CarbonPictogramType; +export const IbmElmInsights: CarbonPictogramType; +export const IbmElmMethodComposer: CarbonPictogramType; +export const IbmElmPublishing: CarbonPictogramType; +export const IbmElmReporting: CarbonPictogramType; +export const IbmEngineeringRequirementDoors: CarbonPictogramType; +export const IbmEngineeringSystemsDesignRhapsody: CarbonPictogramType; +export const IbmEngineeringSystemsDesignRhapsodyModelManager: CarbonPictogramType; +export const IbmEngineeringTestManagement: CarbonPictogramType; +export const IbmEngineeringWorkflowManagement: CarbonPictogramType; export const IbmGranite: CarbonPictogramType; +export const IbmIbv: CarbonPictogramType; export const IbmIx: CarbonPictogramType; export const IbmOneMadisonAvenue: CarbonPictogramType; export const IbmRpa: CarbonPictogramType; @@ -635,6 +651,7 @@ export const IbmZ: CarbonPictogramType; */ export const IbmZPartition: CarbonPictogramType; export const IbmZAndCloudModernizationStack: CarbonPictogramType; +export const IbmZAndCloudModernizationStackProvisioning: CarbonPictogramType; /** * @deprecated * This icon has been replaced by `IbmZ16MultiFrame` @@ -646,14 +663,16 @@ export const IbmZAndLinuxoneMultiFrame: CarbonPictogramType; */ export const IbmZAndLinuxoneSingleFrame: CarbonPictogramType; export const IbmZOpenAutomationUtilities: CarbonPictogramType; +export const IbmZOpenEnterpriseLanguages: CarbonPictogramType; export const IbmZOsContainerPlatform: CarbonPictogramType; export const IbmZOsPackageManager: CarbonPictogramType; -export const IbmZAndCloudModernizationStackProvisioning: CarbonPictogramType; -export const IbmZOpenEnterpriseLanguages: CarbonPictogramType; export const IbmZ16: CarbonPictogramType; export const IbmZ16MultiFrame: CarbonPictogramType; export const IbmZ16PlusCloud: CarbonPictogramType; export const IbmZ16SingleFrame: CarbonPictogramType; +export const IbmZ17: CarbonPictogramType; +export const IbmZ17MultiFrame: CarbonPictogramType; +export const IbmZ17SingleFrame: CarbonPictogramType; export const IdBadge: CarbonPictogramType; export const Idea: CarbonPictogramType; export const Ideate: CarbonPictogramType; @@ -686,13 +705,17 @@ export const Juice: CarbonPictogramType; export const Justice: CarbonPictogramType; export const KeepDry: CarbonPictogramType; export const KeepYourOwnKey: CarbonPictogramType; +export const KeyLifecycle: CarbonPictogramType; export const KeyUsers: CarbonPictogramType; export const Keyboard: CarbonPictogramType; +export const Keystores: CarbonPictogramType; +export const KeystoresExternal: CarbonPictogramType; export const KnowsDarkData: CarbonPictogramType; export const KochiHouseboat: CarbonPictogramType; export const KualaLumpur: CarbonPictogramType; export const Kubernetes: CarbonPictogramType; export const KubernetesPod: CarbonPictogramType; +export const LandingPage: CarbonPictogramType; export const Language_01: CarbonPictogramType; export const Language_02: CarbonPictogramType; export const Language_03: CarbonPictogramType; @@ -753,6 +776,7 @@ export const MassDataMigration: CarbonPictogramType; export const MasterThreatHunting: CarbonPictogramType; export const MathCurve: CarbonPictogramType; export const Maximize: CarbonPictogramType; +export const McgillUniversityMorriceHall: CarbonPictogramType; export const Medal_01: CarbonPictogramType; export const Medal_02: CarbonPictogramType; export const Medal_03: CarbonPictogramType; @@ -783,6 +807,7 @@ export const MobilePhone: CarbonPictogramType; export const Modernize: CarbonPictogramType; export const Monitor: CarbonPictogramType; export const MonitoredItemOnConveyor: CarbonPictogramType; +export const MontrealOlympicStadium: CarbonPictogramType; export const MoonFull: CarbonPictogramType; export const MoonCake: CarbonPictogramType; export const MortarAndPestle: CarbonPictogramType; @@ -924,8 +949,8 @@ export const Public: CarbonPictogramType; export const PublicCloudToPrivateCloud: CarbonPictogramType; export const Puzzle: CarbonPictogramType; export const QQPlot: CarbonPictogramType; -export const QrCode: CarbonPictogramType; export const Qiskit: CarbonPictogramType; +export const QrCode: CarbonPictogramType; export const Quantum: CarbonPictogramType; export const QuantumSafe: CarbonPictogramType; export const QuantumComputing: CarbonPictogramType; @@ -1047,6 +1072,7 @@ export const SmallToMediumBusinessSmb: CarbonPictogramType; export const Sneaker: CarbonPictogramType; export const Snow: CarbonPictogramType; export const Snowflake: CarbonPictogramType; +export const SocialTile: CarbonPictogramType; export const SocialWork_01: CarbonPictogramType; export const SocialWork_02: CarbonPictogramType; export const SocialWorker: CarbonPictogramType; @@ -1061,6 +1087,7 @@ export const Spaceship: CarbonPictogramType; export const Speech: CarbonPictogramType; export const SpeechToText: CarbonPictogramType; export const Speedometer: CarbonPictogramType; +export const SponsorUserProgram: CarbonPictogramType; export const Sports: CarbonPictogramType; export const Spotlight: CarbonPictogramType; export const Sprout: CarbonPictogramType; @@ -1131,6 +1158,7 @@ export const TabletDeviceCheck: CarbonPictogramType; export const Tags: CarbonPictogramType; export const TaipeiBubbleTea: CarbonPictogramType; export const TapeStorage: CarbonPictogramType; +export const TapeStorage_02: CarbonPictogramType; export const Target: CarbonPictogramType; export const TargetArea: CarbonPictogramType; export const Teacher: CarbonPictogramType; @@ -1187,6 +1215,7 @@ export const Tractor: CarbonPictogramType; export const TradeoffAnalytics: CarbonPictogramType; export const Train: CarbonPictogramType; export const Training: CarbonPictogramType; +export const TransactionData: CarbonPictogramType; export const TransactionalBlockchain: CarbonPictogramType; export const TransactionalTrust: CarbonPictogramType; export const Transform_01: CarbonPictogramType; @@ -1235,6 +1264,7 @@ export const UserMask: CarbonPictogramType; export const UserProfile: CarbonPictogramType; export const UserSearch: CarbonPictogramType; export const Vancouver: CarbonPictogramType; +export const Vault: CarbonPictogramType; export const VenezuelaNationalPantheonOfVenezuela: CarbonPictogramType; export const Video_01: CarbonPictogramType; export const Video_02: CarbonPictogramType; @@ -1277,6 +1307,7 @@ export const WatsonxData: CarbonPictogramType; export const WatsonxGovernance: CarbonPictogramType; export const WavingHand: CarbonPictogramType; export const Weather: CarbonPictogramType; +export const WebBanners: CarbonPictogramType; export const WebDeveloper: CarbonPictogramType; export const Webcast: CarbonPictogramType; export const Websites: CarbonPictogramType; diff --git a/types/carbon__pictograms-react/lib/agile--coaching/index.d.ts b/types/carbon__pictograms-react/lib/agile--coaching/index.d.ts new file mode 100644 index 00000000000000..5f5109e356d0b7 --- /dev/null +++ b/types/carbon__pictograms-react/lib/agile--coaching/index.d.ts @@ -0,0 +1,3 @@ +import { AgileCoaching } from "../../"; + +export = AgileCoaching; diff --git a/types/carbon__pictograms-react/lib/ahmedabad--jama-masjid/index.d.ts b/types/carbon__pictograms-react/lib/ahmedabad--jama-masjid/index.d.ts new file mode 100644 index 00000000000000..5562c018555b08 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ahmedabad--jama-masjid/index.d.ts @@ -0,0 +1,3 @@ +import { AhmedabadJamaMasjid } from "../../"; + +export = AhmedabadJamaMasjid; diff --git a/types/carbon__pictograms-react/lib/ahmedabad--sabarmati-ashram/index.d.ts b/types/carbon__pictograms-react/lib/ahmedabad--sabarmati-ashram/index.d.ts new file mode 100644 index 00000000000000..4c673199151a55 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ahmedabad--sabarmati-ashram/index.d.ts @@ -0,0 +1,3 @@ +import { AhmedabadSabarmatiAshram } from "../../"; + +export = AhmedabadSabarmatiAshram; diff --git a/types/carbon__pictograms-react/lib/geodesic-montreal-biosphere/index.d.ts b/types/carbon__pictograms-react/lib/geodesic-montreal-biosphere/index.d.ts new file mode 100644 index 00000000000000..ade054ab513000 --- /dev/null +++ b/types/carbon__pictograms-react/lib/geodesic-montreal-biosphere/index.d.ts @@ -0,0 +1,3 @@ +import { GeodesicMontrealBiosphere } from "../../"; + +export = GeodesicMontrealBiosphere; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-dcc/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-dcc/index.d.ts new file mode 100644 index 00000000000000..9bcba43a43e4af --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-dcc/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmDcc } from "../../"; + +export = IbmElmDcc; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-gcm/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-gcm/index.d.ts new file mode 100644 index 00000000000000..118052a10397cb --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-gcm/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmGcm } from "../../"; + +export = IbmElmGcm; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-insights/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-insights/index.d.ts new file mode 100644 index 00000000000000..a9c9a22a6913ce --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-insights/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmInsights } from "../../"; + +export = IbmElmInsights; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-method-composer/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-method-composer/index.d.ts new file mode 100644 index 00000000000000..aaa1cf47b7fdc8 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-method-composer/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmMethodComposer } from "../../"; + +export = IbmElmMethodComposer; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-publishing/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-publishing/index.d.ts new file mode 100644 index 00000000000000..2e759818bbd7c7 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-publishing/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmPublishing } from "../../"; + +export = IbmElmPublishing; diff --git a/types/carbon__pictograms-react/lib/ibm--elm-reporting/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm-reporting/index.d.ts new file mode 100644 index 00000000000000..9c350bd61deaba --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm-reporting/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElmReporting } from "../../"; + +export = IbmElmReporting; diff --git a/types/carbon__pictograms-react/lib/ibm--elm/index.d.ts b/types/carbon__pictograms-react/lib/ibm--elm/index.d.ts new file mode 100644 index 00000000000000..af42d5cce2b95c --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--elm/index.d.ts @@ -0,0 +1,3 @@ +import { IbmElm } from "../../"; + +export = IbmElm; diff --git a/types/carbon__pictograms-react/lib/ibm--engineering-requirement-doors/index.d.ts b/types/carbon__pictograms-react/lib/ibm--engineering-requirement-doors/index.d.ts new file mode 100644 index 00000000000000..682e085182cf9a --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--engineering-requirement-doors/index.d.ts @@ -0,0 +1,3 @@ +import { IbmEngineeringRequirementDoors } from "../../"; + +export = IbmEngineeringRequirementDoors; diff --git a/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts b/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts new file mode 100644 index 00000000000000..28c29584730ce1 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody--model-manager/index.d.ts @@ -0,0 +1,3 @@ +import { IbmEngineeringSystemsDesignRhapsodyModelManager } from "../../"; + +export = IbmEngineeringSystemsDesignRhapsodyModelManager; diff --git a/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody/index.d.ts b/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody/index.d.ts new file mode 100644 index 00000000000000..c279e96856b663 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--engineering-systems-design-rhapsody/index.d.ts @@ -0,0 +1,3 @@ +import { IbmEngineeringSystemsDesignRhapsody } from "../../"; + +export = IbmEngineeringSystemsDesignRhapsody; diff --git a/types/carbon__pictograms-react/lib/ibm--engineering-test-management/index.d.ts b/types/carbon__pictograms-react/lib/ibm--engineering-test-management/index.d.ts new file mode 100644 index 00000000000000..d2a821f99dc3af --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--engineering-test-management/index.d.ts @@ -0,0 +1,3 @@ +import { IbmEngineeringTestManagement } from "../../"; + +export = IbmEngineeringTestManagement; diff --git a/types/carbon__pictograms-react/lib/ibm--engineering-workflow-management/index.d.ts b/types/carbon__pictograms-react/lib/ibm--engineering-workflow-management/index.d.ts new file mode 100644 index 00000000000000..d220c10be52550 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--engineering-workflow-management/index.d.ts @@ -0,0 +1,3 @@ +import { IbmEngineeringWorkflowManagement } from "../../"; + +export = IbmEngineeringWorkflowManagement; diff --git a/types/carbon__pictograms-react/lib/ibm--z17--multi-frame/index.d.ts b/types/carbon__pictograms-react/lib/ibm--z17--multi-frame/index.d.ts new file mode 100644 index 00000000000000..3c66b52c606844 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--z17--multi-frame/index.d.ts @@ -0,0 +1,3 @@ +import { IbmZ17MultiFrame } from "../../"; + +export = IbmZ17MultiFrame; diff --git a/types/carbon__pictograms-react/lib/ibm--z17--single-frame/index.d.ts b/types/carbon__pictograms-react/lib/ibm--z17--single-frame/index.d.ts new file mode 100644 index 00000000000000..daa31896a1d209 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--z17--single-frame/index.d.ts @@ -0,0 +1,3 @@ +import { IbmZ17SingleFrame } from "../../"; + +export = IbmZ17SingleFrame; diff --git a/types/carbon__pictograms-react/lib/ibm--z17/index.d.ts b/types/carbon__pictograms-react/lib/ibm--z17/index.d.ts new file mode 100644 index 00000000000000..86169f49e2ad52 --- /dev/null +++ b/types/carbon__pictograms-react/lib/ibm--z17/index.d.ts @@ -0,0 +1,3 @@ +import { IbmZ17 } from "../../"; + +export = IbmZ17; diff --git a/types/carbon__pictograms-react/lib/index.d.ts b/types/carbon__pictograms-react/lib/index.d.ts index 2e50315bddfdb2..bd5d463be85edc 100644 --- a/types/carbon__pictograms-react/lib/index.d.ts +++ b/types/carbon__pictograms-react/lib/index.d.ts @@ -10,10 +10,13 @@ export { AdvancedThreats } from "../"; export { Advocate } from "../"; export { AdvocateMask } from "../"; export { Agile } from "../"; +export { AgileCoaching } from "../"; export { Agility } from "../"; export { Agility_02 } from "../"; export { AgilityWithHybridMulticloud } from "../"; export { Agriculture } from "../"; +export { AhmedabadJamaMasjid } from "../"; +export { AhmedabadSabarmatiAshram } from "../"; export { Ai } from "../"; export { AiEthics } from "../"; export { AiExplainability } from "../"; @@ -503,6 +506,7 @@ export { Fuel } from "../"; export { FullyManaged } from "../"; export { FunctionsAsAService } from "../"; export { Gear } from "../"; +export { GeodesicMontrealBiosphere } from "../"; export { GeographicFlexibility } from "../"; export { GetAheadOfRiskAndCompliance } from "../"; export { Gift } from "../"; @@ -513,8 +517,8 @@ export { GlobalAssetsAndRecovery_01 } from "../"; export { GlobalAssetsAndRecovery_02 } from "../"; export { GlobalBusinessServices } from "../"; export { GlobalCurrency } from "../"; -export { GlobalExchange } from "../"; export { GlobalCurrency_02 } from "../"; +export { GlobalExchange } from "../"; export { GlobalFinanceEuro } from "../"; export { GlobalFinanceNetwork } from "../"; export { GlobalFinanceSterling } from "../"; @@ -598,8 +602,20 @@ export { HyperProtectDatabaseAsAService } from "../"; export { HyperProtectVirtualServers } from "../"; export { IbmAutomationPlatform } from "../"; export { IbmCloud } from "../"; -export { IbmIbv } from "../"; +export { IbmElm } from "../"; +export { IbmElmDcc } from "../"; +export { IbmElmGcm } from "../"; +export { IbmElmInsights } from "../"; +export { IbmElmMethodComposer } from "../"; +export { IbmElmPublishing } from "../"; +export { IbmElmReporting } from "../"; +export { IbmEngineeringRequirementDoors } from "../"; +export { IbmEngineeringSystemsDesignRhapsody } from "../"; +export { IbmEngineeringSystemsDesignRhapsodyModelManager } from "../"; +export { IbmEngineeringTestManagement } from "../"; +export { IbmEngineeringWorkflowManagement } from "../"; export { IbmGranite } from "../"; +export { IbmIbv } from "../"; export { IbmIx } from "../"; export { IbmOneMadisonAvenue } from "../"; export { IbmRpa } from "../"; @@ -607,17 +623,20 @@ export { IbmUkLabsHursley } from "../"; export { IbmZ } from "../"; export { IbmZPartition } from "../"; export { IbmZAndCloudModernizationStack } from "../"; +export { IbmZAndCloudModernizationStackProvisioning } from "../"; export { IbmZAndLinuxoneMultiFrame } from "../"; export { IbmZAndLinuxoneSingleFrame } from "../"; export { IbmZOpenAutomationUtilities } from "../"; +export { IbmZOpenEnterpriseLanguages } from "../"; export { IbmZOsContainerPlatform } from "../"; export { IbmZOsPackageManager } from "../"; -export { IbmZAndCloudModernizationStackProvisioning } from "../"; -export { IbmZOpenEnterpriseLanguages } from "../"; export { IbmZ16 } from "../"; export { IbmZ16MultiFrame } from "../"; export { IbmZ16PlusCloud } from "../"; export { IbmZ16SingleFrame } from "../"; +export { IbmZ17 } from "../"; +export { IbmZ17MultiFrame } from "../"; +export { IbmZ17SingleFrame } from "../"; export { IdBadge } from "../"; export { Idea } from "../"; export { Ideate } from "../"; @@ -650,13 +669,17 @@ export { Juice } from "../"; export { Justice } from "../"; export { KeepDry } from "../"; export { KeepYourOwnKey } from "../"; +export { KeyLifecycle } from "../"; export { KeyUsers } from "../"; export { Keyboard } from "../"; +export { Keystores } from "../"; +export { KeystoresExternal } from "../"; export { KnowsDarkData } from "../"; export { KochiHouseboat } from "../"; export { KualaLumpur } from "../"; export { Kubernetes } from "../"; export { KubernetesPod } from "../"; +export { LandingPage } from "../"; export { Language_01 } from "../"; export { Language_02 } from "../"; export { Language_03 } from "../"; @@ -717,6 +740,7 @@ export { MassDataMigration } from "../"; export { MasterThreatHunting } from "../"; export { MathCurve } from "../"; export { Maximize } from "../"; +export { McgillUniversityMorriceHall } from "../"; export { Medal_01 } from "../"; export { Medal_02 } from "../"; export { Medal_03 } from "../"; @@ -747,6 +771,7 @@ export { MobilePhone } from "../"; export { Modernize } from "../"; export { Monitor } from "../"; export { MonitoredItemOnConveyor } from "../"; +export { MontrealOlympicStadium } from "../"; export { MoonFull } from "../"; export { MoonCake } from "../"; export { MortarAndPestle } from "../"; @@ -888,8 +913,8 @@ export { Public } from "../"; export { PublicCloudToPrivateCloud } from "../"; export { Puzzle } from "../"; export { QQPlot } from "../"; -export { QrCode } from "../"; export { Qiskit } from "../"; +export { QrCode } from "../"; export { Quantum } from "../"; export { QuantumSafe } from "../"; export { QuantumComputing } from "../"; @@ -1011,6 +1036,7 @@ export { SmallToMediumBusinessSmb } from "../"; export { Sneaker } from "../"; export { Snow } from "../"; export { Snowflake } from "../"; +export { SocialTile } from "../"; export { SocialWork_01 } from "../"; export { SocialWork_02 } from "../"; export { SocialWorker } from "../"; @@ -1025,6 +1051,7 @@ export { Spaceship } from "../"; export { Speech } from "../"; export { SpeechToText } from "../"; export { Speedometer } from "../"; +export { SponsorUserProgram } from "../"; export { Sports } from "../"; export { Spotlight } from "../"; export { Sprout } from "../"; @@ -1095,6 +1122,7 @@ export { TabletDeviceCheck } from "../"; export { Tags } from "../"; export { TaipeiBubbleTea } from "../"; export { TapeStorage } from "../"; +export { TapeStorage_02 } from "../"; export { Target } from "../"; export { TargetArea } from "../"; export { Teacher } from "../"; @@ -1147,6 +1175,7 @@ export { Tractor } from "../"; export { TradeoffAnalytics } from "../"; export { Train } from "../"; export { Training } from "../"; +export { TransactionData } from "../"; export { TransactionalBlockchain } from "../"; export { TransactionalTrust } from "../"; export { Transform_01 } from "../"; @@ -1195,6 +1224,7 @@ export { UserMask } from "../"; export { UserProfile } from "../"; export { UserSearch } from "../"; export { Vancouver } from "../"; +export { Vault } from "../"; export { VenezuelaNationalPantheonOfVenezuela } from "../"; export { Video_01 } from "../"; export { Video_02 } from "../"; @@ -1233,6 +1263,7 @@ export { WatsonxData } from "../"; export { WatsonxGovernance } from "../"; export { WavingHand } from "../"; export { Weather } from "../"; +export { WebBanners } from "../"; export { WebDeveloper } from "../"; export { Webcast } from "../"; export { Websites } from "../"; diff --git a/types/carbon__pictograms-react/lib/key--lifecycle/index.d.ts b/types/carbon__pictograms-react/lib/key--lifecycle/index.d.ts new file mode 100644 index 00000000000000..88a3513dca1d11 --- /dev/null +++ b/types/carbon__pictograms-react/lib/key--lifecycle/index.d.ts @@ -0,0 +1,3 @@ +import { KeyLifecycle } from "../../"; + +export = KeyLifecycle; diff --git a/types/carbon__pictograms-react/lib/keystores--external/index.d.ts b/types/carbon__pictograms-react/lib/keystores--external/index.d.ts new file mode 100644 index 00000000000000..f67c69b25c8e2d --- /dev/null +++ b/types/carbon__pictograms-react/lib/keystores--external/index.d.ts @@ -0,0 +1,3 @@ +import { KeystoresExternal } from "../../"; + +export = KeystoresExternal; diff --git a/types/carbon__pictograms-react/lib/keystores/index.d.ts b/types/carbon__pictograms-react/lib/keystores/index.d.ts new file mode 100644 index 00000000000000..b07687af55be85 --- /dev/null +++ b/types/carbon__pictograms-react/lib/keystores/index.d.ts @@ -0,0 +1,3 @@ +import { Keystores } from "../../"; + +export = Keystores; diff --git a/types/carbon__pictograms-react/lib/landing-page/index.d.ts b/types/carbon__pictograms-react/lib/landing-page/index.d.ts new file mode 100644 index 00000000000000..fba98f064670e7 --- /dev/null +++ b/types/carbon__pictograms-react/lib/landing-page/index.d.ts @@ -0,0 +1,3 @@ +import { LandingPage } from "../../"; + +export = LandingPage; diff --git a/types/carbon__pictograms-react/lib/mcgill-university--morrice-hall/index.d.ts b/types/carbon__pictograms-react/lib/mcgill-university--morrice-hall/index.d.ts new file mode 100644 index 00000000000000..2ffc2756f25e9d --- /dev/null +++ b/types/carbon__pictograms-react/lib/mcgill-university--morrice-hall/index.d.ts @@ -0,0 +1,3 @@ +import { McgillUniversityMorriceHall } from "../../"; + +export = McgillUniversityMorriceHall; diff --git a/types/carbon__pictograms-react/lib/montreal--olympic-stadium/index.d.ts b/types/carbon__pictograms-react/lib/montreal--olympic-stadium/index.d.ts new file mode 100644 index 00000000000000..b6062e96f1c363 --- /dev/null +++ b/types/carbon__pictograms-react/lib/montreal--olympic-stadium/index.d.ts @@ -0,0 +1,3 @@ +import { MontrealOlympicStadium } from "../../"; + +export = MontrealOlympicStadium; diff --git a/types/carbon__pictograms-react/lib/social--tile/index.d.ts b/types/carbon__pictograms-react/lib/social--tile/index.d.ts new file mode 100644 index 00000000000000..79786fea19b5a0 --- /dev/null +++ b/types/carbon__pictograms-react/lib/social--tile/index.d.ts @@ -0,0 +1,3 @@ +import { SocialTile } from "../../"; + +export = SocialTile; diff --git a/types/carbon__pictograms-react/lib/sponsor-user-program/index.d.ts b/types/carbon__pictograms-react/lib/sponsor-user-program/index.d.ts new file mode 100644 index 00000000000000..a18cd87ff41b18 --- /dev/null +++ b/types/carbon__pictograms-react/lib/sponsor-user-program/index.d.ts @@ -0,0 +1,3 @@ +import { SponsorUserProgram } from "../../"; + +export = SponsorUserProgram; diff --git a/types/carbon__pictograms-react/lib/tape--storage--02/index.d.ts b/types/carbon__pictograms-react/lib/tape--storage--02/index.d.ts new file mode 100644 index 00000000000000..fbc1b7a9477dc7 --- /dev/null +++ b/types/carbon__pictograms-react/lib/tape--storage--02/index.d.ts @@ -0,0 +1,3 @@ +import { TapeStorage_02 } from "../../"; + +export = TapeStorage_02; diff --git a/types/carbon__pictograms-react/lib/transaction-data/index.d.ts b/types/carbon__pictograms-react/lib/transaction-data/index.d.ts new file mode 100644 index 00000000000000..9c8ffed1d3db16 --- /dev/null +++ b/types/carbon__pictograms-react/lib/transaction-data/index.d.ts @@ -0,0 +1,3 @@ +import { TransactionData } from "../../"; + +export = TransactionData; diff --git a/types/carbon__pictograms-react/lib/vault/index.d.ts b/types/carbon__pictograms-react/lib/vault/index.d.ts new file mode 100644 index 00000000000000..d000768bfc11b9 --- /dev/null +++ b/types/carbon__pictograms-react/lib/vault/index.d.ts @@ -0,0 +1,3 @@ +import { Vault } from "../../"; + +export = Vault; diff --git a/types/carbon__pictograms-react/lib/web--banners/index.d.ts b/types/carbon__pictograms-react/lib/web--banners/index.d.ts new file mode 100644 index 00000000000000..cb084d10779d41 --- /dev/null +++ b/types/carbon__pictograms-react/lib/web--banners/index.d.ts @@ -0,0 +1,3 @@ +import { WebBanners } from "../../"; + +export = WebBanners; diff --git a/types/chai-arrays/chai-arrays-tests.ts b/types/chai-arrays/chai-arrays-tests.ts index bc19fc3fb888c5..bbc880b85182f9 100644 --- a/types/chai-arrays/chai-arrays-tests.ts +++ b/types/chai-arrays/chai-arrays-tests.ts @@ -1,4 +1,5 @@ import ChaiArrays = require("chai-arrays"); +import "chai/register-should"; declare const assert: Chai.AssertStatic; declare const expect: Chai.ExpectStatic; diff --git a/types/chai-as-promised/chai-as-promised-tests.ts b/types/chai-as-promised/chai-as-promised-tests.ts index 1ae3e9c8ff4c17..03022819d623d3 100644 --- a/types/chai-as-promised/chai-as-promised-tests.ts +++ b/types/chai-as-promised/chai-as-promised-tests.ts @@ -1,4 +1,5 @@ import * as chai from "chai"; +import "chai/register-should.js"; import chaiAsPromised from "chai-as-promised"; chai.use(chaiAsPromised); diff --git a/types/chai-enzyme/package.json b/types/chai-enzyme/package.json index 1995c1c0371032..2374a5c8ef521d 100644 --- a/types/chai-enzyme/package.json +++ b/types/chai-enzyme/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@types/chai": "*", - "@types/cheerio": "*", + "@types/cheerio": "<1", "@types/enzyme": "*", "@types/react": "^16" }, diff --git a/types/chai-fs/chai-fs-tests.ts b/types/chai-fs/chai-fs-tests.ts index 57565739bb86c5..b99f2766d2b8b5 100644 --- a/types/chai-fs/chai-fs-tests.ts +++ b/types/chai-fs/chai-fs-tests.ts @@ -1,4 +1,5 @@ import Chaifs = require("chai-fs"); +import "chai/register-should"; declare const assert: Chai.AssertStatic; declare const expect: Chai.ExpectStatic; diff --git a/types/chai-json-schema/chai-json-schema-tests.ts b/types/chai-json-schema/chai-json-schema-tests.ts index 705784cc3a724c..232a9c2dc7fa6b 100644 --- a/types/chai-json-schema/chai-json-schema-tests.ts +++ b/types/chai-json-schema/chai-json-schema-tests.ts @@ -1,5 +1,6 @@ import ChaiJsonSchema = require("chai-json-schema"); import { TV4 } from "tv4"; +import "chai/register-should"; declare const assert: Chai.AssertStatic; declare const expect: Chai.ExpectStatic; diff --git a/types/chai-like/chai-like-tests.ts b/types/chai-like/chai-like-tests.ts index e2d8b30a7fc582..17823101dedc97 100644 --- a/types/chai-like/chai-like-tests.ts +++ b/types/chai-like/chai-like-tests.ts @@ -1,4 +1,5 @@ import chaiLike = require("chai-like"); +import "chai/register-should"; declare const expect: Chai.ExpectStatic; diff --git a/types/chai-spies/chai-spies-tests.ts b/types/chai-spies/chai-spies-tests.ts index c832791cc0f2be..2859a3a3be88f0 100644 --- a/types/chai-spies/chai-spies-tests.ts +++ b/types/chai-spies/chai-spies-tests.ts @@ -1,5 +1,5 @@ import spies = require("chai-spies"); - +import "chai/register-should"; import("chai").then(({ use }) => { const chai = use(spies); diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts index 414ad86dab2bce..99e7ed9dc3475d 100644 --- a/types/chai-string/chai-string-tests.ts +++ b/types/chai-string/chai-string-tests.ts @@ -3,6 +3,7 @@ declare const expect: Chai.ExpectStatic; import chai_string = require("chai-string"); import("chai").then(({ use }) => use(chai_string)); +import "chai/register-should"; // Stub mocha functions const { describe, it, before, after, beforeEach, afterEach } = null as any as { diff --git a/types/chai-subset/chai-subset-tests.ts b/types/chai-subset/chai-subset-tests.ts index a9cf0e04f1a679..91f0a3cd22035d 100644 --- a/types/chai-subset/chai-subset-tests.ts +++ b/types/chai-subset/chai-subset-tests.ts @@ -1,6 +1,7 @@ import chaiSubset = require("chai-subset"); import("chai").then(({ use }) => use(chaiSubset)); +import "chai/register-should"; declare const assert: Chai.AssertStatic; declare const expect: Chai.ExpectStatic; diff --git a/types/chai/chai-register-should-tests.ts b/types/chai/chai-register-should-tests.ts new file mode 100644 index 00000000000000..07b990d94a3bf5 --- /dev/null +++ b/types/chai/chai-register-should-tests.ts @@ -0,0 +1,2615 @@ +/// +import { assert, config, expect, Should, use, util } from "chai"; +import "chai/register-should"; + +const should = Should(); + +function assertion() { + expect("test").to.be.a("string"); + "test".should.be.a("string"); + expect("foo").to.equal("foo"); + "foo".should.equal("foo"); + should.equal("foo", "foo"); +} + +function fail() { + should.fail("foo", "bar"); + should.fail("foo", "bar", "should fail"); + + expect.fail("foo", "bar"); + expect.fail("foo", "bar", "should fail"); +} + +function _true() { + expect(true).to.be.true; + true.should.be.true; + expect(false).to.not.be.true; + false.should.not.be.true; + expect(1).to.not.be.true; + (1).should.not.be.true; + + expect("test").to.be.true; + "test".should.be.true; +} + +function ok() { + expect(true).to.be.ok; + true.should.be.ok; + expect(false).to.not.be.ok; + false.should.not.be.ok; + expect(1).to.be.ok; + (1).should.be.ok; + expect(0).to.not.be.ok; + (0).should.not.be.ok; + + expect("").to.be.ok; + "".should.be.ok; + + expect("test").to.not.be.ok; + "test".should.not.be.ok; +} + +function _false() { + expect(false).to.be.false; + false.should.be.false; + expect(true).to.not.be.false; + true.should.not.be.false; + expect(0).to.not.be.false; + (0).should.not.be.false; + + expect("").to.be.false; + "".should.be.false; +} + +function _null() { + expect(null).to.be.null; + should.equal(null, null); + expect(false).to.not.be.null; + false.should.not.be.null; + + expect("").to.be.null; + "".should.be.null; +} + +function _undefined() { + expect(undefined).to.be.undefined; + should.equal(undefined, undefined); + expect(null).to.not.be.undefined; + should.not.equal(null, undefined); + + expect("").to.be.undefined; + "".should.be.undefined; +} + +function _NaN() { + expect(NaN).to.be.NaN; + expect(12).to.be.not.NaN; + expect("NaN").to.be.not.NaN; + NaN.should.be.NaN; + (12).should.be.not.NaN; + ("NaN").should.be.not.NaN; +} + +function exist() { + const foo = "bar"; + expect(foo).to.exist; + should.exist(foo); + expect(void (0)).to.not.exist; + should.not.exist(void (0)); +} + +function argumentsTest() { + const args = arguments; + expect(args).to.be.arguments; + args.should.be.arguments; + expect([]).to.not.be.arguments; + [].should.not.be.arguments; + expect(args).to.be.an("arguments").and.be.arguments; + args.should.be.an("arguments").and.be.arguments; + expect([]).to.be.an("array").and.not.be.Arguments; + [].should.be.an("array").and.not.be.Arguments; +} + +function equal() { + expect(undefined).to.equal(void (0)); + should.equal(undefined, void (0)); +} + +function containSubset() { + expect({}).to.containSubset({}); + ({}).should.containSubset({}); +} + +function _typeof() { + expect("test").to.be.a("string"); + "test".should.be.a("string"); + + expect("test").to.not.be.a("string"); + "test".should.not.be.a("string"); + + expect(arguments).to.be.an("arguments"); + arguments.should.be.an("arguments"); + + expect(5).to.be.a("number"); + (5).should.be.a("number"); + + // tslint:disable-next-line:no-construct + expect(new Number(1)).to.be.a("number"); + // tslint:disable-next-line:no-construct + (new Number(1)).should.be.a("number"); + expect(Number(1)).to.be.a("number"); + Number(1).should.be.a("number"); + expect(true).to.be.a("boolean"); + true.should.be.a("boolean"); + expect(new Array()).to.be.a("array"); + (new Array()).should.be.a("array"); + expect(new Object()).to.be.a("object"); + (new Object()).should.be.a("object"); + expect({}).to.be.a("object"); + ({}).should.be.a("object"); + expect([]).to.be.a("array"); + [].should.be.a("array"); + expect(() => { + }).to.be.a("function"); + (() => { + }).should.be.a("function"); + expect(null).to.be.a("null"); + // N.B. previous line has no should equivalent + + expect(5).to.not.be.a("number", "blah"); + (5).should.not.be.a("number", "blah"); +} + +function finite() { + expect(1).to.be.finite; +} + +class Foo { +} + +function _instanceof() { + expect(new Foo()).to.be.an.instanceof(Foo); + (new Foo()).should.be.an.instanceof(Foo); + + expect(3).to.an.instanceof(Foo, "blah"); + (3).should.an.instanceof(Foo, "blah"); +} + +function within() { + expect(5).to.be.within(5, 10); + (5).should.be.within(5, 10); + expect(5).to.be.within(3, 6); + (5).should.be.within(3, 6); + expect(5).to.be.within(3, 5); + (5).should.be.within(3, 5); + expect(5).to.not.be.within(1, 3); + (5).should.not.be.within(1, 3); + expect("foo").to.have.length.within(2, 4); + "foo".should.have.length.within(2, 4); + expect([1, 2, 3]).to.have.length.within(2, 4); + [1, 2, 3].should.have.length.within(2, 4); + + expect(5).to.not.be.within(4, 6, "blah"); + (5).should.not.be.within(4, 6, "blah"); + + expect(10).to.be.within(50, 100, "blah"); + (10).should.be.within(50, 100, "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + ); + new Date("December 17, 1995 03:24:30").should.not.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + ); + + expect(new Date("December 17, 1995 03:24:30")).to.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + ); + new Date("December 17, 1995 03:24:30").should.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + ); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + "blah", + ); + new Date("December 17, 1995 03:24:30").should.not.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + "blah", + ); + + expect(new Date("December 17, 1995 03:24:30")).to.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + "blah", + ); + new Date("December 17, 1995 03:24:30").should.be.within( + new Date("December 17, 1995 03:24:20"), + new Date("December 17, 1995 03:24:40"), + "blah", + ); + + expect("foo").to.have.length.within(5, 7, "blah"); + "foo".should.have.length.within(5, 7, "blah"); + + expect([1, 2, 3]).to.have.length.within(5, 7, "blah"); + [1, 2, 3].should.have.length.within(5, 7, "blah"); +} + +function above() { + expect(5).to.be.above(2); + (5).should.be.above(2); + expect(5).to.be.gt(2); + (5).should.be.gt(2); + expect(5).to.be.greaterThan(2); + (5).should.be.greaterThan(2); + expect(5).to.not.be.above(5); + (5).should.not.be.above(5); + expect(5).to.not.be.above(6); + (5).should.not.be.above(6); + expect("foo").to.have.length.above(2); + "foo".should.have.length.above(2); + expect([1, 2, 3]).to.have.length.above(2); + [1, 2, 3].should.have.length.above(2); + + expect(5).to.be.above(6, "blah"); + (5).should.be.above(6, "blah"); + + expect(10).to.not.be.above(6, "blah"); + (10).should.not.be.above(6, "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.above(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.not.be.above(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.be.above(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.be.above(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.above(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.not.be.above(new Date("December 17, 1995 03:24:20"), "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.be.above(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.be.above(new Date("December 17, 1995 03:24:20"), "blah"); + + expect("foo").to.have.length.above(4, "blah"); + "foo".should.have.length.above(4, "blah"); + + expect([1, 2, 3]).to.have.length.above(4, "blah"); + [1, 2, 3].should.have.length.above(4, "blah"); +} + +function least() { + expect(5).to.be.at.least(2); + (5).should.be.at.least(2); + expect(5).to.be.gte(2); + (5).should.be.gte(2); + expect(5).to.be.greaterThanOrEqual(2); + (5).should.be.greaterThanOrEqual(2); + expect(5).to.be.at.least(5); + (5).should.be.at.least(5); + expect(5).to.not.be.at.least(6); + (5).should.not.be.at.least(6); + expect("foo").to.have.length.of.at.least(2); + "foo".should.have.length.of.at.least(2); + expect([1, 2, 3]).to.have.length.of.at.least(2); + [1, 2, 3].should.have.length.of.at.least(2); + + expect(5).to.be.at.least(6, "blah"); + (5).should.be.at.least(6, "blah"); + + expect(10).to.not.be.at.least(6, "blah"); + (10).should.not.be.at.least(6, "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.least(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.not.be.least(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.be.least(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.be.least(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.least(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.not.be.least(new Date("December 17, 1995 03:24:20"), "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.be.least(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.be.least(new Date("December 17, 1995 03:24:20"), "blah"); + + expect("foo").to.have.length.of.at.least(4, "blah"); + "foo".should.have.length.of.at.least(4, "blah"); + + expect([1, 2, 3]).to.have.length.of.at.least(4, "blah"); + [1, 2, 3].should.have.length.of.at.least(4, "blah"); + + expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, "blah"); + [1, 2, 3, 4].should.not.have.length.of.at.least(4, "blah"); +} + +function below() { + expect(2).to.be.below(5); + (2).should.be.below(5); + expect(2).to.be.lt(5); + (2).should.be.lt(5); + expect(2).to.be.lessThan(5); + (2).should.be.lessThan(5); + expect(2).to.not.be.below(2); + (2).should.not.be.below(2); + expect(2).to.not.be.below(1); + (2).should.not.be.below(1); + expect("foo").to.have.length.below(4); + "foo".should.have.length.below(4); + expect([1, 2, 3]).to.have.length.below(4); + [1, 2, 3].should.have.length.below(4); + + expect(6).to.be.below(5, "blah"); + (6).should.be.below(5, "blah"); + + expect(6).to.not.be.below(10, "blah"); + (6).should.not.be.below(10, "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.below(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.not.be.below(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.be.below(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.be.below(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.below(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.not.be.below(new Date("December 17, 1995 03:24:20"), "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.be.below(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.be.below(new Date("December 17, 1995 03:24:20"), "blah"); + + expect("foo").to.have.length.below(2, "blah"); + "foo".should.have.length.below(2, "blah"); + + expect([1, 2, 3]).to.have.length.below(2, "blah"); + [1, 2, 3].should.have.length.below(2, "blah"); +} + +function most() { + expect(2).to.be.at.most(5); + (2).should.be.at.most(5); + expect(2).to.be.lte(5); + (2).should.be.lte(5); + expect(2).to.be.lessThanOrEqual(5); + (2).should.be.lessThanOrEqual(5); + expect(2).to.be.at.most(2); + (2).should.be.at.most(2); + expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); + expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); + expect("foo").to.have.length.of.at.most(4); + "foo".should.have.length.of.at.most(4); + expect([1, 2, 3]).to.have.length.of.at.most(4); + [1, 2, 3].should.have.length.of.at.most(4); + + expect(6).to.be.at.most(5, "blah"); + (6).should.be.at.most(5, "blah"); + + expect(6).to.not.be.at.most(10, "blah"); + (6).should.not.be.at.most(10, "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.most(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.not.be.most(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.be.most(new Date("December 17, 1995 03:24:20")); + new Date("December 17, 1995 03:24:30").should.be.most(new Date("December 17, 1995 03:24:20")); + + expect(new Date("December 17, 1995 03:24:30")).to.not.be.most(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.not.be.most(new Date("December 17, 1995 03:24:20"), "blah"); + + expect(new Date("December 17, 1995 03:24:30")).to.be.most(new Date("December 17, 1995 03:24:20"), "blah"); + new Date("December 17, 1995 03:24:30").should.be.most(new Date("December 17, 1995 03:24:20"), "blah"); + + expect("foo").to.have.length.of.at.most(2, "blah"); + "foo".should.have.length.of.at.most(2, "blah"); + + expect([1, 2, 3]).to.have.length.of.at.most(2, "blah"); + [1, 2, 3].should.have.length.of.at.most(2, "blah"); + + expect([1, 2]).to.not.have.length.of.at.most(2, "blah"); + [1, 2].should.not.have.length.of.at.most(2, "blah"); +} + +function match() { + expect("foobar").to.match(/^foo/); + "foobar".should.match(/^foo/); + expect("foobar").to.not.match(/^bar/); + "foobar".should.not.match(/^bar/); + + expect("foobar").matches(/^foo/); + "foobar".should.not.matches(/^bar/); + + expect("foobar").to.match(/^bar/i, "blah"); + "foobar".should.match(/^bar/i, "blah"); + + expect("foobar").to.not.match(/^foo/i, "blah"); + "foobar".should.not.match(/^foo/i, "blah"); +} + +function length2() { + expect("test").to.have.length(4); + "test".should.have.length(4); + expect("test").to.not.have.length(3); + "test".should.not.have.length(3); + expect([1, 2, 3]).to.have.length(3); + [1, 2, 3].should.have.length(3); + + expect(4).to.have.length(3, "blah"); + (4).should.have.length(3, "blah"); + + expect("asd").to.not.have.length(3, "blah"); + "asd".should.not.have.length(3, "blah"); +} + +function eql() { + expect("test").to.eql("test"); + "test".should.eql("test"); + expect({ foo: "bar" }).to.eql({ foo: "bar" }); + ({ foo: "bar" }).should.eql({ foo: "bar" }); + expect(1).to.eql(1); + (1).should.eql(1); + expect("4").to.not.eql(4); + "4".should.not.eql(4); + + expect(4).to.eql(3, "blah"); + (4).should.eql(3, "blah"); +} + +function buffer() { + expect(new Buffer([1])).to.eql(new Buffer([1])); + (new Buffer([1])).should.eql(new Buffer([1])); + + expect(new Buffer([0])).to.eql(new Buffer([1])); + (new Buffer([0])).should.eql(new Buffer([1])); +} + +function equal2() { + expect("test").to.equal("test"); + "test".should.equal("test"); + should.equal("test", "test"); + expect(1).to.equal(1); + (1).should.equal(1); + should.equal(1, 1); + + expect(4).to.equal(3, "blah"); + (4).should.equal(3, "blah"); + should.equal(4, 3, "blah"); + + expect("4").to.equal(4, "blah"); + "4".should.equal(4, "blah"); + should.equal(4, 4, "blah"); +} + +function deepEqual() { + expect({ foo: "bar" }).to.deep.equal({ foo: "bar" }); + ({ foo: "bar" }).should.deep.equal({ foo: "bar" }); + expect({ foo: "bar" }).not.to.deep.equal({ foo: "baz" }); +} + +function deepEqual2() { + expect(/a/).to.deep.equal(/a/); + /a/.should.deep.equal(/a/); + expect(/a/).not.to.deep.equal(/b/); + expect(/a/).not.to.deep.equal({}); + expect(/a/g).to.deep.equal(/a/g); + /a/g.should.deep.equal(/a/g); + expect(/a/g).not.to.deep.equal(/b/g); + expect(/a/i).to.deep.equal(/a/i); + /a/i.should.deep.equal(/a/i); + expect(/a/i).not.to.deep.equal(/b/i); + expect(/a/m).to.deep.equal(/a/m); + /a/m.should.deep.equal(/a/m); + expect(/a/m).not.to.deep.equal(/b/m); +} + +function deepEqual3() { + const a = new Date(1, 2, 3); + const b = new Date(4, 5, 6); + expect(a).to.deep.equal(a); + a.should.deep.equal(a); + expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); + expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); +} + +function deepInclude() { + expect(["foo", "bar"]).to.deep.include(["bar", "foo"]); + ["foo", "bar"].should.deep.include(["bar", "foo"]); + expect(["foo", "bar"]).to.deep.includes(["bar", "foo"]); + ["foo", "bar"].should.deep.includes(["bar", "foo"]); + expect(["foo", "bar"]).to.deep.contain(["bar", "foo"]); + ["foo", "bar"].should.deep.contain(["bar", "foo"]); + expect(["foo", "bar"]).to.deep.contains(["bar", "foo"]); + ["foo", "bar"].should.deep.contains(["bar", "foo"]); + expect(["foo", "bar"]).not.to.deep.equal(["foo", "baz"]); + ["foo", "bar"].should.not.deep.equal(["foo", "baz"]); +} + +class FakeArgs { + length: number; +} + +function empty() { + FakeArgs.prototype.length = 0; + + expect("").to.be.empty; + + "".should.be.empty; + expect("foo").not.to.be.empty; + "foo".should.not.be.empty; + expect([]).to.be.empty; + [].should.be.empty; + expect(["foo"]).not.to.be.empty; + ["foo"].should.not.be.empty; + expect(new FakeArgs()).to.be.empty; + (new FakeArgs()).should.be.empty; + expect({ arguments: 0 }).not.to.be.empty; + ({ arguments: 0 }).should.not.be.empty; + expect({}).to.be.empty; + ({}).should.be.empty; + expect({ foo: "bar" }).not.to.be.empty; + ({ foo: "bar" }).should.not.be.empty; + + expect("").not.to.be.empty; + "".should.not.be.empty; + + expect("foo").to.be.empty; + "foo".should.be.empty; + "foo".should.be.empty; + + expect([]).not.to.be.empty; + [].should.not.be.empty; + + expect(["foo"]).to.be.empty; + ["foo"].should.be.empty; + + expect(new FakeArgs()).not.to.be.empty; + (new FakeArgs()).should.not.be.empty; + + expect({ arguments: 0 }).to.be.empty; + ({ arguments: 0 }).should.be.empty; + + expect({}).not.to.be.empty; + ({}).should.not.be.empty; + + expect({ foo: "bar" }).to.be.empty; + ({ foo: "bar" }).should.be.empty; +} + +function property() { + expect("test").to.have.property("length"); + expect("test").to.have.property(Symbol.for("length")); + "test".should.have.property("length"); + expect(4).to.not.have.property("length"); + (4).should.not.have.property("length"); + + expect({ "foo.bar": "baz" }) + .to.have.property("foo.bar"); + ({ "foo.bar": "baz" }).should.have.property("foo.bar"); + expect({ foo: { bar: "baz" } }) + .to.not.have.property("foo.bar"); + ({ foo: { bar: "baz" } }).should.not.have.property("foo.bar"); + + expect("asd").to.have.property("foo"); + "asd".should.have.property("foo"); + + expect({ foo: { bar: "baz" } }) + .to.have.property("foo.bar"); + + ({ foo: { bar: "baz" } }).should.have.property("foo.bar"); +} + +function nestedProperty() { + expect({ "foo.bar": "baz" }) + .to.not.have.nested.property("foo.bar"); + ({ "foo.bar": "baz" }).should + .not.have.nested.property("foo.bar"); + expect({ foo: { bar: "baz" } }) + .to.have.nested.property("foo.bar"); + ({ foo: { bar: "baz" } }).should + .have.nested.property("foo.bar"); + + expect({ "foo.bar": "baz" }) + .to.have.nested.property("foo.bar"); + ({ "foo.bar": "baz" }).should + .have.nested.property("foo.bar"); +} + +function property2() { + expect("test").to.have.property("length", 4); + expect("test").to.have.property(Symbol.for("length"), 4); + "test".should.have.property("length", 4); + expect("asd").to.have.property("constructor", String); + "asd".should.have.property("constructor", String); + + expect("asd").to.have.property("length", 4, "blah"); + "asd".should.have.property("length", 4, "blah"); + + expect("asd").to.not.have.property("length", 3, "blah"); + "asd".should.not.have.property("length", 3, "blah"); + + expect("asd").to.not.have.property("foo", 3, "blah"); + "asd".should.not.have.property("foo", 3, "blah"); + + expect("asd").to.have.property("constructor", Number, "blah"); + "asd".should.have.property("constructor", Number, "blah"); +} + +function nestedProperty2() { + expect({ foo: { bar: "baz" } }) + .to.have.nested.property("foo.bar", "baz"); + ({ foo: { bar: "baz" } }).should + .have.nested.property("foo.bar", "baz"); + + expect({ foo: { bar: "baz" } }) + .to.have.nested.property("foo.bar", "quux", "blah"); + ({ foo: { bar: "baz" } }).should + .have.nested.property("foo.bar", "quux", "blah"); + expect({ foo: { bar: "baz" } }) + .to.not.have.nested.property("foo.bar", "baz", "blah"); + ({ foo: { bar: "baz" } }).should + .not.have.nested.property("foo.bar", "baz", "blah"); + expect({ foo: 5 }) + .to.not.have.nested.property("foo.bar", "baz", "blah"); + ({ foo: 5 }).should + .not.have.nested.property("foo.bar", "baz", "blah"); +} + +function own() { + expect("test").to.have.own.property("length"); + expect("test").to.own.property("length"); + expect({ length: 12 }).to.have.own.property("length"); + expect({ length: 12 }).to.not.have.own.property("length", "blah"); +} + +function ownProperty() { + expect("test").to.have.ownProperty("length"); + expect("test").to.have.ownProperty(Symbol.for("length")); + "test".should.have.ownProperty("length"); + expect("test").to.haveOwnProperty("length"); + "test".should.haveOwnProperty("length"); + expect({ length: 12 }).to.have.ownProperty("length"); + ({ length: 12 }).should.have.ownProperty("length"); + expect({ length: 12 }).to.have.ownProperty("length", 12); + ({ length: 12 }).should.have.ownProperty("length", 12); + expect({ length: 12 }).to.have.ownProperty("length", 12, "blah"); + ({ length: 12 }).should.have.ownProperty("length", 12, "blah"); + + expect({ length: 12 }).to.not.have.ownProperty("length", "blah"); + ({ length: 12 }).should.not.have.ownProperty("length", "blah"); + + expect("test").to.have.own.property("length"); + expect("test").to.have.own.property(Symbol.for("length")); + "test".should.have.own.property("length"); + expect({ length: 12 }).to.have.own.property("length"); + ({ length: 12 }).should.have.own.property("length"); + expect({ length: 12 }).to.have.own.property("length", 12); + ({ length: 12 }).should.have.own.property("length", 12); + expect({ length: 12 }).to.have.own.property("length", 12, "blah"); + ({ length: 12 }).should.have.own.property("length", 12, "blah"); + + expect({ length: 12 }).to.not.have.own.property("length", "blah"); + ({ length: 12 }).should.not.have.own.property("length", "blah"); + + expect("test").to.have.an.own.property("length"); + "test".should.have.an.own.property("length"); + expect({ length: 12 }).to.have.an.own.property("length"); + ({ length: 12 }).should.have.an.own.property("length"); + expect({ length: 12 }).to.have.an.own.property("length", 12); + ({ length: 12 }).should.have.an.own.property("length", 12); + expect({ length: 12 }).to.have.an.own.property("length", 12, "blah"); + ({ length: 12 }).should.have.an.own.property("length", 12, "blah"); + + expect({ length: 12 }).to.not.have.an.own.property("length", "blah"); + ({ length: 12 }).should.not.have.an.own.property("length", "blah"); +} + +function ownPropertyDescriptor() { + expect("test").to.have.ownPropertyDescriptor("length"); + expect("test").to.have.ownPropertyDescriptor(Symbol.for("length")); + expect("test").to.have.ownPropertyDescriptor("length", { + enumerable: false, + configurable: false, + writable: false, + value: 4, + }); + expect("test").not.to.have.ownPropertyDescriptor("length", { + enumerable: false, + configurable: false, + writable: false, + value: 3, + }); + expect("test").to.haveOwnPropertyDescriptor("length").to.have.property("enumerable", false); + expect("test").to.haveOwnPropertyDescriptor("length").to.contain.keys("value"); + + "test".should.have.ownPropertyDescriptor("length"); + "test".should.have.ownPropertyDescriptor("length", { + enumerable: false, + configurable: false, + writable: false, + value: 4, + }); + "test".should.not.have.ownPropertyDescriptor("length", { + enumerable: false, + configurable: false, + writable: false, + value: 3, + }); + "test".should.haveOwnPropertyDescriptor("length").to.have.property("enumerable", false); + "test".should.haveOwnPropertyDescriptor("length").to.contain.keys("value"); + "test".should.have.an.ownPropertyDescriptor("length"); +} + +function string() { + expect("foobar").to.have.string("bar"); + "foobar".should.have.string("bar"); + expect("foobar").to.have.string("foo"); + "foobar".should.have.string("foo"); + expect("foobar").to.not.have.string("baz"); + "foobar".should.not.have.string("baz"); + + expect(3).to.have.string("baz"); + (3).should.have.string("baz"); + + expect("foobar").to.have.string("baz", "blah"); + "foobar".should.have.string("baz", "blah"); + + expect("foobar").to.not.have.string("bar", "blah"); + "foobar".should.not.have.string("bar", "blah"); +} + +function include() { + expect(["foo", "bar"]).to.include("foo"); + ["foo", "bar"].should.include("foo"); + expect(["foo", "bar"]).to.include("foo"); + ["foo", "bar"].should.include("foo"); + expect(["foo", "bar"]).to.include("bar"); + ["foo", "bar"].should.include("bar"); + expect([1, 2]).to.include(1); + [1, 2].should.include(1); + expect(["foo", "bar"]).to.not.include("baz"); + ["foo", "bar"].should.not.include("baz"); + expect(["foo", "bar"]).to.not.include(1); + ["foo", "bar"].should.not.include(1); + + expect(["foo", "bar"]).includes("foo"); + ["foo", "bar"].should.includes("foo"); + + expect(["foo"]).to.include("bar", "blah"); + ["foo"].should.include("bar", "blah"); + + expect(["bar", "foo"]).to.not.include("foo", "blah"); + ["bar", "foo"].should.not.include("foo", "blah"); +} + +function keys() { + expect({ foo: 1 }).to.have.keys(["foo"]); + ({ foo: 1 }).should.have.keys(["foo"]); + expect({ foo: 1, bar: 2 }).to.have.keys(["foo", "bar"]); + ({ foo: 1, bar: 2 }).should.have.keys(["foo", "bar"]); + expect({ foo: 1, bar: 2 }).to.have.keys("foo", "bar"); + ({ foo: 1, bar: 2 }).should.have.keys("foo", "bar"); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("foo", "bar"); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("foo", "bar"); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("bar", "foo"); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("bar", "foo"); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("baz"); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("baz"); + // alias + + expect({ foo: 1, bar: 2, baz: 3 }).contains.keys("baz"); + + expect({ foo: 1, bar: 2 }).to.have.all.keys(["foo", "bar"]); + expect({ foo: 1, bar: 2 }).to.have.any.keys(["foo", "bar"]); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys("baz"); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys("baz"); + + expect({ foo: 1, bar: 2 }).to.contain.keys("foo"); + ({ foo: 1, bar: 2 }).should.contain.keys("foo"); + expect({ foo: 1, bar: 2 }).to.contain.keys("bar", "foo"); + ({ foo: 1, bar: 2 }).should.contain.keys("bar", "foo"); + expect({ foo: 1, bar: 2 }).to.contain.keys(["foo"]); + ({ foo: 1, bar: 2 }).should.contain.keys(["foo"]); + expect({ foo: 1, bar: 2 }).to.contain.keys(["bar"]); + ({ foo: 1, bar: 2 }).should.contain.keys(["bar"]); + expect({ foo: 1, bar: 2 }).to.contain.keys(["bar", "foo"]); + ({ foo: 1, bar: 2 }).should.contain.keys(["bar", "foo"]); + + expect({ foo: 1, bar: 2 }).to.not.have.keys("baz"); + ({ foo: 1, bar: 2 }).should.not.have.keys("baz"); + expect({ foo: 1, bar: 2 }).to.not.have.keys("foo", "baz"); + ({ foo: 1, bar: 2 }).should.not.have.keys("foo", "baz"); + expect({ foo: 1, bar: 2 }).to.not.contain.keys("baz"); + ({ foo: 1, bar: 2 }).should.not.contain.keys("baz"); + expect({ foo: 1, bar: 2 }).to.not.contain.keys("foo", "baz"); + ({ foo: 1, bar: 2 }).should.not.contain.keys("foo", "baz"); + expect({ foo: 1, bar: 2 }).to.not.contain.keys("baz", "foo"); + ({ foo: 1, bar: 2 }).should.not.contain.keys("baz", "foo"); + + expect({ foo: 1 }).to.have.keys(); + ({ foo: 1 }).should.have.keys(); + + expect({ foo: 1 }).to.have.keys([]); + ({ foo: 1 }).should.have.keys([]); + + expect({ foo: 1 }).to.not.have.keys([]); + ({ foo: 1 }).should.not.have.keys([]); + + expect({ foo: 1 }).to.contain.keys([]); + ({ foo: 1 }).should.contain.keys([]); + + expect({ foo: 1 }).to.have.keys(["bar"]); + ({ foo: 1 }).should.have.keys(["bar"]); + + expect({ foo: 1 }).to.have.keys(["bar", "baz"]); + ({ foo: 1 }).should.have.keys(["bar", "baz"]); + + expect({ foo: 1 }).to.have.keys(["foo", "bar", "baz"]); + ({ foo: 1 }).should.have.keys(["foo", "bar", "baz"]); + + expect({ foo: 1 }).to.not.have.keys(["foo"]); + ({ foo: 1 }).should.not.have.keys(["foo"]); + + expect({ foo: 1 }).to.not.have.keys(["foo"]); + ({ foo: 1 }).should.not.have.keys(["foo"]); + + expect({ foo: 1, bar: 2 }).to.not.have.keys(["foo", "bar"]); + ({ foo: 1, bar: 2 }).should.not.have.keys(["foo", "bar"]); + + expect({ foo: 1 }).to.not.contain.keys(["foo"]); + ({ foo: 1 }).should.not.contain.keys(["foo"]); + + expect({ foo: 1 }).to.contain.keys("foo", "bar"); + ({ foo: 1 }).should.contain.keys("foo", "bar"); +} + +function deepKeys() { + expect(new Set([{ a: 1 }])).to.have.deep.keys([{ a: 1 }]); + (new Set([{ a: 1 }])).should.have.deep.keys([{ a: 1 }]); + + expect(new Set([{ a: 1 }])).not.to.have.deep.keys([{ b: 1 }]); + (new Set([{ a: 1 }])).should.not.have.deep.keys([{ b: 1 }]); +} + +function chaining() { + const tea = { name: "chai", extras: ["milk", "sugar", "smile"] }; + expect(tea).to.have.property("extras").with.lengthOf(3); + tea.should.have.property("extras").with.lengthOf(3); + + expect(tea).to.have.property("extras").with.lengthOf(4); + tea.should.have.property("extras").with.lengthOf(4); + + expect(tea).to.be.a("object").and.have.property("name", "chai"); + tea.should.be.a("object").and.have.property("name", "chai"); + + expect({ b: 2 }).to.have.a.property("b"); + expect([1, 2, 3]).to.have.a.lengthOf(3); +} + +function exxtensible() { + expect({}).to.be.extensible; + expect(Object.preventExtensions({})).to.be.not.extensible; + ({}).should.be.extensible; + Object.preventExtensions({}).should.not.be.extensible; +} + +function sealed() { + expect({}).to.be.not.sealed; + expect(Object.seal({})).to.be.sealed; + ({}).should.be.not.sealed; + Object.seal({}).should.be.sealed; +} + +function frozen() { + expect({}).to.be.not.frozen; + expect(Object.freeze({})).to.be.frozen; + ({}).should.be.not.frozen; + Object.freeze({}).should.be.frozen; + + expect([1, 2, 3]).to.have.all.members([1, 2, 3]); + expect([1, 2, 3]).to.have.all.members(Object.freeze([1, 2, 3])); + + expect({ 1: "", 2: "", 3: "" }).to.have.all.keys([1, 2, 3]); + expect({ 1: "", 2: "", 3: "" }).to.have.all.keys(Object.freeze([1, 2, 3])); + + assert.notDeepInclude([1, 2, 3], 1); + assert.notDeepInclude(Object.freeze([1, 2, 3]), 1); + + assert.include([1, 2, 3], 1); + assert.include(Object.freeze([1, 2, 3]), 1); + + assert.notInclude([1, 2, 3], 1); + assert.notInclude(Object.freeze([1, 2, 3]), 1); + + expect([1, 2, 3]).to.have.oneOf([1, 2, 3]); + expect([1, 2, 3]).to.have.oneOf(Object.freeze([1, 2, 3])); +} + +class PoorlyConstructedError { +} + +function _throw() { + // See GH-45: some poorly-constructed custom errors don't have useful names + // on either their constructor or their constructor prototype, but instead + // only set the name inside the constructor itself. + PoorlyConstructedError.prototype = Object.create(Error.prototype); + + const specificError = new RangeError("boo"); + + const goodFn = () => { + }; + const badFn = () => { + throw new Error("testing"); + }; + const refErrFn = () => { + throw new ReferenceError("hello"); + }; + const ickyErrFn = () => { + throw new PoorlyConstructedError(); + }; + const specificErrFn = () => { + throw specificError; + }; + + expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); + expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); + expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); + expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); + expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); + expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); + expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); + expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); + expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); + expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); + expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); + expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); + expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); + expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); + + expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); + expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); + expect(badFn).to.throw("testing"); + badFn.should.throw("testing"); + should.throw(badFn, "testing"); + expect(badFn).to.not.throw("hello"); + badFn.should.not.throw("hello"); + should.not.throw(badFn, "hello"); + + expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); + expect(badFn).to.throw(Error, "testing"); + badFn.should.throw(Error, "testing"); + should.throw(badFn, Error, "testing"); + + expect(goodFn).to.throw(); + goodFn.should.throw(); + should.throw(goodFn); + + expect(goodFn).to.throw(ReferenceError); + goodFn.should.throw(ReferenceError); + should.throw(goodFn, ReferenceError); + + expect(goodFn).to.throw(specificError); + goodFn.should.throw(specificError); + should.throw(goodFn, specificError); + + expect(badFn).to.not.throw(); + badFn.should.not.throw(); + should.not.throw(badFn); + + expect(badFn).to.throw(ReferenceError); + badFn.should.throw(ReferenceError); + should.throw(badFn, ReferenceError); + + expect(badFn).to.throw(specificError); + badFn.should.throw(specificError); + should.throw(badFn, specificError); + + expect(badFn).to.not.throw(Error); + badFn.should.not.throw(Error); + should.not.throw(badFn, Error); + + expect(refErrFn).to.not.throw(ReferenceError); + refErrFn.should.not.throw(ReferenceError); + should.not.throw(refErrFn, ReferenceError); + + expect(badFn).to.throw(PoorlyConstructedError); + badFn.should.throw(PoorlyConstructedError); + should.throw(badFn, PoorlyConstructedError); + + expect(ickyErrFn).to.not.throw(PoorlyConstructedError); + ickyErrFn.should.not.throw(PoorlyConstructedError); + should.not.throw(ickyErrFn, PoorlyConstructedError); + + expect(ickyErrFn).to.throw(ReferenceError); + ickyErrFn.should.throw(ReferenceError); + should.throw(ickyErrFn, ReferenceError); + + expect(specificErrFn).to.throw(new ReferenceError("eek")); + specificErrFn.should.throw(new ReferenceError("eek")); + should.throw(specificErrFn, new ReferenceError("eek")); + + expect(specificErrFn).to.not.throw(specificError); + specificErrFn.should.not.throw(specificError); + should.not.throw(specificErrFn, specificError); + + expect(badFn).to.not.throw(/testing/); + badFn.should.not.throw(/testing/); + should.not.throw(badFn, /testing/); + + expect(badFn).to.throw(/hello/); + badFn.should.throw(/hello/); + should.throw(badFn, /hello/); + + expect(badFn).to.throw(Error, /hello/, "blah"); + badFn.should.throw(Error, /hello/, "blah"); + should.throw(badFn, Error, /hello/, "blah"); + + expect(badFn).to.throw(Error, "hello", "blah"); + badFn.should.throw(Error, "hello", "blah"); + should.throw(badFn, Error, "hello", "blah"); +} + +function testUse() { + // Modified from: + // https://www.npmjs.com/package/chai-subset + // But with added type annotations and some modifications to make the + // linter whine less, and also a method (chai.assert.containSubset) removed + // because we can't take advantage of namespace-declaration-merging here. + function chaiSubset(chai: Chai.ChaiStatic, utils: Chai.ChaiUtils) { + const Assertion = chai.Assertion; + const assertionPrototype = Assertion.prototype; + + Assertion.addMethod("containSubset", function(expected: Object) { + const actual = utils.flag(this, "object"); + const showDiff = chai.config.showDiff; + + assertionPrototype.assert.call( + this, + compare(expected, actual), + "expected #{act} to contain subset #{exp}", + "expected #{act} to not contain subset #{exp}", + expected, + actual, + showDiff, + ); + }); + + Assertion.addMethod("containSubset", function(expected: Object) { + const actual = utils.flag(this, "object"); + const showDiff = chai.config.showDiff; + + assertionPrototype.assert.call( + this, + compare(expected, actual), + "expected #{act} to contain subset #{exp}", + "expected #{act} to not contain subset #{exp}", + expected, + actual, + showDiff, + ); + }); + + Assertion.overwriteProperty("ok", function(_super: any) { + return function checkModel(this: Chai.Assertion & Chai.AssertionStatic) { + const obj = this._obj; + if (obj && obj instanceof FakeArgs) { + const negate = utils.flag(this, "negate") as boolean; + if (negate && !("length" in obj)) { + return; + } + const assertLength = new Assertion(obj.length, "FakeArgs exists"); + utils.transferFlags(this, assertLength, false); + assertLength.is.a("number"); + } else { + _super.call(this); + } + }; + }); + + function compare(expected: Object, actual: Object): boolean { + if (expected === actual) { + return true; + } + if (typeof actual !== typeof expected) { + return false; + } + if (typeof expected !== "object" || expected === null) { + return expected === actual; + } + if (!!expected && !actual) { + return false; + } + + if (Array.isArray(expected) && Array.isArray(actual)) { + if (typeof actual.length !== "number") { + return false; + } + const aa = Array.prototype.slice.call(actual); + return expected.every((exp: Object) => aa.some((act: Object) => compare(exp, act))); + } + + if (expected instanceof Date) { + if (actual instanceof Date) { + return expected.getTime() === actual.getTime(); + } else { + return false; + } + } + + return Object.keys(expected).every((key: string): boolean => { + const eo = (expected as { [key: string]: Object })[key]; + const ao = (actual as { [key: string]: Object })[key]; + if (typeof eo === "object" && eo !== null && ao !== null) { + return compare(eo, ao); + } + if (typeof eo === "function") { + return eo(ao); + } + return ao === eo; + }); + } + } + + function testAssertionPrototypeArgs(chai: Chai.ChaiStatic, utils: Chai.ChaiUtils) { + const Assertion = chai.Assertion; + + Assertion.addMethod("testAssertion", function(expected: Object) { + this.assert( + true, + "expected message", + "negated expected message", + // 4th and subsequent args are optional + ); + }); + } + + use(chaiSubset); +} + +class Klass { + val: number; + + constructor() { + this.val = 0; + } + + bar() { + } + + static baz() { + } +} + +function respondTo() { + const obj = new Klass(); + + expect(Klass).to.respondTo("bar"); + expect(obj).respondsTo("bar"); + Klass.should.respondTo("bar"); + Klass.should.respondsTo("bar"); + expect(Klass).to.not.respondTo("foo"); + Klass.should.not.respondTo("foo"); + expect(Klass).itself.to.respondTo("func"); + expect(Klass).itself.not.to.respondTo("bar"); + + expect(obj).not.to.respondTo("foo"); + obj.should.not.respondTo("foo"); + + expect(Klass).to.respondTo("baz", "constructor"); + Klass.should.respondTo("baz", "constructor"); + + expect(obj).to.respondTo("baz", "object"); + obj.should.respondTo("baz", "object"); +} + +function satisfy() { + function matcher(num: number) { + return num === 1; + } + + expect(1).to.satisfy(matcher); + (1).should.satisfy(matcher); + + expect(2).to.satisfy(matcher, "blah"); + (2).should.satisfy(matcher, "blah"); +} + +function closeTo() { + expect(1.5).to.be.closeTo(1.0, 0.5); + (1.5).should.be.closeTo(1.0, 0.5); + expect(10).to.be.closeTo(20, 20); + (10).should.be.closeTo(20, 20); + expect(-10).to.be.closeTo(20, 30); + (-10).should.be.closeTo(20, 30); + + expect(2).to.be.closeTo(1.0, 0.5, "blah"); + (2).should.be.closeTo(1.0, 0.5, "blah"); + + expect(-10).to.be.closeTo(20, 29, "blah"); + (-10).should.be.closeTo(20, 29, "blah"); +} + +function approximately() { + expect(1.5).to.be.approximately(1.0, 0.5); + (1.5).should.be.approximately(1.0, 0.5); + expect(10).to.be.approximately(20, 20); + (10).should.be.approximately(20, 20); + expect(-10).to.be.approximately(20, 30); + (-10).should.be.approximately(20, 30); + + expect(2).to.be.approximately(1.0, 0.5, "blah"); + (2).should.be.approximately(1.0, 0.5, "blah"); + + expect(-10).to.be.approximately(20, 29, "blah"); + (-10).should.be.approximately(20, 29, "blah"); +} + +function includeMembers() { + expect([1, 2, 3]).to.include.members([]); + [1, 2, 3].should.include.members([]); + + expect([1, 2, 3]).to.include.members([3, 2]); + + [1, 2, 3].should.include.members([3, 2]); + + expect([1, 2, 3]).to.not.include.members([8, 4]); + + [1, 2, 3].should.not.include.members([8, 4]); + + expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); + + [1, 2, 3].should.not.include.members([1, 2, 3, 4]); +} + +function sameMembers() { + expect([5, 4]).to.have.same.members([4, 5]); + [5, 4].should.have.same.members([4, 5]); + expect([5, 4]).to.have.same.members([5, 4]); + [5, 4].should.have.same.members([5, 4]); + + expect([5, 4]).to.not.have.same.members([]); + [5, 4].should.not.have.same.members([]); + expect([5, 4]).to.not.have.same.members([6, 3]); + [5, 4].should.not.have.same.members([6, 3]); + expect([5, 4]).to.not.have.same.members([5, 4, 2]); + [5, 4].should.not.have.same.members([5, 4, 2]); + + assert.sameMembers([5, 4], [4, 5]); +} + +function sameDeepMembers() { + expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); + [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); + expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); + [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); + + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + + assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); +} + +function orderedMembers() { + expect([1, 2]).to.have.ordered.members([1, 2]).but.not.have.ordered.members([2, 1]); + expect([1, 2, 3]).to.include.ordered.members([1, 2]).but.not.include.ordered.members([2, 3]); + expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]); + expect([1, 2, 3]).to.have.members([2, 1, 3]).but.not.ordered.members([2, 1, 3]); + expect([{ a: 1 }, { b: 2 }, { c: 3 }]).to.include.deep.ordered.members([{ a: 1 }, { b: 2 }]).but.not.include.deep + .ordered.members([{ b: 2 }, { c: 3 }]); + + assert.sameOrderedMembers([1, 2, 3], [1, 2, 3], "same ordered members"); + assert.notSameOrderedMembers([1, 2, 3], [2, 1, 3], "not same ordered members"); + assert.sameDeepOrderedMembers( + [{ a: 1 }, { b: 2 }, { c: 3 }], + [{ a: 1 }, { b: 2 }, { c: 3 }], + "same deep ordered members", + ); + assert.notSameDeepOrderedMembers( + [{ a: 1 }, { b: 2 }, { c: 3 }], + [{ b: 2 }, { a: 1 }, { c: 3 }], + "not same deep ordered members", + ); + + assert.includeOrderedMembers([1, 2, 3], [1, 2], "include ordered members"); + assert.notIncludeOrderedMembers([1, 2, 3], [2, 1], "not include ordered members"); + assert.includeDeepOrderedMembers( + [{ a: 1 }, { b: 2 }, { c: 3 }], + [{ a: 1 }, { b: 2 }], + "include deep ordered members", + ); + assert.notIncludeDeepOrderedMembers( + [{ a: 1 }, { b: 2 }, { c: 3 }], + [{ b: 2 }, { c: 3 }], + "not include deep ordered members", + ); +} + +function members() { + expect([5, 4]).members([4, 5]); + expect([5, 4]).members([5, 4]); + + expect([5, 4]).not.members([]); + expect([5, 4]).not.members([6, 3]); + expect([5, 4]).not.members([5, 4, 2]); + + expect([5, 4]).to.have.all.members([4, 5]); +} + +function increaseDecreaseChange() { + const obj = { val: 10 }; + const inc = () => { + obj.val++; + }; + const dec = () => { + obj.val--; + }; + const same = () => { + }; + + expect(inc).to.increase(obj, "val"); + expect(inc).increases(obj, "val"); + expect(inc).to.change(obj, "val"); + + expect(dec).to.decrease(obj, "val"); + expect(dec).decreases(obj, "val"); + expect(dec).to.change(obj, "val"); + expect(dec).changes(obj, "val"); + + expect(inc).to.not.decrease(obj, "val"); + expect(dec).to.not.increase(obj, "val"); + expect(same).to.not.increase(obj, "val"); + expect(same).to.not.decrease(obj, "val"); + expect(same).to.not.change(obj, "val"); + + inc.should.increase(obj, "val"); + inc.should.change(obj, "val"); + + dec.should.decrease(obj, "val"); + dec.should.change(obj, "val"); + + inc.should.not.decrease(obj, "val"); + dec.should.not.increase(obj, "val"); + same.should.not.change(obj, "val"); + + const myObj = { val: 1 }; + const addTwo = () => { + myObj.val += 2; + }; + expect(addTwo).to.increase(myObj, "val").by(2); +} + +function oneOf() { + const obj = { z: 3 }; + + expect(5).to.be.oneOf([1, 5, 4]); + expect("z").to.be.oneOf(["x", "y", "z"]); + expect(obj).to.be.oneOf([obj]); + + expect(5).to.not.be.oneOf([1, -12, 4]); + expect(5).to.not.be.oneOf([1, [5], 4]); + expect("z").to.not.be.oneOf(["w", "x", "y"]); + expect("z").to.not.be.oneOf(["x", "y", ["z"]]); + expect(obj).to.not.be.oneOf([{ z: 3 }]); + + expect("Today is sunny").to.contain.oneOf(["sunny", "cloudy"]); +} + +function deepOneOf() { + expect({ z: 3 }).to.be.deep.oneOf([{ z: 3 }]); + expect({ z: 3 }).to.deep.be.oneOf([{ z: 3 }]); + + expect({ z: 3 }).to.not.be.deep.oneOf([{ x: 1 }, { y: 2 }]); + expect({ z: 3 }).to.not.deep.be.oneOf([{ x: 1 }, { y: 2 }]); +} + +function testInspectType() { + const x: string = util.inspect([1, 2, 3], false, 4, false); + expect(x).to.be.equal("[ 1, 2, 3 ]"); +} + +// tdd +declare function suite(description: string, action: Function): void; + +declare function test(description: string, action: Function): void; + +interface FieldObj { + field: any; +} + +class CrashyObject { + inspect(): void { + throw new Error("Arg's inspect() called even though the test passed"); + } +} + +declare function foobar(): T; + +suite("assert", () => { + test("assert", () => { + const foo = "bar" as string; + assert(foo === "bar", "expected foo to equal `bar`"); + + function assertTypeNever(_: never) {} + if (foo !== "bar") { + assertTypeNever(foo); + } + }); + + test("isTrue", () => { + assert.isTrue(true); + assert.isTrue(false); + assert.isTrue(1); + assert.isTrue("test"); + }); + + test("ok", () => { + assert.ok(true); + assert.ok(1); + assert.ok("test"); + assert.isOk(true); + assert.isOk(1); + assert.isOk("test"); + assert.ok(false); + assert.ok(0); + assert.ok(""); + }); + + test("notOk", () => { + assert.notOk(false); + assert.notOk(0); + assert.notOk(""); + assert.isNotOk(false); + assert.isNotOk(0); + assert.isNotOk(""); + assert.notOk(true); + assert.notOk(1); + assert.notOk("test"); + }); + + test("isFalse", () => { + assert.isFalse(false); + assert.isFalse(true); + assert.isFalse(0); + }); + + test("finite", () => { + assert.isFinite(1); + }); + + test("equal", () => { + assert.equal(void (0), undefined); + }); + + test("typeof / notTypeOf", () => { + assert.typeOf("test", "string"); + assert.typeOf(true, "boolean"); + assert.typeOf(5, "number"); + assert.typeOf(5, "string"); + }); + + test("notTypeOf", () => { + assert.notTypeOf("test", "number"); + assert.notTypeOf(5, "number"); + }); + + test("instanceOf", () => { + assert.instanceOf(new Foo(), Foo); + assert.instanceOf(5, Foo); + assert.instanceOf(new CrashyObject(), CrashyObject); + }); + + test("notInstanceOf", () => { + assert.notInstanceOf(new Foo(), String); + assert.notInstanceOf(new Foo(), Foo); + }); + + test("isObject", () => { + assert.isObject({}); + assert.isObject(new Foo()); + assert.isObject(true); + assert.isObject(Foo); + assert.isObject("foo"); + }); + + test("isNotObject", () => { + assert.isNotObject(5); + assert.isNotObject({}); + }); + + test("notEqual", () => { + assert.notEqual(3, 4); + assert.notEqual(5, 5); + }); + + test("strictEqual", () => { + assert.strictEqual("foo", "foo"); + }); + + test("notStrictEqual", () => { + assert.notStrictEqual(5, 5); + }); + + test("deepEqual", () => { + assert.deepEqual({ tea: "chai" }, { tea: "chai" }); + assert.deepEqual({ tea: "chai" }, { tea: "black" }); + + const obja = Object.create({ tea: "chai" }); + const objb = Object.create({ tea: "chai" }); + + assert.deepEqual(obja, objb); + + const obj1 = Object.create({ tea: "chai" }); + const obj2 = Object.create({ tea: "black" }); + + assert.deepEqual(obj1, obj2); + }); + + test("deepEqual (ordering)", () => { + const a = { a: "b", c: "d" }; + const b = { c: "d", a: "b" }; + assert.deepEqual(a, b); + }); + + test("deepEqual (circular)", () => { + const circularObject: any = {}; + const secondCircularObject: any = {}; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.deepEqual(circularObject, secondCircularObject); + + secondCircularObject.field2 = secondCircularObject; + assert.deepEqual(circularObject, secondCircularObject); + }); + + test("notDeepEqual", () => { + assert.notDeepEqual({ tea: "jasmine" }, { tea: "chai" }); + assert.notDeepEqual({ tea: "chai" }, { tea: "chai" }); + }); + + test("notDeepEqual (circular)", () => { + const circularObject: any = {}; + const secondCircularObject: any = { tea: "jasmine" }; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.notDeepEqual(circularObject, secondCircularObject); + + delete secondCircularObject.tea; + assert.notDeepEqual(circularObject, secondCircularObject); + }); + + test("deepStrictEqual", () => { + assert.deepStrictEqual({ tea: "chai" }, { tea: "chai" }); + assert.throws(() => assert.deepStrictEqual({ tea: "chai" }, { tea: "black" })); + + const obja = Object.create({ tea: "chai" }); + const objb = Object.create({ tea: "chai" }); + + assert.deepStrictEqual(obja, objb); + + const obj1 = Object.create({ tea: "chai" }); + const obj2 = Object.create({ tea: "black" }); + + assert.throws(() => assert.deepStrictEqual(obj1, obj2)); + }); + + test("deepStrictEqual (ordering)", () => { + const a = { a: "b", c: "d" }; + const b = { c: "d", a: "b" }; + assert.deepStrictEqual(a, b); + }); + + test("deepStrictEqual (circular)", () => { + const circularObject: any = {}; + const secondCircularObject: any = {}; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.deepStrictEqual(circularObject, secondCircularObject); + + secondCircularObject.field2 = secondCircularObject; + assert.deepStrictEqual(circularObject, secondCircularObject); + }); + + test("isNull", () => { + assert.isNull(null); + assert.isNull(undefined); + }); + + test("isNotNull", () => { + assert.isNotNull(undefined); + assert.isNotNull(null); + }); + + test("isUndefined", () => { + assert.isUndefined(undefined); + assert.isUndefined(null); + }); + + test("isDefined", () => { + assert.isDefined(null); + assert.isDefined(undefined); + }); + + test("isNaN", () => { + assert.isNaN(NaN); + assert.isNaN(12); + }); + + test("isNotNaN", () => { + assert.isNotNaN(12); + assert.isNotNaN(NaN); + }); + + test("isFunction", () => { + const func = () => { + }; + assert.isFunction(func); + assert.isFunction({}); + }); + + test("isNotFunction", () => { + assert.isNotFunction(5); + assert.isNotFunction(() => { + }); + }); + + test("isArray", () => { + assert.isArray([]); + assert.isArray(new Array()); + assert.isArray({}); + }); + + test("isNotArray", () => { + assert.isNotArray(3); + assert.isNotArray([]); + assert.isNotArray(new Array()); + }); + + test("isString", () => { + assert.isString("Foo"); + // tslint:disable-next-line:no-construct + assert.isString(new String("foo")); + assert.isString(1); + }); + + test("isNotString", () => { + assert.isNotString(3); + assert.isNotString(["hello"]); + assert.isNotString("hello"); + }); + + test("isNumber", () => { + assert.isNumber(1); + assert.isNumber(Number("3")); + assert.isNumber("1"); + }); + + test("isNotNumber", () => { + assert.isNotNumber("hello"); + assert.isNotNumber([5]); + assert.isNotNumber(4); + }); + + test("isBoolean", () => { + assert.isBoolean(true); + assert.isBoolean(false); + assert.isBoolean("1"); + }); + + test("isNotBoolean", () => { + assert.isNotBoolean("true"); + assert.isNotBoolean(true); + assert.isNotBoolean(false); + }); + + test("include", () => { + assert.include("foobar", "bar"); + assert.include([1, 2, 3], 3); + assert.include({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 }); + assert.include(new Set([1, 2]), 2); + assert.include(new Map([["a", 1], ["b", 2]]), 2); + + const a = {}; + assert.include(new WeakSet([{}, a]), a); + }); + + test("notInclude", () => { + assert.notInclude("foobar", "baz"); + assert.notInclude([1, 2, 3], 4); + assert.notInclude({ a: 1, b: 2, c: 3 }, { a: 6, b: 2 }); + assert.notInclude(new Set([1, 2]), 8); + assert.notInclude(new WeakSet([{}, {}]), {}); + assert.notInclude(new Map([["a", 1], ["b", 2]]), 8); + }); + + test("deepInclude", () => { + assert.deepInclude("foobar", "bar"); + assert.deepInclude([1, { a: 1 }, 3], { a: 1 }); + assert.deepInclude({ a: 1, b: { d: 4 }, c: 3 }, { a: 1, b: { d: 4 } }); + assert.deepInclude(new Set([{ a: 1 }, { a: 2 }]), { a: 2 }); + // deep include does not support ('cause)[https://github.com/chaijs/chai/blob/7ff12731428ab5d12f1e77e32d6a8d3eb967d082/lib/chai/core/assertions.js#L492] + // assert.deepInclude(new WeakSet([ {}, {} ]), {}); + assert.deepInclude(new Map([["a", { a: 1 }], ["b", { a: 2 }]]), { a: 1 }); + }); + + test("notDeepInclude", () => { + assert.notDeepInclude("foobar", "baz"); + assert.notDeepInclude([1, { a: 1 }, 3], { a: 3 }); + assert.notDeepInclude({ a: 1, b: { d: 4 }, c: 3 }, { a: 1, b: { d: 6 } }); + assert.notDeepInclude(new Set([{ a: 1 }, { a: 2 }]), { a: 3 }); + // deep include does not support ('cause)[https://github.com/chaijs/chai/blob/7ff12731428ab5d12f1e77e32d6a8d3eb967d082/lib/chai/core/assertions.js#L492] + // assert.notDeepInclude(new WeakSet([ {}, {} ]), {}); + assert.notDeepInclude(new Map([["a", { a: 1 }], ["b", { a: 2 }]]), { a: 8 }); + }); + + test("nestedInclude", () => { + assert.nestedInclude({ ".a": { b: "x" } }, { "\\.a.[b]": "x" }); + assert.nestedInclude({ a: { "[b]": "x" } }, { "a.\\[b\\]": "x" }); + }); + + test("notNestedInclude", () => { + assert.notNestedInclude({ ".a": { b: "x" } }, { "\\.a.b": "y" }); + assert.notNestedInclude({ a: { "[b]": "x" } }, { "a.\\[b\\]": "y" }); + }); + + test("deepNestedInclude", () => { + assert.deepNestedInclude({ a: { b: [{ x: 1 }] } }, { "a.b[0]": { x: 1 } }); + assert.deepNestedInclude({ ".a": { "[b]": { x: 1 } } }, { "\\.a.\\[b\\]": { x: 1 } }); + }); + + test("notDeepNestedInclude", () => { + assert.notDeepNestedInclude({ a: { b: [{ x: 1 }] } }, { "a.b[0]": { y: 1 } }); + assert.notDeepNestedInclude({ ".a": { "[b]": { x: 1 } } }, { "\\.a.\\[b\\]": { y: 2 } }); + }); + + test("ownInclude", () => { + assert.ownInclude({ a: 1 }, { a: 1 }); + }); + + test("notOwnInclude", () => { + assert.notOwnInclude({ a: 1 }, { a: 1 }); + }); + + test("deepOwnInclude", () => { + assert.deepOwnInclude({ a: { b: 2 } }, { a: { b: 2 } }); + }); + + test("notDeepOwnInclude", () => { + assert.notDeepOwnInclude({ a: { b: 2 } }, { a: { c: 3 } }); + }); + + test("lengthOf", () => { + assert.lengthOf([1, 2, 3], 3); + assert.lengthOf("foobar", 6); + assert.lengthOf("foobar", 5); + assert.lengthOf({ length: 1 }, 5); + assert.lengthOf(new Set([1, 2, 3]), 3); + assert.lengthOf(new Map([["a", 1], ["b", 2], ["c", 3]]), 3); + }); + + test("match", () => { + assert.match("foobar", /^foo/); + assert.notMatch("foobar", /^bar/); + assert.match("foobar", /^bar/i); + assert.notMatch("foobar", /^foo/i); + }); + + test("property", () => { + const obj = { foo: { bar: "baz" } }; + const simpleObj = { foo: "bar" } as any; + assert.property(obj, "foo"); + assert.deepProperty(obj, "foo.bar"); + assert.notDeepProperty(obj, "foo.baz"); + assert.deepPropertyVal(obj, "foo.bar", "baz"); + assert.notDeepPropertyVal(simpleObj, "foo.bar", "flow"); + assert.property(simpleObj, "baz"); + assert.deepProperty(obj, "foo.baz"); + assert.notProperty(obj, "foo"); + assert.notDeepProperty(obj, "foo.bar"); + assert.propertyVal(simpleObj, "foo", "ball"); + assert.deepPropertyVal(obj, "foo.bar", "ball"); + assert.notPropertyVal(simpleObj, "foo", "bar"); + assert.notDeepPropertyVal(simpleObj, "foo.bar", "baz"); + }); + + test("throws", () => { + const errorInstance = new ReferenceError("foo"); + const fn = () => { + throw errorInstance; + }; + + assert.throws(fn); + assert.throws(fn, "foo"); + assert.throws(fn, /foo/); + assert.throws(fn, ReferenceError); + assert.throws(fn, errorInstance); + assert.throws(fn, ReferenceError, "foo"); + assert.throws(fn, errorInstance, "foo"); + assert.throws(fn, ReferenceError, /foo/); + assert.throws(fn, errorInstance, /foo/); + + assert.throws(fn, null, null, "message"); + assert.throws(fn, "foo", null, "message"); + assert.throws(fn, /foo/, null, "message"); + assert.throws(fn, ReferenceError, null, "message"); + assert.throws(fn, errorInstance, null, "message"); + assert.throws(fn, ReferenceError, "foo", "message"); + assert.throws(fn, errorInstance, "foo", "message"); + assert.throws(fn, ReferenceError, /foo/, "message"); + assert.throws(fn, errorInstance, /foo/, "message"); + }); + + test("doesNotThrow", () => { + const errorInstance = new ReferenceError("foo"); + const fn = () => { + throw new Error("bar"); + }; + + assert.doesNotThrow(() => {}); + assert.doesNotThrow(fn, "foo"); + assert.doesNotThrow(fn, /foo/); + assert.doesNotThrow(fn, ReferenceError); + assert.doesNotThrow(fn, errorInstance); + assert.doesNotThrow(fn, ReferenceError, "foo"); + assert.doesNotThrow(fn, errorInstance, "foo"); + assert.doesNotThrow(fn, ReferenceError, /foo/); + assert.doesNotThrow(fn, errorInstance, /foo/); + + assert.doesNotThrow(fn, null, null, "message"); + assert.doesNotThrow(fn, "foo", null, "message"); + assert.doesNotThrow(fn, /foo/, null, "message"); + assert.doesNotThrow(fn, ReferenceError, null, "message"); + assert.doesNotThrow(fn, errorInstance, null, "message"); + assert.doesNotThrow(fn, ReferenceError, "foo", "message"); + assert.doesNotThrow(fn, errorInstance, "foo", "message"); + assert.doesNotThrow(fn, ReferenceError, /foo/, "message"); + assert.doesNotThrow(fn, errorInstance, /foo/, "message"); + }); + + test("ifError", () => { + assert.ifError(false); + assert.ifError(null); + assert.ifError(undefined); + assert.ifError("foo"); + }); + + test("operator", () => { + assert.operator(1, "<", 2); + assert.operator(2, ">", 1); + assert.operator(1, "==", 1); + assert.operator(1, "<=", 1); + assert.operator(1, ">=", 1); + assert.operator(1, "!=", 2); + assert.operator(1, "!==", 2); + assert.operator(2, "<", 1); + assert.operator(1, ">", 2); + assert.operator(1, "==", 2); + assert.operator(2, "<=", 1); + assert.operator(1, ">=", 2); + assert.operator(1, "!=", 1); + assert.operator(1, "!==", "1"); + }); + + test("closeTo", () => { + assert.closeTo(1.5, 1.0, 0.5); + assert.closeTo(10, 20, 20); + assert.closeTo(-10, 20, 30); + assert.closeTo(2, 1.0, 0.5); + assert.closeTo(-10, 20, 29); + }); + + test("approximately", () => { + assert.approximately(1.5, 1.0, 0.5); + assert.approximately(10, 20, 20); + assert.approximately(-10, 20, 30); + assert.approximately(2, 1.0, 0.5); + assert.approximately(-10, 20, 29); + }); + + test("members", () => { + assert.includeMembers([1, 2, 3], [2, 3]); + assert.includeMembers([1, 2, 3], []); + assert.includeMembers([1, 2, 3], [3]); + assert.includeMembers([5, 6], [7, 8]); + assert.includeMembers([5, 6], [5, 6, 0]); + + assert.notIncludeMembers([1, 2, 3], [5, 1], "not include members"); + }); + + test("memberEquals", () => { + assert.sameMembers([], []); + assert.sameMembers([1, 2, 3], [3, 2, 1]); + assert.sameMembers([4, 2], [4, 2]); + assert.sameMembers([], [1, 2]); + assert.sameMembers([1, 54], [6, 1, 54]); + }); + + test("isAbove", () => { + assert.isAbove(10, 5); + assert.isAbove(1, 5); + assert.isAbove(5, 5); + }); + + test("isBelow", () => { + assert.isBelow(5, 10); + assert.isBelow(5, 1); + assert.isBelow(5, 5); + }); + + test("extensible", () => { + assert.extensible({}); + }); + test("isExtensible", () => { + assert.isExtensible({}); + }); + test("notExtensible", () => { + assert.notExtensible(Object.preventExtensions({})); + }); + test("isNotExtensible", () => { + assert.isNotExtensible(Object.preventExtensions({})); + }); + + test("sealed", () => { + assert.sealed(Object.seal({})); + }); + test("isSealed", () => { + assert.isSealed(Object.seal({})); + }); + test("notSealed", () => { + assert.notSealed({}); + }); + test("isNotSealed", () => { + assert.isNotSealed({}); + }); + + test("frozen", () => { + assert.frozen(Object.freeze({})); + }); + test("isFrozen", () => { + assert.isFrozen(Object.freeze({})); + }); + test("notFrozen", () => { + assert.notFrozen({}); + }); + test("isNotFrozen", () => { + assert.isNotFrozen({}); + }); + + test("isNotTrue", () => { + assert.isNotTrue(false); + assert.isNotTrue(true); + }); + + test("isNotFalse", () => { + assert.isNotFalse(true); + assert.isNotFalse(false); + }); + + test("isAtLeast", () => { + assert.isAtLeast(5, 3); + assert.isAtLeast(5, 5); + assert.isAtLeast(3, 5); + }); + + test("isAtMost", () => { + assert.isAtMost(3, 5); + assert.isAtMost(5, 5); + assert.isAtMost(5, 3); + }); + + test("oneOf", () => { + const obj = { z: 3 }; + + assert.oneOf(5, [1, 5, 4]); + assert.oneOf("z", ["x", "y", "z"]); + assert.oneOf(obj, [obj]); + assert.oneOf(5, [1, [5], 4]); + assert.oneOf("z", ["w", "x", "y"]); + assert.oneOf(obj, [{ z: 3 }]); + }); + + test("changes", () => { + const obj = { z: 3 }; + + assert.changes( + () => { + }, + obj, + "z", + ); + assert.changes( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("changesBy", () => { + const obj = { value: 10 }; + const fn = function() { + obj.value += 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.changesBy(fn, obj, "value", 5); + assert.changesBy(fn, getterFn, 5); + }); + + test("doesNotChange", () => { + const obj = { z: 3 }; + + assert.doesNotChange( + () => { + }, + obj, + "z", + ); + assert.doesNotChange( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("increases", () => { + const obj = { z: 3 }; + + assert.increases( + () => { + }, + obj, + "z", + ); + assert.increases( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("increasesBy", () => { + const obj = { value: 10 }; + const incFn = function() { + obj.value += 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.increasesBy(incFn, obj, "value", 5); + assert.increasesBy(incFn, getterFn, 5); + }); + + test("doesNotIncrease", () => { + const obj = { z: 3 }; + + assert.doesNotIncrease( + () => { + }, + obj, + "z", + ); + assert.doesNotIncrease( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("increasesButNotBy", () => { + const obj = { value: 10 }; + const incFn = function() { + obj.value += 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.increasesButNotBy(incFn, obj, "value", 1); + assert.increasesButNotBy(incFn, getterFn, 1); + }); + + test("decreases", () => { + const obj = { z: 3 }; + + assert.decreases( + () => { + }, + obj, + "z", + ); + assert.decreases( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("decreasesBy", () => { + const obj = { value: 10 }; + const decFn = function() { + obj.value -= 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.decreasesBy(decFn, obj, "value", 5); + assert.decreasesBy(decFn, getterFn, 5); + }); + + test("doesNotDecrease", () => { + const obj = { z: 3 }; + + assert.doesNotDecrease( + () => { + }, + obj, + "z", + ); + assert.doesNotDecrease( + () => { + }, + obj, + "z", + "message", + ); + }); + + test("doesNotDecreaseBy", () => { + const obj = { value: 10 }; + const decFn = function() { + obj.value -= 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.doesNotDecreaseBy(decFn, obj, "val", 1); + assert.doesNotDecreaseBy(decFn, getterFn, 1); + }); + + test("decreasesButNotBy", () => { + const obj = { value: 10 }; + const decFn = function() { + obj.value -= 5; + }; + const getterFn = function() { + return obj.value; + }; + + assert.decreasesButNotBy(decFn, obj, "val", 1); + assert.decreasesButNotBy(decFn, getterFn, 1); + }); + + test("ifError", () => { + const obj = { z: 3 }; + assert.ifError(obj); + assert.ifError(obj, "message"); + }); + + test("extensible", () => { + const obj = { z: 3 }; + + assert.extensible(obj); + assert.extensible(obj, "message"); + }); + + test("isNotExtensible", () => { + const obj = { z: 3 }; + + assert.isNotExtensible(obj); + assert.isNotExtensible(obj, "message"); + }); + + test("isSealed", () => { + const obj = { z: 3 }; + + assert.isSealed(obj); + assert.isSealed(obj, "message"); + }); + + test("sealed", () => { + const obj = { z: 3 }; + + assert.sealed(obj); + assert.sealed(obj, "message"); + }); + + test("isNotSealed", () => { + const obj = { z: 3 }; + + assert.isNotSealed(obj); + assert.isNotSealed(obj, "message"); + }); + + test("notSealed", () => { + const obj = { z: 3 }; + + assert.notSealed(obj); + assert.notSealed(obj, "message"); + }); + + test("isFrozen", () => { + const obj = { z: 3 }; + + assert.isFrozen(obj); + assert.isFrozen(obj, "message"); + }); + + test("frozen", () => { + const obj = { z: 3 }; + + assert.frozen(obj); + assert.frozen(obj, "message"); + }); + + test("isNotFrozen", () => { + const obj = { z: 3 }; + + assert.isNotFrozen(obj); + assert.isNotFrozen(obj, "message"); + }); + + test("notFrozen", () => { + const obj = { z: 3 }; + + assert.notFrozen(obj); + assert.notFrozen(obj, "message"); + }); + + test("hasAnyKeys", () => { + assert.hasAnyKeys({ foo: 1, bar: 2, baz: 3 }, ["foo", "iDontExist", "baz"]); + assert.hasAnyKeys({ foo: 1, bar: 2, baz: 3 }, { foo: 30, iDontExist: 99, baz: 1337 }); + assert.hasAnyKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [{ foo: 1 }, "key"]); + assert.hasAnyKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ foo: "bar" }, "anotherKey"]); + }); + + test("hasAllKeys", () => { + assert.hasAllKeys({ foo: 1, bar: 2, baz: 3 }, ["foo", "bar", "baz"]); + assert.hasAllKeys({ foo: 1, bar: 2, baz: 3 }, { foo: 30, bar: 99, baz: 1337 }); + assert.hasAllKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [{ foo: 1 }, "key"]); + assert.hasAllKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ foo: "bar" }, "anotherKey"]); + }); + + test("containsAllKeys", () => { + assert.containsAllKeys({ foo: 1, bar: 2, baz: 3 }, ["foo", "baz"]); + assert.containsAllKeys({ foo: 1, bar: 2, baz: 3 }, ["foo", "bar", "baz"]); + assert.containsAllKeys({ foo: 1, bar: 2, baz: 3 }, { foo: 30, baz: 1337 }); + assert.containsAllKeys({ foo: 1, bar: 2, baz: 3 }, { foo: 30, bar: 99, baz: 1337 }); + assert.containsAllKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [{ foo: 1 }]); + assert.containsAllKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [{ foo: 1 }, "key"]); + assert.containsAllKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ foo: "bar" }]); + assert.containsAllKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ foo: "bar" }, "anotherKey"]); + }); + + test("doesNotHaveAnyKeys", () => { + assert.doesNotHaveAnyKeys({ foo: 1, bar: 2, baz: 3 }, ["one", "two", "example"]); + assert.doesNotHaveAnyKeys({ foo: 1, bar: 2, baz: 3 }, { one: 1, two: 2, example: "foo" }); + assert.doesNotHaveAnyKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [ + { one: "two" }, + "example", + ]); + assert.doesNotHaveAnyKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ one: "two" }, "example"]); + }); + + test("doesNotHaveAllKeys", () => { + assert.doesNotHaveAllKeys({ foo: 1, bar: 2, baz: 3 }, ["one", "two", "example"]); + assert.doesNotHaveAllKeys({ foo: 1, bar: 2, baz: 3 }, { one: 1, two: 2, example: "foo" }); + assert.doesNotHaveAllKeys(new Map([[{ foo: 1 }, "bar"], ["key", "value"]]), [ + { one: "two" }, + "example", + ]); + assert.doesNotHaveAllKeys(new Set([{ foo: "bar" }, "anotherKey"]), [{ one: "two" }, "example"]); + }); + + test("hasAnyDeepKeys", () => { + assert.hasAnyDeepKeys(new Map([[{ one: "one" }, "valueOne"], [1, 2]]), { one: "one" }); + assert.hasAnyDeepKeys(new Map([[{ one: "one" }, "valueOne"], [1, 2]]), [{ one: "one" }, { + two: "two", + }]); + assert.hasAnyDeepKeys(new Map([[{ one: "one" }, "valueOne"], [{ two: "two" }, "valueTwo"]]), [{ + one: "one", + }, { two: "two" }]); + assert.hasAnyDeepKeys(new Set([{ one: "one" }, { two: "two" }]), { one: "one" }); + assert.hasAnyDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ one: "one" }, { three: "three" }]); + assert.hasAnyDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ one: "one" }, { two: "two" }]); + }); + + test("hasAllDeepKeys", () => { + assert.hasAllDeepKeys(new Map([[{ one: "one" }, "valueOne"]]), { one: "one" }); + assert.hasAllDeepKeys(new Map([[{ one: "one" }, "valueOne"], [{ two: "two" }, "valueTwo"]]), [{ + one: "one", + }, { two: "two" }]); + assert.hasAllDeepKeys(new Set([{ one: "one" }]), { one: "one" }); + assert.hasAllDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ one: "one" }, { two: "two" }]); + }); + + test("containsAllDeepKeys", () => { + assert.containsAllDeepKeys(new Map([[{ one: "one" }, "valueOne"], [1, 2]]), { one: "one" }); + assert.containsAllDeepKeys(new Map([[{ one: "one" }, "valueOne"], [{ two: "two" }, "valueTwo"]]), [{ + one: "one", + }, { two: "two" }]); + assert.containsAllDeepKeys(new Set([{ one: "one" }, { two: "two" }]), { one: "one" }); + assert.containsAllDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ one: "one" }, { two: "two" }]); + }); + + test("doesNotHaveAnyDeepKeys", () => { + assert.doesNotHaveAnyDeepKeys(new Map([[{ one: "one" }, "valueOne"], [1, 2]]), { + thisDoesNot: "exist", + }); + assert.doesNotHaveAnyDeepKeys(new Map([[{ one: "one" }, "valueOne"], [{ two: "two" }, "valueTwo"]]), [ + { twenty: "twenty" }, + { fifty: "fifty" }, + ]); + assert.doesNotHaveAnyDeepKeys(new Set([{ one: "one" }, { two: "two" }]), { twenty: "twenty" }); + assert.doesNotHaveAnyDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ twenty: "twenty" }, { + fifty: "fifty", + }]); + }); + + test("doesNotHaveAllDeepKeys", () => { + assert.doesNotHaveAllDeepKeys(new Map([[{ one: "one" }, "valueOne"], [1, 2]]), { + thisDoesNot: "exist", + }); + assert.doesNotHaveAllDeepKeys(new Map([[{ one: "one" }, "valueOne"], [{ two: "two" }, "valueTwo"]]), [ + { twenty: "twenty" }, + { one: "one" }, + ]); + assert.doesNotHaveAllDeepKeys(new Set([{ one: "one" }, { two: "two" }]), { twenty: "twenty" }); + assert.doesNotHaveAllDeepKeys(new Set([{ one: "one" }, { two: "two" }]), [{ one: "one" }, { fifty: "fifty" }]); + }); + + test("nestedProperty", () => { + assert.nestedProperty({ tea: { green: "matcha" } }, "tea.green"); + assert.nestedProperty({ tea: { green: "matcha" } }, "tea.green", "Should have tea.green nested property"); + }); + + test("notNestedProperty", () => { + assert.notNestedProperty({ tea: { green: "matcha" } }, "tea.oolong"); + assert.notNestedProperty( + { tea: { green: "matcha" } }, + "tea.oolong", + "Should not have tea.oolong nested property", + ); + }); + + test("nestedPropertyVal", () => { + assert.nestedPropertyVal({ tea: { green: "matcha" } }, "tea.green", "matcha"); + assert.nestedPropertyVal( + { tea: { green: "matcha" } }, + "tea.green", + "matcha", + "Should have tea.green nested property", + ); + }); + + test("notNestedPropertyVal", () => { + assert.notNestedPropertyVal({ tea: { green: "matcha" } }, "tea.green", "konacha"); + assert.notNestedPropertyVal({ tea: { green: "matcha" } }, "coffee.green", "matcha"); + assert.notNestedPropertyVal( + { tea: { green: "matcha" } }, + "tea.green", + "konacha", + "Should not have konacha as value", + ); + assert.notNestedPropertyVal( + { tea: { green: "matcha" } }, + "coffee.green", + "matcha", + "Should not have matcha as value", + ); + }); + + test("deepNestedPropertyVal", () => { + assert.deepNestedPropertyVal({ tea: { green: { matcha: "yum" } } }, "tea.green", { matcha: "yum" }); + assert.deepNestedPropertyVal( + { tea: { green: { matcha: "yum" } } }, + "tea.green", + { matcha: "yum" }, + "Should have correct value of the property", + ); + }); + + test("notDeepNestedPropertyVal", () => { + assert.notDeepNestedPropertyVal({ tea: { green: { matcha: "yum" } } }, "tea.green", { oolong: "yum" }); + assert.notDeepNestedPropertyVal({ tea: { green: { matcha: "yum" } } }, "tea.green", { matcha: "yuck" }); + assert.notDeepNestedPropertyVal({ tea: { green: { matcha: "yum" } } }, "tea.black", { matcha: "yum" }); + assert.notDeepNestedPropertyVal( + { tea: { green: { matcha: "yum" } } }, + "tea.green", + { oolong: "yum" }, + "Should have correct value of the property", + ); + assert.notDeepNestedPropertyVal( + { tea: { green: { matcha: "yum" } } }, + "tea.green", + { matcha: "yuck" }, + "Should have correct value of the property", + ); + assert.notDeepNestedPropertyVal( + { tea: { green: { matcha: "yum" } } }, + "tea.black", + { matcha: "yum" }, + "Should have correct value of the property", + ); + }); + + test("notIncludeDeepMembers", () => { + assert.notIncludeDeepMembers([{ a: 1 }, { b: 2 }, { c: 3 }], [{ b: 2 }], "not include deep members"); + }); +}); + +suite("narrowing", () => { + test("assert", () => { + const x = foobar(); + assert(typeof x === "number"); + const y: number = x; + }); + + test("isOk", () => { + const x = foobar(); + assert.isOk(typeof x === "number"); + const y: number = x; + }); + + test("ok", () => { + const x = foobar(); + assert.ok(typeof x === "number"); + const y: number = x; + }); + + test("isTrue", () => { + const x = foobar(); + assert.isTrue(x); + const y: true = x; + }); + + test("isFalse", () => { + const x = foobar(); + assert.isFalse(x); + const y: false = x; + }); + + test("isNotTrue", () => { + const x = foobar(); + assert.isNotTrue(x); + const y: number = x; + }); + + test("isNotFalse", () => { + const x = foobar(); + assert.isNotFalse(x); + const y: number = x; + }); + + test("isNull", () => { + const x = foobar(); + assert.isNull(x); + const y: null = x; + }); + + test("isNotNull", () => { + const x = foobar(); + assert.isNotNull(x); + const y: number = x; + }); + + test("exists", () => { + const x = foobar(); + assert.exists(x); + const y: number = x; + }); + + test("notExists", () => { + const x = foobar(); + assert.notExists(x); + const y: null | undefined = x; + }); + + test("isUndefined", () => { + const x = foobar(); + assert.isUndefined(x); + const y: undefined = x; + }); + + test("isDefined", () => { + const x = foobar(); + assert.isDefined(x); + const y: number = x; + }); + + test("instanceOf", () => { + const x = foobar(); + assert.instanceOf(x, Foo); + const y: Foo = x; + }); + + test("notInstanceOf", () => { + const x = foobar(); + assert.notInstanceOf(x, Foo); + const y: null = x; + }); +}); + +function configuringDeepEqual() { + config.deepEqual = (expected, actual) => { + return util.eql(expected, actual, { + comparator: (expected, actual) => { + // for non number comparison, use the default behavior + if (typeof expected !== "number") return null; + // allow a difference of 10 between compared numbers + return typeof actual === "number" && Math.abs(actual - expected) < 10; + }, + }); + }; +} diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 2a09d9108bd2ab..013791b40f6c7c 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -3,11 +3,22 @@ import { assert, config, expect, Should, use, util } from "chai"; const should = Should(); +function _noShould() { + // @ts-expect-error :: cannot use .should syntax by default + "test".should.not.be.ok; + + interface QueryContainer { + query?: { + should?: string; + }; + } + + const query: QueryContainer = { query: {} }; +} + function assertion() { expect("test").to.be.a("string"); - "test".should.be.a("string"); expect("foo").to.equal("foo"); - "foo".should.equal("foo"); should.equal("foo", "foo"); } @@ -21,53 +32,37 @@ function fail() { function _true() { expect(true).to.be.true; - true.should.be.true; expect(false).to.not.be.true; - false.should.not.be.true; expect(1).to.not.be.true; - (1).should.not.be.true; expect("test").to.be.true; - "test".should.be.true; } function ok() { expect(true).to.be.ok; - true.should.be.ok; expect(false).to.not.be.ok; - false.should.not.be.ok; expect(1).to.be.ok; - (1).should.be.ok; expect(0).to.not.be.ok; - (0).should.not.be.ok; expect("").to.be.ok; - "".should.be.ok; expect("test").to.not.be.ok; - "test".should.not.be.ok; } function _false() { expect(false).to.be.false; - false.should.be.false; expect(true).to.not.be.false; - true.should.not.be.false; expect(0).to.not.be.false; - (0).should.not.be.false; expect("").to.be.false; - "".should.be.false; } function _null() { expect(null).to.be.null; should.equal(null, null); expect(false).to.not.be.null; - false.should.not.be.null; expect("").to.be.null; - "".should.be.null; } function _undefined() { @@ -77,16 +72,12 @@ function _undefined() { should.not.equal(null, undefined); expect("").to.be.undefined; - "".should.be.undefined; } function _NaN() { expect(NaN).to.be.NaN; expect(12).to.be.not.NaN; expect("NaN").to.be.not.NaN; - NaN.should.be.NaN; - (12).should.be.not.NaN; - ("NaN").should.be.not.NaN; } function exist() { @@ -100,13 +91,9 @@ function exist() { function argumentsTest() { const args = arguments; expect(args).to.be.arguments; - args.should.be.arguments; expect([]).to.not.be.arguments; - [].should.not.be.arguments; expect(args).to.be.an("arguments").and.be.arguments; - args.should.be.an("arguments").and.be.arguments; expect([]).to.be.an("array").and.not.be.Arguments; - [].should.be.an("array").and.not.be.Arguments; } function equal() { @@ -116,7 +103,6 @@ function equal() { function containSubset() { expect({}).to.containSubset({}); - ({}).should.containSubset({}); assert.containSubset({}, {}); assert.containsSubset({}, {}); assert.doesNotContainSubset({}, {}); @@ -124,42 +110,28 @@ function containSubset() { function _typeof() { expect("test").to.be.a("string"); - "test".should.be.a("string"); expect("test").to.not.be.a("string"); - "test".should.not.be.a("string"); expect(arguments).to.be.an("arguments"); - arguments.should.be.an("arguments"); expect(5).to.be.a("number"); - (5).should.be.a("number"); // tslint:disable-next-line:no-construct expect(new Number(1)).to.be.a("number"); // tslint:disable-next-line:no-construct - (new Number(1)).should.be.a("number"); expect(Number(1)).to.be.a("number"); - Number(1).should.be.a("number"); expect(true).to.be.a("boolean"); - true.should.be.a("boolean"); expect(new Array()).to.be.a("array"); - (new Array()).should.be.a("array"); expect(new Object()).to.be.a("object"); - (new Object()).should.be.a("object"); expect({}).to.be.a("object"); - ({}).should.be.a("object"); expect([]).to.be.a("array"); - [].should.be.a("array"); expect(() => { }).to.be.a("function"); - (() => { - }).should.be.a("function"); expect(null).to.be.a("null"); // N.B. previous line has no should equivalent expect(5).to.not.be.a("number", "blah"); - (5).should.not.be.a("number", "blah"); } function finite() { @@ -171,340 +143,221 @@ class Foo { function _instanceof() { expect(new Foo()).to.be.an.instanceof(Foo); - (new Foo()).should.be.an.instanceof(Foo); expect(3).to.an.instanceof(Foo, "blah"); - (3).should.an.instanceof(Foo, "blah"); } function within() { expect(5).to.be.within(5, 10); - (5).should.be.within(5, 10); expect(5).to.be.within(3, 6); - (5).should.be.within(3, 6); expect(5).to.be.within(3, 5); - (5).should.be.within(3, 5); expect(5).to.not.be.within(1, 3); - (5).should.not.be.within(1, 3); expect("foo").to.have.length.within(2, 4); - "foo".should.have.length.within(2, 4); expect([1, 2, 3]).to.have.length.within(2, 4); - [1, 2, 3].should.have.length.within(2, 4); expect(5).to.not.be.within(4, 6, "blah"); - (5).should.not.be.within(4, 6, "blah"); expect(10).to.be.within(50, 100, "blah"); - (10).should.be.within(50, 100, "blah"); expect(new Date("December 17, 1995 03:24:30")).to.not.be.within( new Date("December 17, 1995 03:24:20"), new Date("December 17, 1995 03:24:40"), ); - new Date("December 17, 1995 03:24:30").should.not.be.within( - new Date("December 17, 1995 03:24:20"), - new Date("December 17, 1995 03:24:40"), - ); expect(new Date("December 17, 1995 03:24:30")).to.be.within( new Date("December 17, 1995 03:24:20"), new Date("December 17, 1995 03:24:40"), ); - new Date("December 17, 1995 03:24:30").should.be.within( - new Date("December 17, 1995 03:24:20"), - new Date("December 17, 1995 03:24:40"), - ); expect(new Date("December 17, 1995 03:24:30")).to.not.be.within( new Date("December 17, 1995 03:24:20"), new Date("December 17, 1995 03:24:40"), "blah", ); - new Date("December 17, 1995 03:24:30").should.not.be.within( - new Date("December 17, 1995 03:24:20"), - new Date("December 17, 1995 03:24:40"), - "blah", - ); expect(new Date("December 17, 1995 03:24:30")).to.be.within( new Date("December 17, 1995 03:24:20"), new Date("December 17, 1995 03:24:40"), "blah", ); - new Date("December 17, 1995 03:24:30").should.be.within( - new Date("December 17, 1995 03:24:20"), - new Date("December 17, 1995 03:24:40"), - "blah", - ); expect("foo").to.have.length.within(5, 7, "blah"); - "foo".should.have.length.within(5, 7, "blah"); expect([1, 2, 3]).to.have.length.within(5, 7, "blah"); - [1, 2, 3].should.have.length.within(5, 7, "blah"); } function above() { expect(5).to.be.above(2); - (5).should.be.above(2); expect(5).to.be.gt(2); - (5).should.be.gt(2); expect(5).to.be.greaterThan(2); - (5).should.be.greaterThan(2); expect(5).to.not.be.above(5); - (5).should.not.be.above(5); expect(5).to.not.be.above(6); - (5).should.not.be.above(6); expect("foo").to.have.length.above(2); - "foo".should.have.length.above(2); expect([1, 2, 3]).to.have.length.above(2); - [1, 2, 3].should.have.length.above(2); expect(5).to.be.above(6, "blah"); - (5).should.be.above(6, "blah"); expect(10).to.not.be.above(6, "blah"); - (10).should.not.be.above(6, "blah"); expect(new Date("December 17, 1995 03:24:30")).to.not.be.above(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.not.be.above(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.be.above(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.be.above(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.not.be.above(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.not.be.above(new Date("December 17, 1995 03:24:20"), "blah"); expect(new Date("December 17, 1995 03:24:30")).to.be.above(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.be.above(new Date("December 17, 1995 03:24:20"), "blah"); expect("foo").to.have.length.above(4, "blah"); - "foo".should.have.length.above(4, "blah"); expect([1, 2, 3]).to.have.length.above(4, "blah"); - [1, 2, 3].should.have.length.above(4, "blah"); } function least() { expect(5).to.be.at.least(2); - (5).should.be.at.least(2); expect(5).to.be.gte(2); - (5).should.be.gte(2); expect(5).to.be.greaterThanOrEqual(2); - (5).should.be.greaterThanOrEqual(2); expect(5).to.be.at.least(5); - (5).should.be.at.least(5); expect(5).to.not.be.at.least(6); - (5).should.not.be.at.least(6); expect("foo").to.have.length.of.at.least(2); - "foo".should.have.length.of.at.least(2); expect([1, 2, 3]).to.have.length.of.at.least(2); - [1, 2, 3].should.have.length.of.at.least(2); expect(5).to.be.at.least(6, "blah"); - (5).should.be.at.least(6, "blah"); expect(10).to.not.be.at.least(6, "blah"); - (10).should.not.be.at.least(6, "blah"); expect(new Date("December 17, 1995 03:24:30")).to.not.be.least(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.not.be.least(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.be.least(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.be.least(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.not.be.least(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.not.be.least(new Date("December 17, 1995 03:24:20"), "blah"); expect(new Date("December 17, 1995 03:24:30")).to.be.least(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.be.least(new Date("December 17, 1995 03:24:20"), "blah"); expect("foo").to.have.length.of.at.least(4, "blah"); - "foo".should.have.length.of.at.least(4, "blah"); expect([1, 2, 3]).to.have.length.of.at.least(4, "blah"); - [1, 2, 3].should.have.length.of.at.least(4, "blah"); expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, "blah"); - [1, 2, 3, 4].should.not.have.length.of.at.least(4, "blah"); } function below() { expect(2).to.be.below(5); - (2).should.be.below(5); expect(2).to.be.lt(5); - (2).should.be.lt(5); expect(2).to.be.lessThan(5); - (2).should.be.lessThan(5); expect(2).to.not.be.below(2); - (2).should.not.be.below(2); expect(2).to.not.be.below(1); - (2).should.not.be.below(1); expect("foo").to.have.length.below(4); - "foo".should.have.length.below(4); expect([1, 2, 3]).to.have.length.below(4); - [1, 2, 3].should.have.length.below(4); expect(6).to.be.below(5, "blah"); - (6).should.be.below(5, "blah"); expect(6).to.not.be.below(10, "blah"); - (6).should.not.be.below(10, "blah"); expect(new Date("December 17, 1995 03:24:30")).to.not.be.below(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.not.be.below(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.be.below(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.be.below(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.not.be.below(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.not.be.below(new Date("December 17, 1995 03:24:20"), "blah"); expect(new Date("December 17, 1995 03:24:30")).to.be.below(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.be.below(new Date("December 17, 1995 03:24:20"), "blah"); expect("foo").to.have.length.below(2, "blah"); - "foo".should.have.length.below(2, "blah"); expect([1, 2, 3]).to.have.length.below(2, "blah"); - [1, 2, 3].should.have.length.below(2, "blah"); } function most() { expect(2).to.be.at.most(5); - (2).should.be.at.most(5); expect(2).to.be.lte(5); - (2).should.be.lte(5); expect(2).to.be.lessThanOrEqual(5); - (2).should.be.lessThanOrEqual(5); expect(2).to.be.at.most(2); - (2).should.be.at.most(2); expect(2).to.not.be.at.most(1); - (2).should.not.be.at.most(1); expect(2).to.not.be.at.most(1); - (2).should.not.be.at.most(1); expect("foo").to.have.length.of.at.most(4); - "foo".should.have.length.of.at.most(4); expect([1, 2, 3]).to.have.length.of.at.most(4); - [1, 2, 3].should.have.length.of.at.most(4); expect(6).to.be.at.most(5, "blah"); - (6).should.be.at.most(5, "blah"); expect(6).to.not.be.at.most(10, "blah"); - (6).should.not.be.at.most(10, "blah"); expect(new Date("December 17, 1995 03:24:30")).to.not.be.most(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.not.be.most(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.be.most(new Date("December 17, 1995 03:24:20")); - new Date("December 17, 1995 03:24:30").should.be.most(new Date("December 17, 1995 03:24:20")); expect(new Date("December 17, 1995 03:24:30")).to.not.be.most(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.not.be.most(new Date("December 17, 1995 03:24:20"), "blah"); expect(new Date("December 17, 1995 03:24:30")).to.be.most(new Date("December 17, 1995 03:24:20"), "blah"); - new Date("December 17, 1995 03:24:30").should.be.most(new Date("December 17, 1995 03:24:20"), "blah"); expect("foo").to.have.length.of.at.most(2, "blah"); - "foo".should.have.length.of.at.most(2, "blah"); expect([1, 2, 3]).to.have.length.of.at.most(2, "blah"); - [1, 2, 3].should.have.length.of.at.most(2, "blah"); expect([1, 2]).to.not.have.length.of.at.most(2, "blah"); - [1, 2].should.not.have.length.of.at.most(2, "blah"); } function match() { expect("foobar").to.match(/^foo/); - "foobar".should.match(/^foo/); expect("foobar").to.not.match(/^bar/); - "foobar".should.not.match(/^bar/); expect("foobar").matches(/^foo/); - "foobar".should.not.matches(/^bar/); expect("foobar").to.match(/^bar/i, "blah"); - "foobar".should.match(/^bar/i, "blah"); expect("foobar").to.not.match(/^foo/i, "blah"); - "foobar".should.not.match(/^foo/i, "blah"); } function length2() { expect("test").to.have.length(4); - "test".should.have.length(4); expect("test").to.not.have.length(3); - "test".should.not.have.length(3); expect([1, 2, 3]).to.have.length(3); - [1, 2, 3].should.have.length(3); expect(4).to.have.length(3, "blah"); - (4).should.have.length(3, "blah"); expect("asd").to.not.have.length(3, "blah"); - "asd".should.not.have.length(3, "blah"); } function eql() { expect("test").to.eql("test"); - "test".should.eql("test"); expect({ foo: "bar" }).to.eql({ foo: "bar" }); - ({ foo: "bar" }).should.eql({ foo: "bar" }); expect(1).to.eql(1); - (1).should.eql(1); expect("4").to.not.eql(4); - "4".should.not.eql(4); expect(4).to.eql(3, "blah"); - (4).should.eql(3, "blah"); } function buffer() { expect(new Buffer([1])).to.eql(new Buffer([1])); - (new Buffer([1])).should.eql(new Buffer([1])); expect(new Buffer([0])).to.eql(new Buffer([1])); - (new Buffer([0])).should.eql(new Buffer([1])); } function equal2() { expect("test").to.equal("test"); - "test".should.equal("test"); should.equal("test", "test"); expect(1).to.equal(1); - (1).should.equal(1); should.equal(1, 1); expect(4).to.equal(3, "blah"); - (4).should.equal(3, "blah"); should.equal(4, 3, "blah"); expect("4").to.equal(4, "blah"); - "4".should.equal(4, "blah"); should.equal(4, 4, "blah"); } function deepEqual() { expect({ foo: "bar" }).to.deep.equal({ foo: "bar" }); - ({ foo: "bar" }).should.deep.equal({ foo: "bar" }); expect({ foo: "bar" }).not.to.deep.equal({ foo: "baz" }); } function deepEqual2() { expect(/a/).to.deep.equal(/a/); - /a/.should.deep.equal(/a/); expect(/a/).not.to.deep.equal(/b/); expect(/a/).not.to.deep.equal({}); expect(/a/g).to.deep.equal(/a/g); - /a/g.should.deep.equal(/a/g); expect(/a/g).not.to.deep.equal(/b/g); expect(/a/i).to.deep.equal(/a/i); - /a/i.should.deep.equal(/a/i); expect(/a/i).not.to.deep.equal(/b/i); expect(/a/m).to.deep.equal(/a/m); - /a/m.should.deep.equal(/a/m); expect(/a/m).not.to.deep.equal(/b/m); } @@ -512,24 +365,16 @@ function deepEqual3() { const a = new Date(1, 2, 3); const b = new Date(4, 5, 6); expect(a).to.deep.equal(a); - a.should.deep.equal(a); expect(a).not.to.deep.equal(b); - a.should.not.deep.equal(b); expect(a).not.to.deep.equal({}); - a.should.not.deep.equal({}); } function deepInclude() { expect(["foo", "bar"]).to.deep.include(["bar", "foo"]); - ["foo", "bar"].should.deep.include(["bar", "foo"]); expect(["foo", "bar"]).to.deep.includes(["bar", "foo"]); - ["foo", "bar"].should.deep.includes(["bar", "foo"]); expect(["foo", "bar"]).to.deep.contain(["bar", "foo"]); - ["foo", "bar"].should.deep.contain(["bar", "foo"]); expect(["foo", "bar"]).to.deep.contains(["bar", "foo"]); - ["foo", "bar"].should.deep.contains(["bar", "foo"]); expect(["foo", "bar"]).not.to.deep.equal(["foo", "baz"]); - ["foo", "bar"].should.not.deep.equal(["foo", "baz"]); } class FakeArgs { @@ -541,125 +386,81 @@ function empty() { expect("").to.be.empty; - "".should.be.empty; expect("foo").not.to.be.empty; - "foo".should.not.be.empty; expect([]).to.be.empty; - [].should.be.empty; expect(["foo"]).not.to.be.empty; - ["foo"].should.not.be.empty; expect(new FakeArgs()).to.be.empty; - (new FakeArgs()).should.be.empty; expect({ arguments: 0 }).not.to.be.empty; - ({ arguments: 0 }).should.not.be.empty; expect({}).to.be.empty; - ({}).should.be.empty; expect({ foo: "bar" }).not.to.be.empty; - ({ foo: "bar" }).should.not.be.empty; expect("").not.to.be.empty; - "".should.not.be.empty; expect("foo").to.be.empty; - "foo".should.be.empty; - "foo".should.be.empty; expect([]).not.to.be.empty; - [].should.not.be.empty; expect(["foo"]).to.be.empty; - ["foo"].should.be.empty; expect(new FakeArgs()).not.to.be.empty; - (new FakeArgs()).should.not.be.empty; expect({ arguments: 0 }).to.be.empty; - ({ arguments: 0 }).should.be.empty; expect({}).not.to.be.empty; - ({}).should.not.be.empty; expect({ foo: "bar" }).to.be.empty; - ({ foo: "bar" }).should.be.empty; } function property() { expect("test").to.have.property("length"); expect("test").to.have.property(Symbol.for("length")); - "test".should.have.property("length"); expect(4).to.not.have.property("length"); - (4).should.not.have.property("length"); expect({ "foo.bar": "baz" }) .to.have.property("foo.bar"); - ({ "foo.bar": "baz" }).should.have.property("foo.bar"); expect({ foo: { bar: "baz" } }) .to.not.have.property("foo.bar"); - ({ foo: { bar: "baz" } }).should.not.have.property("foo.bar"); expect("asd").to.have.property("foo"); - "asd".should.have.property("foo"); expect({ foo: { bar: "baz" } }) .to.have.property("foo.bar"); - - ({ foo: { bar: "baz" } }).should.have.property("foo.bar"); } function nestedProperty() { expect({ "foo.bar": "baz" }) .to.not.have.nested.property("foo.bar"); - ({ "foo.bar": "baz" }).should - .not.have.nested.property("foo.bar"); expect({ foo: { bar: "baz" } }) .to.have.nested.property("foo.bar"); - ({ foo: { bar: "baz" } }).should - .have.nested.property("foo.bar"); expect({ "foo.bar": "baz" }) .to.have.nested.property("foo.bar"); - ({ "foo.bar": "baz" }).should - .have.nested.property("foo.bar"); } function property2() { expect("test").to.have.property("length", 4); expect("test").to.have.property(Symbol.for("length"), 4); - "test".should.have.property("length", 4); expect("asd").to.have.property("constructor", String); - "asd".should.have.property("constructor", String); expect("asd").to.have.property("length", 4, "blah"); - "asd".should.have.property("length", 4, "blah"); expect("asd").to.not.have.property("length", 3, "blah"); - "asd".should.not.have.property("length", 3, "blah"); expect("asd").to.not.have.property("foo", 3, "blah"); - "asd".should.not.have.property("foo", 3, "blah"); expect("asd").to.have.property("constructor", Number, "blah"); - "asd".should.have.property("constructor", Number, "blah"); } function nestedProperty2() { expect({ foo: { bar: "baz" } }) .to.have.nested.property("foo.bar", "baz"); - ({ foo: { bar: "baz" } }).should - .have.nested.property("foo.bar", "baz"); expect({ foo: { bar: "baz" } }) .to.have.nested.property("foo.bar", "quux", "blah"); - ({ foo: { bar: "baz" } }).should - .have.nested.property("foo.bar", "quux", "blah"); expect({ foo: { bar: "baz" } }) .to.not.have.nested.property("foo.bar", "baz", "blah"); - ({ foo: { bar: "baz" } }).should - .not.have.nested.property("foo.bar", "baz", "blah"); expect({ foo: 5 }) .to.not.have.nested.property("foo.bar", "baz", "blah"); - ({ foo: 5 }).should - .not.have.nested.property("foo.bar", "baz", "blah"); } function own() { @@ -672,43 +473,27 @@ function own() { function ownProperty() { expect("test").to.have.ownProperty("length"); expect("test").to.have.ownProperty(Symbol.for("length")); - "test".should.have.ownProperty("length"); expect("test").to.haveOwnProperty("length"); - "test".should.haveOwnProperty("length"); expect({ length: 12 }).to.have.ownProperty("length"); - ({ length: 12 }).should.have.ownProperty("length"); expect({ length: 12 }).to.have.ownProperty("length", 12); - ({ length: 12 }).should.have.ownProperty("length", 12); expect({ length: 12 }).to.have.ownProperty("length", 12, "blah"); - ({ length: 12 }).should.have.ownProperty("length", 12, "blah"); expect({ length: 12 }).to.not.have.ownProperty("length", "blah"); - ({ length: 12 }).should.not.have.ownProperty("length", "blah"); expect("test").to.have.own.property("length"); expect("test").to.have.own.property(Symbol.for("length")); - "test".should.have.own.property("length"); expect({ length: 12 }).to.have.own.property("length"); - ({ length: 12 }).should.have.own.property("length"); expect({ length: 12 }).to.have.own.property("length", 12); - ({ length: 12 }).should.have.own.property("length", 12); expect({ length: 12 }).to.have.own.property("length", 12, "blah"); - ({ length: 12 }).should.have.own.property("length", 12, "blah"); expect({ length: 12 }).to.not.have.own.property("length", "blah"); - ({ length: 12 }).should.not.have.own.property("length", "blah"); expect("test").to.have.an.own.property("length"); - "test".should.have.an.own.property("length"); expect({ length: 12 }).to.have.an.own.property("length"); - ({ length: 12 }).should.have.an.own.property("length"); expect({ length: 12 }).to.have.an.own.property("length", 12); - ({ length: 12 }).should.have.an.own.property("length", 12); expect({ length: 12 }).to.have.an.own.property("length", 12, "blah"); - ({ length: 12 }).should.have.an.own.property("length", 12, "blah"); expect({ length: 12 }).to.not.have.an.own.property("length", "blah"); - ({ length: 12 }).should.not.have.an.own.property("length", "blah"); } function ownPropertyDescriptor() { @@ -728,166 +513,99 @@ function ownPropertyDescriptor() { }); expect("test").to.haveOwnPropertyDescriptor("length").to.have.property("enumerable", false); expect("test").to.haveOwnPropertyDescriptor("length").to.contain.keys("value"); - - "test".should.have.ownPropertyDescriptor("length"); - "test".should.have.ownPropertyDescriptor("length", { - enumerable: false, - configurable: false, - writable: false, - value: 4, - }); - "test".should.not.have.ownPropertyDescriptor("length", { - enumerable: false, - configurable: false, - writable: false, - value: 3, - }); - "test".should.haveOwnPropertyDescriptor("length").to.have.property("enumerable", false); - "test".should.haveOwnPropertyDescriptor("length").to.contain.keys("value"); - "test".should.have.an.ownPropertyDescriptor("length"); } function string() { expect("foobar").to.have.string("bar"); - "foobar".should.have.string("bar"); expect("foobar").to.have.string("foo"); - "foobar".should.have.string("foo"); expect("foobar").to.not.have.string("baz"); - "foobar".should.not.have.string("baz"); expect(3).to.have.string("baz"); - (3).should.have.string("baz"); expect("foobar").to.have.string("baz", "blah"); - "foobar".should.have.string("baz", "blah"); expect("foobar").to.not.have.string("bar", "blah"); - "foobar".should.not.have.string("bar", "blah"); } function include() { expect(["foo", "bar"]).to.include("foo"); - ["foo", "bar"].should.include("foo"); expect(["foo", "bar"]).to.include("foo"); - ["foo", "bar"].should.include("foo"); expect(["foo", "bar"]).to.include("bar"); - ["foo", "bar"].should.include("bar"); expect([1, 2]).to.include(1); - [1, 2].should.include(1); expect(["foo", "bar"]).to.not.include("baz"); - ["foo", "bar"].should.not.include("baz"); expect(["foo", "bar"]).to.not.include(1); - ["foo", "bar"].should.not.include(1); expect(["foo", "bar"]).includes("foo"); - ["foo", "bar"].should.includes("foo"); expect(["foo"]).to.include("bar", "blah"); - ["foo"].should.include("bar", "blah"); expect(["bar", "foo"]).to.not.include("foo", "blah"); - ["bar", "foo"].should.not.include("foo", "blah"); } function keys() { expect({ foo: 1 }).to.have.keys(["foo"]); - ({ foo: 1 }).should.have.keys(["foo"]); expect({ foo: 1, bar: 2 }).to.have.keys(["foo", "bar"]); - ({ foo: 1, bar: 2 }).should.have.keys(["foo", "bar"]); expect({ foo: 1, bar: 2 }).to.have.keys("foo", "bar"); - ({ foo: 1, bar: 2 }).should.have.keys("foo", "bar"); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("foo", "bar"); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("foo", "bar"); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("bar", "foo"); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("bar", "foo"); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys("baz"); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys("baz"); // alias expect({ foo: 1, bar: 2, baz: 3 }).contains.keys("baz"); expect({ foo: 1, bar: 2 }).to.have.all.keys(["foo", "bar"]); expect({ foo: 1, bar: 2 }).to.have.any.keys(["foo", "bar"]); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys("baz"); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys("baz"); expect({ foo: 1, bar: 2 }).to.contain.keys("foo"); - ({ foo: 1, bar: 2 }).should.contain.keys("foo"); expect({ foo: 1, bar: 2 }).to.contain.keys("bar", "foo"); - ({ foo: 1, bar: 2 }).should.contain.keys("bar", "foo"); expect({ foo: 1, bar: 2 }).to.contain.keys(["foo"]); - ({ foo: 1, bar: 2 }).should.contain.keys(["foo"]); expect({ foo: 1, bar: 2 }).to.contain.keys(["bar"]); - ({ foo: 1, bar: 2 }).should.contain.keys(["bar"]); expect({ foo: 1, bar: 2 }).to.contain.keys(["bar", "foo"]); - ({ foo: 1, bar: 2 }).should.contain.keys(["bar", "foo"]); expect({ foo: 1, bar: 2 }).to.not.have.keys("baz"); - ({ foo: 1, bar: 2 }).should.not.have.keys("baz"); expect({ foo: 1, bar: 2 }).to.not.have.keys("foo", "baz"); - ({ foo: 1, bar: 2 }).should.not.have.keys("foo", "baz"); expect({ foo: 1, bar: 2 }).to.not.contain.keys("baz"); - ({ foo: 1, bar: 2 }).should.not.contain.keys("baz"); expect({ foo: 1, bar: 2 }).to.not.contain.keys("foo", "baz"); - ({ foo: 1, bar: 2 }).should.not.contain.keys("foo", "baz"); expect({ foo: 1, bar: 2 }).to.not.contain.keys("baz", "foo"); - ({ foo: 1, bar: 2 }).should.not.contain.keys("baz", "foo"); expect({ foo: 1 }).to.have.keys(); - ({ foo: 1 }).should.have.keys(); expect({ foo: 1 }).to.have.keys([]); - ({ foo: 1 }).should.have.keys([]); expect({ foo: 1 }).to.not.have.keys([]); - ({ foo: 1 }).should.not.have.keys([]); expect({ foo: 1 }).to.contain.keys([]); - ({ foo: 1 }).should.contain.keys([]); expect({ foo: 1 }).to.have.keys(["bar"]); - ({ foo: 1 }).should.have.keys(["bar"]); expect({ foo: 1 }).to.have.keys(["bar", "baz"]); - ({ foo: 1 }).should.have.keys(["bar", "baz"]); expect({ foo: 1 }).to.have.keys(["foo", "bar", "baz"]); - ({ foo: 1 }).should.have.keys(["foo", "bar", "baz"]); expect({ foo: 1 }).to.not.have.keys(["foo"]); - ({ foo: 1 }).should.not.have.keys(["foo"]); expect({ foo: 1 }).to.not.have.keys(["foo"]); - ({ foo: 1 }).should.not.have.keys(["foo"]); expect({ foo: 1, bar: 2 }).to.not.have.keys(["foo", "bar"]); - ({ foo: 1, bar: 2 }).should.not.have.keys(["foo", "bar"]); expect({ foo: 1 }).to.not.contain.keys(["foo"]); - ({ foo: 1 }).should.not.contain.keys(["foo"]); expect({ foo: 1 }).to.contain.keys("foo", "bar"); - ({ foo: 1 }).should.contain.keys("foo", "bar"); } function deepKeys() { expect(new Set([{ a: 1 }])).to.have.deep.keys([{ a: 1 }]); - (new Set([{ a: 1 }])).should.have.deep.keys([{ a: 1 }]); expect(new Set([{ a: 1 }])).not.to.have.deep.keys([{ b: 1 }]); - (new Set([{ a: 1 }])).should.not.have.deep.keys([{ b: 1 }]); } function chaining() { const tea = { name: "chai", extras: ["milk", "sugar", "smile"] }; expect(tea).to.have.property("extras").with.lengthOf(3); - tea.should.have.property("extras").with.lengthOf(3); expect(tea).to.have.property("extras").with.lengthOf(4); - tea.should.have.property("extras").with.lengthOf(4); expect(tea).to.be.a("object").and.have.property("name", "chai"); - tea.should.be.a("object").and.have.property("name", "chai"); expect({ b: 2 }).to.have.a.property("b"); expect([1, 2, 3]).to.have.a.lengthOf(3); @@ -896,22 +614,16 @@ function chaining() { function exxtensible() { expect({}).to.be.extensible; expect(Object.preventExtensions({})).to.be.not.extensible; - ({}).should.be.extensible; - Object.preventExtensions({}).should.not.be.extensible; } function sealed() { expect({}).to.be.not.sealed; expect(Object.seal({})).to.be.sealed; - ({}).should.be.not.sealed; - Object.seal({}).should.be.sealed; } function frozen() { expect({}).to.be.not.frozen; expect(Object.freeze({})).to.be.frozen; - ({}).should.be.not.frozen; - Object.freeze({}).should.be.frozen; expect([1, 2, 3]).to.have.all.members([1, 2, 3]); expect([1, 2, 3]).to.have.all.members(Object.freeze([1, 2, 3])); @@ -959,146 +671,106 @@ function _throw() { }; expect(goodFn).to.not.throw(); - goodFn.should.not.throw(); should.not.throw(goodFn); expect(goodFn).to.not.throw(Error); - goodFn.should.not.throw(Error); should.not.throw(goodFn, Error); expect(goodFn).to.not.throw(specificError); - goodFn.should.not.throw(specificError); should.not.throw(goodFn, specificError); expect(badFn).to.throw(); - badFn.should.throw(); should.throw(badFn); expect(badFn).to.throw(Error); - badFn.should.throw(Error); should.throw(badFn, Error); expect(badFn).to.not.throw(ReferenceError); - badFn.should.not.throw(ReferenceError); should.not.throw(badFn, ReferenceError); expect(badFn).to.not.throw(specificError); - badFn.should.not.throw(specificError); should.not.throw(badFn, specificError); expect(refErrFn).to.throw(); - refErrFn.should.throw(); should.throw(refErrFn); expect(refErrFn).to.throw(ReferenceError); - refErrFn.should.throw(ReferenceError); should.throw(refErrFn, ReferenceError); expect(refErrFn).to.throw(Error); - refErrFn.should.throw(Error); should.throw(refErrFn, Error); expect(refErrFn).to.not.throw(TypeError); - refErrFn.should.not.throw(TypeError); should.not.throw(refErrFn, TypeError); expect(refErrFn).to.not.throw(specificError); - refErrFn.should.not.throw(specificError); should.not.throw(refErrFn, specificError); expect(ickyErrFn).to.throw(); - ickyErrFn.should.throw(); should.throw(ickyErrFn); expect(ickyErrFn).to.throw(PoorlyConstructedError); - ickyErrFn.should.throw(PoorlyConstructedError); should.throw(ickyErrFn, PoorlyConstructedError); expect(ickyErrFn).to.throw(Error); - ickyErrFn.should.throw(Error); should.throw(ickyErrFn, Error); expect(ickyErrFn).to.not.throw(specificError); - ickyErrFn.should.not.throw(specificError); should.not.throw(ickyErrFn, specificError); expect(specificErrFn).to.throw(specificError); - specificErrFn.should.throw(specificError); should.throw(ickyErrFn, specificError); expect(badFn).to.throw(/testing/); - badFn.should.throw(/testing/); should.throw(badFn, /testing/); expect(badFn).to.not.throw(/hello/); - badFn.should.not.throw(/hello/); should.not.throw(badFn, /hello/); expect(badFn).to.throw("testing"); - badFn.should.throw("testing"); should.throw(badFn, "testing"); expect(badFn).to.not.throw("hello"); - badFn.should.not.throw("hello"); should.not.throw(badFn, "hello"); expect(badFn).to.throw(Error, /testing/); - badFn.should.throw(Error, /testing/); should.throw(badFn, Error, /testing/); expect(badFn).to.throw(Error, "testing"); - badFn.should.throw(Error, "testing"); should.throw(badFn, Error, "testing"); expect(goodFn).to.throw(); - goodFn.should.throw(); should.throw(goodFn); expect(goodFn).to.throw(ReferenceError); - goodFn.should.throw(ReferenceError); should.throw(goodFn, ReferenceError); expect(goodFn).to.throw(specificError); - goodFn.should.throw(specificError); should.throw(goodFn, specificError); expect(badFn).to.not.throw(); - badFn.should.not.throw(); should.not.throw(badFn); expect(badFn).to.throw(ReferenceError); - badFn.should.throw(ReferenceError); should.throw(badFn, ReferenceError); expect(badFn).to.throw(specificError); - badFn.should.throw(specificError); should.throw(badFn, specificError); expect(badFn).to.not.throw(Error); - badFn.should.not.throw(Error); should.not.throw(badFn, Error); expect(refErrFn).to.not.throw(ReferenceError); - refErrFn.should.not.throw(ReferenceError); should.not.throw(refErrFn, ReferenceError); expect(badFn).to.throw(PoorlyConstructedError); - badFn.should.throw(PoorlyConstructedError); should.throw(badFn, PoorlyConstructedError); expect(ickyErrFn).to.not.throw(PoorlyConstructedError); - ickyErrFn.should.not.throw(PoorlyConstructedError); should.not.throw(ickyErrFn, PoorlyConstructedError); expect(ickyErrFn).to.throw(ReferenceError); - ickyErrFn.should.throw(ReferenceError); should.throw(ickyErrFn, ReferenceError); expect(specificErrFn).to.throw(new ReferenceError("eek")); - specificErrFn.should.throw(new ReferenceError("eek")); should.throw(specificErrFn, new ReferenceError("eek")); expect(specificErrFn).to.not.throw(specificError); - specificErrFn.should.not.throw(specificError); should.not.throw(specificErrFn, specificError); expect(badFn).to.not.throw(/testing/); - badFn.should.not.throw(/testing/); should.not.throw(badFn, /testing/); expect(badFn).to.throw(/hello/); - badFn.should.throw(/hello/); should.throw(badFn, /hello/); expect(badFn).to.throw(Error, /hello/, "blah"); - badFn.should.throw(Error, /hello/, "blah"); should.throw(badFn, Error, /hello/, "blah"); expect(badFn).to.throw(Error, "hello", "blah"); - badFn.should.throw(Error, "hello", "blah"); should.throw(badFn, Error, "hello", "blah"); } @@ -1238,21 +910,15 @@ function respondTo() { expect(Klass).to.respondTo("bar"); expect(obj).respondsTo("bar"); - Klass.should.respondTo("bar"); - Klass.should.respondsTo("bar"); expect(Klass).to.not.respondTo("foo"); - Klass.should.not.respondTo("foo"); expect(Klass).itself.to.respondTo("func"); expect(Klass).itself.not.to.respondTo("bar"); expect(obj).not.to.respondTo("foo"); - obj.should.not.respondTo("foo"); expect(Klass).to.respondTo("baz", "constructor"); - Klass.should.respondTo("baz", "constructor"); expect(obj).to.respondTo("baz", "object"); - obj.should.respondTo("baz", "object"); } function satisfy() { @@ -1261,87 +927,58 @@ function satisfy() { } expect(1).to.satisfy(matcher); - (1).should.satisfy(matcher); expect(2).to.satisfy(matcher, "blah"); - (2).should.satisfy(matcher, "blah"); } function closeTo() { expect(1.5).to.be.closeTo(1.0, 0.5); - (1.5).should.be.closeTo(1.0, 0.5); expect(10).to.be.closeTo(20, 20); - (10).should.be.closeTo(20, 20); expect(-10).to.be.closeTo(20, 30); - (-10).should.be.closeTo(20, 30); expect(2).to.be.closeTo(1.0, 0.5, "blah"); - (2).should.be.closeTo(1.0, 0.5, "blah"); expect(-10).to.be.closeTo(20, 29, "blah"); - (-10).should.be.closeTo(20, 29, "blah"); } function approximately() { expect(1.5).to.be.approximately(1.0, 0.5); - (1.5).should.be.approximately(1.0, 0.5); expect(10).to.be.approximately(20, 20); - (10).should.be.approximately(20, 20); expect(-10).to.be.approximately(20, 30); - (-10).should.be.approximately(20, 30); expect(2).to.be.approximately(1.0, 0.5, "blah"); - (2).should.be.approximately(1.0, 0.5, "blah"); expect(-10).to.be.approximately(20, 29, "blah"); - (-10).should.be.approximately(20, 29, "blah"); } function includeMembers() { expect([1, 2, 3]).to.include.members([]); - [1, 2, 3].should.include.members([]); expect([1, 2, 3]).to.include.members([3, 2]); - [1, 2, 3].should.include.members([3, 2]); - expect([1, 2, 3]).to.not.include.members([8, 4]); - [1, 2, 3].should.not.include.members([8, 4]); - expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); - - [1, 2, 3].should.not.include.members([1, 2, 3, 4]); } function sameMembers() { expect([5, 4]).to.have.same.members([4, 5]); - [5, 4].should.have.same.members([4, 5]); expect([5, 4]).to.have.same.members([5, 4]); - [5, 4].should.have.same.members([5, 4]); expect([5, 4]).to.not.have.same.members([]); - [5, 4].should.not.have.same.members([]); expect([5, 4]).to.not.have.same.members([6, 3]); - [5, 4].should.not.have.same.members([6, 3]); expect([5, 4]).to.not.have.same.members([5, 4, 2]); - [5, 4].should.not.have.same.members([5, 4, 2]); assert.sameMembers([5, 4], [4, 5]); } function sameDeepMembers() { expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); - [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); - [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); } @@ -1418,16 +1055,6 @@ function increaseDecreaseChange() { expect(same).to.not.decrease(obj, "val"); expect(same).to.not.change(obj, "val"); - inc.should.increase(obj, "val"); - inc.should.change(obj, "val"); - - dec.should.decrease(obj, "val"); - dec.should.change(obj, "val"); - - inc.should.not.decrease(obj, "val"); - dec.should.not.increase(obj, "val"); - same.should.not.change(obj, "val"); - const myObj = { val: 1 }; const addTwo = () => { myObj.val += 2; diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 58c89c306c5443..67b59e26c38c68 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -2147,9 +2147,3 @@ export function should(): Chai.Should; export function Should(): Chai.Should; export const assert: Chai.AssertStatic; export const expect: Chai.ExpectStatic; - -declare global { - interface Object { - should: Chai.Assertion; - } -} diff --git a/types/chai/register-should.d.ts b/types/chai/register-should.d.ts new file mode 100644 index 00000000000000..1e14f93b30749b --- /dev/null +++ b/types/chai/register-should.d.ts @@ -0,0 +1,7 @@ +declare global { + interface Object { + should: Chai.Assertion; + } +} + +export {}; diff --git a/types/cheerio/.eslintrc.json b/types/cheerio/.eslintrc.json deleted file mode 100644 index 6bf867611c2a7f..00000000000000 --- a/types/cheerio/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "rules": { - "@definitelytyped/no-declare-current-package": "off", - "@definitelytyped/no-single-declare-module": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-wrapper-object-types": "off", - "@typescript-eslint/no-empty-interface": "off" - } -} diff --git a/types/cheerio/cheerio-tests.ts b/types/cheerio/cheerio-tests.ts deleted file mode 100644 index 0296bde1a0b6e6..00000000000000 --- a/types/cheerio/cheerio-tests.ts +++ /dev/null @@ -1,397 +0,0 @@ -import cheerio = require("cheerio"); - -/* - * LOADING - */ -let html = `
    -
  • Apple
  • -
  • Orange
  • -
  • Pear
  • - -
`; - -// Preferred Method -var $ = cheerio.load(html); - -// Directly load element -cheerio(html); -cheerio("ul", html); -cheerio("li", "ul", html); - -cheerio.load([$("ul").get(0)]); - -const $fromElement = cheerio.load($("ul").get(0)); - -if ($fromElement("ul > li").length !== 3) { - throw new Error("Expecting 3 elements when passing `cheerio.Element` to `load()`"); -} - -$ = cheerio.load(Buffer.from(html)); - -$ = cheerio.load(html, { - normalizeWhitespace: true, - xmlMode: true, -}); - -$ = cheerio.load(html, { - normalizeWhitespace: true, - withStartIndices: true, - withEndIndices: true, - xmlMode: true, - decodeEntities: true, - lowerCaseTags: true, - lowerCaseAttributeNames: true, - recognizeCDATA: true, - recognizeSelfClosing: true, -}); - -const [$ele1] = Array.from($(".class")); - -/** - * Start and end indicies for all tags - */ - -const indicesHTML = `
Pear
`; - -const indicesHTMLRoot = cheerio.load(indicesHTML, { - withStartIndices: true, - withEndIndices: true, -}); - -const tagEl = indicesHTMLRoot("*")[0] as cheerio.TagElement; -const commentEl = tagEl.firstChild as cheerio.CommentElement; -const textEl = tagEl.lastChild as cheerio.TextElement; - -tagEl.endIndex! - tagEl.startIndex!; -commentEl.endIndex! - commentEl.startIndex!; -textEl.endIndex! - textEl.startIndex!; - -/** - * Selectors - */ -var $el = $(".class"); -var $multiEl = $("selector", "selector", "selector"); -var $emptyEl = $(".not-existing-class"); - -$el.cheerio; - -/** - * Attributes - */ - -// attr -$el.attr(); -$el.attr("id"); -$el.attr("id", "favorite").html(); -// @ts-expect-error -$el.attr("id", (el, i, attr) => el.tagName + i * 2 + attr).html(); -// @ts-expect-error -$el.attr("id", el => el.tagName).html(); -$el.attr({ id: "uniq", class: "big" }).html(); - -$emptyEl.attr("id") === undefined; - -// props -$el.prop("style"); -$el.prop("style", "none").html(); - -// data -$el.data(); -$el.data("apple-color"); -$el.data("kind", "mac"); - -// val -$("input[type=\"text\"]").val(); -$("input[type=\"text\"]") - .val("test") - .html(); - -// removeAttr -$el.removeAttr("class").html(); - -// hasClass, addClass, removeClass, toggleClass -$el.addClass("class").addClass("test"); -$el.hasClass("test"); -$el.removeClass("class").removeClass("test"); -$el.addClass("red") - .removeClass() - .html(); -$el.toggleClass("fruit green red").html(); - -// is -$el.is("#id"); -$el.is($el); -$el.is(() => { - return true; -}); - -/** - * Forms - */ -// serializeArray -$("
").serializeArray(); -$("
").serialize(); - -/** - * Traversing - */ -// find -$el.find("li").length; -$el.find($(".apple")).length; - -// .parent([selector]) -$el.parent().attr("id"); -$el.parent(".class").attr("id"); - -// .parents([selector]) -$el.parents().length; -$el.parents(".class").length; - -// .parentsUntil([selector][,filter]) -$el.parentsUntil().length; -$el.parentsUntil(".class").length; - -// .closest(selector) -$el.closest(); -$el.closest(".class"); - -// .next([selector]) -$el.next().hasClass("class"); -$el.next(".class").hasClass("class"); - -// .nextAll([selector]) -$el.nextAll().length; -$el.nextAll(".class").length; - -// .nextUntil([selector], [filter]) -$el.nextUntil(); -$el.nextUntil(".class"); - -// .prev([selector]) -$el.prev().hasClass("class"); -$el.prev(".class").hasClass("class"); - -// .prevAll([selector]) -$el.prevAll().length; -$el.prevAll(".class").length; - -// .prevUntil([selector], [filter]) -$el.prevUntil(); -$el.prevUntil(".class"); - -// .slice( start, [end] ) -$el.slice(1) - .eq(0) - .text(); -$el.slice(1, 2).length; - -// .siblings([selector]) -$el.siblings().length; -$el.siblings(".class").length; - -// .children([selector]) -$el.children().length; -$el.children(".class").text(); - -// .contents() -$el.contents().length; - -// .each( function(index, element) ) -$el.each((i, el) => { - $(el).html(); -}); - -// .map( function(index, element) ) -$el.map((i, el) => { - return $(el).text(); -}) - .get() - .join(" "); - -// .filter -$ = cheerio.load(html); -$el.filter(".class").attr("class"); -$el.filter($(".class")).attr("class"); -$el.filter($(".class")[0]).attr("class"); - -$el.filter((i, el) => { - return $(el).attr("class") === "class"; -}).attr("class"); - -// .not -$el.not(".class").length; -$el.not($(".class")).length; -$el.not($(".class")[0]).length; - -$el.not((i, el) => { - return $(el).attr("class") === "class"; -}).length; - -// .has -$el.has(".class").attr("id"); -$el.has($el[0]).attr("id"); - -// .first() -$el.children() - .first() - .text(); - -// .last() -$el.children() - .last() - .text(); - -// .eq( i ) -$el.eq(0).text(); -$el.eq(-1).text(); - -// .get( [i] ) -$el.get(0).tagName; -$el.get().length; - -// .index() -// .index( selector ) -// .index( nodeOrSelection ) -$el.index(); -$el.index("li"); -$el.index($("#fruit, li")); - -// .end() -$el.eq(0).end().length; - -// .add -$el.add(".class").length; - -// .addBack( [filter] ) -$el.eq(0).addBack().length; -$el.eq(0).addBack(".class").length; - -/** - * Manipulation - */ - -$("
  • Plum
  • ").appendTo($el); -$el.prependTo($("
  • Plum
  • ")); - -// .append( content, [content, ...] ) -$el.append("
  • Plum
  • ").html(); -$el.append("
  • Plum
  • ", "
  • Plum
  • ").html(); - -// .prepend( content, [content, ...] ) -$el.prepend("
  • Plum
  • ").html(); -$el.prepend("
  • Plum
  • ", "
  • Plum
  • ").html(); - -// .after( content, [content, ...] ) -$el.after("
  • Plum
  • ").html(); -$el.after("
  • Plum
  • ", "
  • Plum
  • ").html(); - -// .insertAfter( content ) -$("
  • Plum
  • ") - .insertAfter(".class") - .html(); - -// .before( content, [content, ...] ) -$el.before("
  • Plum
  • ").html(); -$el.before("
  • Plum
  • ", "
  • Plum
  • ").html(); - -// .insertBefore( content ) -$("
  • Plum
  • ") - .insertBefore(".class") - .html(); - -// .remove( [selector] ) -$el.remove().html(); -$el.remove(".class").html(); - -// .replaceWith( content ) -$el.replaceWith($("
  • Plum
  • ")).html(); - -// .empty() -$el.empty().html(); - -// .html( [htmlString] ) -$el.html(); -$el.html("
  • Mango
  • ").html(); - -// .text( [textString] ) -$el.text(); -$el.text("text"); - -// .wrap( content ) -$el.wrap($("
    ")).html(); - -// .css -$el.css(); -$el.css("width"); -$el.css(["width", "height"]); -$el.css("width", "50px"); - -/** - * Rendering - */ -$.html(); -$.html(".class"); -$.xml(); -$.xml($el); - -/** - * Miscellaneous - */ - -// .clone() #### -$el.clone().html(); - -/** - * Utilities - */ - -// $.root -$.root() - .append("
      ") - .html(); - -// $.contains( container, contained ) -$.contains($el[0], $el[0]); - -// $.parseHTML( data [, context ] [, keepScripts ] ) -$.parseHTML(html); -$.parseHTML(html, null, true); - -/** - * Not in doc - */ -$el.toArray(); - -cheerio.html($el); - -// $ExpectType string -cheerio.version; - -const doSomething = (element: cheerio.Element): void => { - if ( - element.type !== "text" && element.type !== "comment" && element.type !== "script" && element.type !== "style" - ) { - // $ExpectType { [attr: string]: string; } - element.attribs; - // $ExpectType { [attr: string]: string; } - element["x-attribsNamespace"]; - // $ExpectType { [attr: string]: string; } - element["x-prefixNamespace"]; - // $ExpectType Element[] - element.children; - } - - // @ts-expect-error - let a = element.firstChild; - // @ts-expect-error - let b = element.lastChild; - - if (element.next) { - // $ExpectType "text" | "tag" | "script" | "style" | "comment" || "script" | "style" | "text" | "tag" | "comment" - let d = element.next.type; - } - if (element.prev) { - // $ExpectType "text" | "tag" | "script" | "style" | "comment" || "script" | "style" | "text" | "tag" | "comment" - let d = element.prev.type; - } -}; diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts deleted file mode 100644 index b97e1ecae12e2c..00000000000000 --- a/types/cheerio/index.d.ts +++ /dev/null @@ -1,318 +0,0 @@ -/// - -interface Document {} - -declare namespace cheerio { - type Element = TextElement | TagElement | CommentElement; - - interface TextElement { - type: "text"; - next: Element | null; - prev: Element | null; - parent: Element; - data?: string | undefined; - startIndex?: number | undefined; - endIndex?: number | undefined; - } - - interface TagElement { - tagName: string; - type: "tag" | "script" | "style"; - name: string; - attribs: { [attr: string]: string }; - "x-attribsNamespace": { [attr: string]: string }; - "x-prefixNamespace": { [attr: string]: string }; - children: Element[]; - childNodes: Element[] | null; - lastChild: Element | null; - firstChild: Element | null; - next: Element | null; - nextSibling: Element; - prev: Element | null; - previousSibling: Element; - parent: Element; - parentNode: Element; - nodeValue: string; - data?: string | undefined; - startIndex?: number | undefined; - endIndex?: number | undefined; - } - - interface CommentElement { - type: "comment"; - next: Element | null; - prev: Element | null; - parent: Element; - data?: string | undefined; - startIndex?: number | undefined; - endIndex?: number | undefined; - } - - type AttrFunction = (el: Element, i: number, currentValue: string) => any; - - interface Cheerio { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com - - [Symbol.iterator](): IterableIterator; - [index: number]: Element; - cheerio: string; - length: number; - - // Attributes - - attr(): { [attr: string]: string }; - attr(name: string): string | undefined; - attr(name: string, value: AttrFunction): Cheerio; - // `value` *can* be `any` here but: - // 1. That makes type-checking the function-type useless - // 2. It's converted to a string anyways - attr(name: string, value: string): Cheerio; - // The map's values *can* be `any` but they'll all be cast to strings - // regardless. - attr(map: { [key: string]: any }): Cheerio; - - data(): any; - data(name: string): any; - data(name: string, value: any): any; - - val(): string; - val(value: string): Cheerio; - - removeAttr(name: string): Cheerio; - - has(selector: string): Cheerio; - has(element: Element): Cheerio; - - hasClass(className: string): boolean; - addClass(classNames: string): Cheerio; - - removeClass(): Cheerio; - removeClass(className: string): Cheerio; - removeClass(func: (index: number, className: string) => string): Cheerio; - - toggleClass(className: string): Cheerio; - toggleClass(className: string, toggleSwitch: boolean): Cheerio; - toggleClass(toggleSwitch?: boolean): Cheerio; - toggleClass( - func: (index: number, className: string, toggleSwitch: boolean) => string, - toggleSwitch?: boolean, - ): Cheerio; - - is(selector: string): boolean; - is(element: Element): boolean; - is(element: Element[]): boolean; - is(selection: Cheerio): boolean; - is(func: (index: number, element: Element) => boolean): boolean; - - // Form - serialize(): string; - serializeArray(): Array<{ name: string; value: string }>; - - // Traversing - - find(selector: string): Cheerio; - find(element: Cheerio): Cheerio; - - parent(selector?: string): Cheerio; - parents(selector?: string): Cheerio; - parentsUntil(selector?: string, filter?: string): Cheerio; - parentsUntil(element: Element, filter?: string): Cheerio; - parentsUntil(element: Cheerio, filter?: string): Cheerio; - - prop(name: string): any; - prop(name: string, value: any): Cheerio; - - closest(): Cheerio; - closest(selector: string): Cheerio; - - next(selector?: string): Cheerio; - nextAll(): Cheerio; - nextAll(selector: string): Cheerio; - - nextUntil(selector?: string, filter?: string): Cheerio; - nextUntil(element: Element, filter?: string): Cheerio; - nextUntil(element: Cheerio, filter?: string): Cheerio; - - prev(selector?: string): Cheerio; - prevAll(): Cheerio; - prevAll(selector: string): Cheerio; - - prevUntil(selector?: string, filter?: string): Cheerio; - prevUntil(element: Element, filter?: string): Cheerio; - prevUntil(element: Cheerio, filter?: string): Cheerio; - - slice(start: number, end?: number): Cheerio; - - siblings(selector?: string): Cheerio; - - children(selector?: string): Cheerio; - - contents(): Cheerio; - - each(func: (index: number, element: Element) => any): Cheerio; - map(func: (index: number, element: Element) => any): Cheerio; - - filter(selector: string): Cheerio; - filter(selection: Cheerio): Cheerio; - filter(element: Element): Cheerio; - filter(elements: Element[]): Cheerio; - filter(func: (index: number, element: Element) => boolean): Cheerio; - - not(selector: string): Cheerio; - not(selection: Cheerio): Cheerio; - not(element: Element): Cheerio; - not(func: (index: number, element: Element) => boolean): Cheerio; - - first(): Cheerio; - last(): Cheerio; - - eq(index: number): Cheerio; - - get(): any[]; - get(index: number): any; - - index(): number; - index(selector: string): number; - index(selection: Cheerio): number; - - end(): Cheerio; - - add(selectorOrHtml: string): Cheerio; - add(selector: string, context: Document): Cheerio; - add(element: Element): Cheerio; - add(elements: Element[]): Cheerio; - add(selection: Cheerio): Cheerio; - - addBack(): Cheerio; - addBack(filter: string): Cheerio; - - // Manipulation - appendTo(target: Cheerio): Cheerio; - prependTo(target: Cheerio): Cheerio; - - append(content: string, ...contents: any[]): Cheerio; - append(content: Document, ...contents: any[]): Cheerio; - append(content: Document[], ...contents: any[]): Cheerio; - append(content: Cheerio, ...contents: any[]): Cheerio; - - prepend(content: string, ...contents: any[]): Cheerio; - prepend(content: Document, ...contents: any[]): Cheerio; - prepend(content: Document[], ...contents: any[]): Cheerio; - prepend(content: Cheerio, ...contents: any[]): Cheerio; - - after(content: string, ...contents: any[]): Cheerio; - after(content: Document, ...contents: any[]): Cheerio; - after(content: Document[], ...contents: any[]): Cheerio; - after(content: Cheerio, ...contents: any[]): Cheerio; - - insertAfter(content: string): Cheerio; - insertAfter(content: Document): Cheerio; - insertAfter(content: Cheerio): Cheerio; - - before(content: string, ...contents: any[]): Cheerio; - before(content: Document, ...contents: any[]): Cheerio; - before(content: Document[], ...contents: any[]): Cheerio; - before(content: Cheerio, ...contents: any[]): Cheerio; - - insertBefore(content: string): Cheerio; - insertBefore(content: Document): Cheerio; - insertBefore(content: Cheerio): Cheerio; - - remove(selector?: string): Cheerio; - - replaceWith(content: string): Cheerio; - replaceWith(content: Element): Cheerio; - replaceWith(content: Element[]): Cheerio; - replaceWith(content: Cheerio): Cheerio; - replaceWith(content: () => Cheerio): Cheerio; - - empty(): Cheerio; - - html(): string | null; - html(html: string): Cheerio; - - text(): string; - text(text: string): Cheerio; - - wrap(content: string): Cheerio; - wrap(content: Document): Cheerio; - wrap(content: Cheerio): Cheerio; - - css(propertyName?: string): string; - css(propertyNames: string[]): string[]; - css(propertyName: string, value: string): Cheerio; - css(propertyName: string, value: number): Cheerio; - css(propertyName: string, func: (index: number, value: string) => string): Cheerio; - css(propertyName: string, func: (index: number, value: string) => number): Cheerio; - css(properties: Object): Cheerio; - - // Rendering - - // Miscellaneous - - clone(): Cheerio; - - // Not Documented - - toArray(): Element[]; - } - - interface CheerioParserOptions { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options - // DomHandler https://github.com/fb55/DomHandler - - xmlMode?: boolean | undefined; - decodeEntities?: boolean | undefined; - lowerCaseTags?: boolean | undefined; - lowerCaseAttributeNames?: boolean | undefined; - recognizeCDATA?: boolean | undefined; - recognizeSelfClosing?: boolean | undefined; - normalizeWhitespace?: boolean | undefined; - withStartIndices?: boolean | undefined; - withEndIndices?: boolean | undefined; - ignoreWhitespace?: boolean | undefined; - _useHtmlParser2?: boolean | undefined; - } - - interface Selector { - (selector: string): Cheerio; - (selector: string, context: string): Cheerio; - (selector: string, context: Element): Cheerio; - (selector: string, context: Element[]): Cheerio; - (selector: string, context: Cheerio): Cheerio; - (selector: string, context: string, root: string): Cheerio; - (selector: string, context: Element, root: string): Cheerio; - (selector: string, context: Element[], root: string): Cheerio; - (selector: string, context: Cheerio, root: string): Cheerio; - (selector: any): Cheerio; - } - - interface Root extends Selector { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com - root(): Cheerio; - contains(container: Element, contained: Element): boolean; - parseHTML(data: string, context?: Document | null, keepScripts?: boolean): Document[]; - - html(options?: CheerioParserOptions): string; - html(dom: string | Cheerio | Element, options?: CheerioParserOptions): string; - - xml(dom?: string | Cheerio | Element): string; - } - - interface CheerioAPI extends Root { - version: string; - load(html: string | Buffer, options?: CheerioParserOptions): Root; - load(element: Element | Element[], options?: CheerioParserOptions): Root; - } -} - -declare module "cheerio" { - const cheerioModule: cheerio.CheerioAPI; - export = cheerioModule; -} diff --git a/types/cheerio/package.json b/types/cheerio/package.json deleted file mode 100644 index 4f5bfab01510ca..00000000000000 --- a/types/cheerio/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "private": true, - "name": "@types/cheerio", - "version": "0.22.9999", - "projects": [ - "https://github.com/cheeriojs/cheerio" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/cheerio": "workspace:." - }, - "owners": [ - { - "name": "Bret Little", - "githubUsername": "blittle" - }, - { - "name": "VILIC VANE", - "url": "http://vilic.info" - }, - { - "name": "Wayne Maurer", - "githubUsername": "wmaurer" - }, - { - "name": "Umar Nizamani", - "githubUsername": "umarniz" - }, - { - "name": "LiJinyao", - "githubUsername": "LiJinyao" - }, - { - "name": "Chennakrishna", - "githubUsername": "chennakrishna8" - }, - { - "name": "AzSiAz", - "githubUsername": "AzSiAz" - }, - { - "name": "Ryo Ota", - "githubUsername": "nwtgck" - }, - { - "name": "Hiroki Osame", - "githubUsername": "privatenumber" - }, - { - "name": "Artishevskiy Alexey", - "githubUsername": "dhvcc" - } - ] -} diff --git a/types/cheerio/tsconfig.json b/types/cheerio/tsconfig.json deleted file mode 100644 index ac2a5f71968bda..00000000000000 --- a/types/cheerio/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cheerio-tests.ts" - ] -} diff --git a/types/chessboardjs/index.d.ts b/types/chessboardjs/index.d.ts index bda43d13cd40eb..e67addfdc1583d 100644 --- a/types/chessboardjs/index.d.ts +++ b/types/chessboardjs/index.d.ts @@ -5,7 +5,7 @@ export enum Square { d8 = "d8", e8 = "e8", f8 = "f8", - g8 = "g7", + g8 = "g8", h8 = "h8", a7 = "a7", b7 = "b7", @@ -21,7 +21,7 @@ export enum Square { d6 = "d6", e6 = "e6", f6 = "f6", - g6 = "g7", + g6 = "g6", h6 = "h6", a5 = "a5", b5 = "b5", @@ -29,7 +29,7 @@ export enum Square { d5 = "d5", e5 = "e5", f5 = "f5", - g5 = "g7", + g5 = "g5", h5 = "h5", a4 = "a4", b4 = "b4", @@ -37,7 +37,7 @@ export enum Square { d4 = "d4", e4 = "e4", f4 = "f4", - g4 = "g7", + g4 = "g4", h4 = "h4", a3 = "a3", b3 = "b3", @@ -45,7 +45,7 @@ export enum Square { d3 = "d3", e3 = "e3", f3 = "f3", - g3 = "g7", + g3 = "g3", h3 = "h3", a2 = "a2", b2 = "b2", @@ -53,7 +53,7 @@ export enum Square { d2 = "d2", e2 = "e2", f2 = "f2", - g2 = "g7", + g2 = "g2", h2 = "h2", a1 = "a1", b1 = "b1", @@ -61,7 +61,7 @@ export enum Square { d1 = "d1", e1 = "e1", f1 = "f1", - g1 = "g7", + g1 = "g1", h1 = "h1", } diff --git a/types/chrome/.eslintrc.json b/types/chrome/.eslintrc.json index f9b978ebaa4720..3ae3a9296a19f8 100644 --- a/types/chrome/.eslintrc.json +++ b/types/chrome/.eslintrc.json @@ -2,7 +2,6 @@ "rules": { "@definitelytyped/no-unnecessary-generics": "off", "@definitelytyped/strict-export-declare-modifiers": "off", - "@typescript-eslint/no-unsafe-function-type": "off", "@typescript-eslint/no-wrapper-object-types": "off", "@typescript-eslint/prefer-namespace": "off", "@typescript-eslint/no-empty-interface": "off" diff --git a/types/chrome/chrome-cast/index.d.ts b/types/chrome/chrome-cast/index.d.ts index 856715d541282c..f4acc3d93ca5e5 100644 --- a/types/chrome/chrome-cast/index.d.ts +++ b/types/chrome/chrome-cast/index.d.ts @@ -110,7 +110,7 @@ declare namespace chrome { */ export function initialize( apiConfig: chrome.cast.ApiConfig, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -158,7 +158,7 @@ declare namespace chrome { */ export function setCustomReceivers( receivers: chrome.cast.Receiver[], - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -169,7 +169,7 @@ declare namespace chrome { */ export function setReceiverDisplayStatus( receiver: chrome.cast.Receiver, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -292,7 +292,7 @@ declare namespace chrome { */ setReceiverVolumeLevel( newLevel: number, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -303,7 +303,7 @@ declare namespace chrome { */ setReceiverMuted( muted: boolean, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -311,13 +311,13 @@ declare namespace chrome { * @param successCallback * @param errorCallback */ - leave(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void; + leave(successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void): void; /** * @param successCallback * @param errorCallback */ - stop(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void; + stop(successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void): void; /** * @param namespace @@ -328,7 +328,7 @@ declare namespace chrome { sendMessage( namespace: string, message: string | object, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -885,7 +885,7 @@ declare namespace chrome { */ getStatus( getStatusRequest: chrome.cast.media.GetStatusRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -896,7 +896,7 @@ declare namespace chrome { */ play( playRequest: chrome.cast.media.PlayRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -907,7 +907,7 @@ declare namespace chrome { */ pause( pauseRequest: chrome.cast.media.PauseRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -918,7 +918,7 @@ declare namespace chrome { */ seek( seekRequest: chrome.cast.media.SeekRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -929,7 +929,7 @@ declare namespace chrome { */ stop( stopRequest: chrome.cast.media.StopRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -940,7 +940,7 @@ declare namespace chrome { */ setVolume( volumeRequest: chrome.cast.media.VolumeRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -951,7 +951,7 @@ declare namespace chrome { */ editTracksInfo( editTracksInfoRequest: chrome.cast.media.EditTracksInfoRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -984,7 +984,7 @@ declare namespace chrome { */ queueAppendItem( item: chrome.cast.media.QueueItem, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -995,7 +995,7 @@ declare namespace chrome { */ queueInsertItems( queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1006,7 +1006,7 @@ declare namespace chrome { */ queueJumpToItem( itemId: number, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1019,7 +1019,7 @@ declare namespace chrome { queueMoveItemToNewIndex( itemId: number, newIndex: number, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1027,13 +1027,13 @@ declare namespace chrome { * @param successCallback * @param errorCallback */ - queueNext(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void; + queueNext(successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void): void; /** * @param successCallback * @param errorCallback */ - queuePrev(successCallback: Function, errorCallback: (error: chrome.cast.Error) => void): void; + queuePrev(successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void): void; /** * @param itemId @@ -1042,7 +1042,7 @@ declare namespace chrome { */ queueRemoveItem( itemId: number, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1053,7 +1053,7 @@ declare namespace chrome { */ queueReorderItems( queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1064,7 +1064,7 @@ declare namespace chrome { */ queueSetRepeatMode( repeatMode: chrome.cast.media.RepeatMode, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; @@ -1075,7 +1075,7 @@ declare namespace chrome { */ queueUpdateItems( queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest, - successCallback: Function, + successCallback: () => void, errorCallback: (error: chrome.cast.Error) => void, ): void; } diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 0316fdc5d10ad5..f664ff85f50e2f 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -1180,7 +1180,7 @@ declare namespace chrome { /** * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. */ - export function setIcon(details: TabIconDetails, callback?: Function): void; + export function setIcon(details: TabIconDetails, callback?: () => void): void; /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */ export var onClicked: BrowserClickedEvent; @@ -2585,7 +2585,7 @@ declare namespace chrome { filter: RequestCookie; } - export interface RequestedEvent extends chrome.events.Event {} + export interface RequestedEvent extends chrome.events.Event<() => void> {} export var onRequest: RequestedEvent; } @@ -4291,7 +4291,7 @@ declare namespace chrome { originAndPathMatches?: string | undefined; } - export interface Event { + export interface Event void> { /** * Registers an event listener callback to an event. * @param callback Called when an event occurs. The parameters of this function depend on the type of event. @@ -5397,7 +5397,7 @@ declare namespace chrome { /** * Sets the default font size. */ - export function setDefaultFontSize(details: DefaultFontSizeDetails, callback: Function): void; + export function setDefaultFontSize(details: DefaultFontSizeDetails, callback: () => void): void; /** * Gets the font for a given script and generic font family. * @return The `getFont` method provides its result via callback or returned as a `Promise` (MV3 only). @@ -5439,7 +5439,7 @@ declare namespace chrome { /** * Sets the minimum font size. */ - export function setMinimumFontSize(details: SetFontSizeDetails, callback: Function): void; + export function setMinimumFontSize(details: SetFontSizeDetails, callback: () => void): void; /** * Gets the default size for fixed width fonts. * @param details This parameter is currently unused. @@ -5462,8 +5462,8 @@ declare namespace chrome { * Clears the default font size set by this extension, if any. * @param details This parameter is currently unused. */ - export function clearDefaultFontSize(callback: Function): void; - export function clearDefaultFontSize(details: Object, callback: Function): void; + export function clearDefaultFontSize(callback: () => void): void; + export function clearDefaultFontSize(details: Object, callback: () => void): void; /** * Sets the default size for fixed width fonts. * @return The `setDefaultFixedFontSize` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. @@ -5472,7 +5472,7 @@ declare namespace chrome { /** * Sets the default size for fixed width fonts. */ - export function setDefaultFixedFontSize(details: SetFontSizeDetails, callback: Function): void; + export function setDefaultFixedFontSize(details: SetFontSizeDetails, callback: () => void): void; /** * Clears the font set by this extension, if any. * @return The `clearFont` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. @@ -5481,7 +5481,7 @@ declare namespace chrome { /** * Clears the font set by this extension, if any. */ - export function clearFont(details: FontDetails, callback: Function): void; + export function clearFont(details: FontDetails, callback: () => void): void; /** * Sets the font for a given script and generic font family. * @return The `setFont` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters. @@ -5490,7 +5490,7 @@ declare namespace chrome { /** * Sets the font for a given script and generic font family. */ - export function setFont(details: SetFontDetails, callback: Function): void; + export function setFont(details: SetFontDetails, callback: () => void): void; /** * Clears the minimum font size set by this extension, if any. * @param details This parameter is currently unused. @@ -5501,8 +5501,8 @@ declare namespace chrome { * Clears the minimum font size set by this extension, if any. * @param details This parameter is currently unused. */ - export function clearMinimumFontSize(callback: Function): void; - export function clearMinimumFontSize(details: Object, callback: Function): void; + export function clearMinimumFontSize(callback: () => void): void; + export function clearMinimumFontSize(details: Object, callback: () => void): void; /** * Gets a list of fonts on the system. * @return The `getFontList` method provides its result via callback or returned as a `Promise` (MV3 only). @@ -5522,7 +5522,7 @@ declare namespace chrome { * Clears the default fixed font size set by this extension, if any. * @param details This parameter is currently unused. */ - export function clearDefaultFixedFontSize(details: Object, callback: Function): void; + export function clearDefaultFixedFontSize(details: Object, callback: () => void): void; /** Fired when the default fixed font size setting changes. */ export var onDefaultFixedFontSizeChanged: DefaultFixedFontSizeChangedEvent; @@ -11690,7 +11690,7 @@ declare namespace chrome { * Closes a tab. * @param tabId The tab to close. */ - export function remove(tabId: number, callback: Function): void; + export function remove(tabId: number, callback: () => void): void; /** * Closes several tabs. * @param tabIds The list of tabs to close. @@ -11701,7 +11701,7 @@ declare namespace chrome { * Closes several tabs. * @param tabIds The list of tabs to close. */ - export function remove(tabIds: number[], callback: Function): void; + export function remove(tabIds: number[], callback: () => void): void; /** * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. * @param callback @@ -11881,7 +11881,7 @@ declare namespace chrome { * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. * @param callback Optional. Called when all the CSS has been inserted. */ - export function insertCSS(details: InjectDetails, callback: Function): void; + export function insertCSS(details: InjectDetails, callback: () => void): void; /** * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. @@ -11895,7 +11895,7 @@ declare namespace chrome { * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. * @param callback Optional. Called when all the CSS has been inserted. */ - export function insertCSS(tabId: number, details: InjectDetails, callback: Function): void; + export function insertCSS(tabId: number, details: InjectDetails, callback: () => void): void; /** * Highlights the given tabs. * @since Chrome 16 @@ -12857,19 +12857,19 @@ declare namespace chrome { * @param id ID of the VPN configuration to destroy. * @param callback Optional. Called when the configuration is destroyed or if there is an error. */ - export function destroyConfig(id: string, callback?: Function): void; + export function destroyConfig(id: string, callback?: () => void): void; /** * Sets the parameters for the VPN session. This should be called immediately after "connected" is received from the platform. This will succeed only when the VPN session is owned by the extension. * @param parameters The parameters for the VPN session. * @param callback Called when the parameters are set or if there is an error. */ - export function setParameters(parameters: VpnSessionParameters, callback: Function): void; + export function setParameters(parameters: VpnSessionParameters, callback?: () => void): void; /** * Sends an IP packet through the tunnel created for the VPN session. This will succeed only when the VPN session is owned by the extension. * @param data The IP packet to be sent to the platform. * @param callback Optional. Called when the packet is sent or if there is an error. */ - export function sendPacket(data: ArrayBuffer, callback?: Function): void; + export function sendPacket(data: ArrayBuffer, callback?: () => void): void; /** * Notifies the VPN session state to the platform. This will succeed only when the VPN session is owned by the extension. * @param state The VPN session state of the VPN client. @@ -12877,7 +12877,7 @@ declare namespace chrome { * failure: VPN connection failed. * @param callback Optional. Called when the notification is complete or if there is an error. */ - export function notifyConnectionStateChanged(state: string, callback?: Function): void; + export function notifyConnectionStateChanged(state: string, callback?: () => void): void; /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */ export var onPlatformMessage: VpnPlatformMessageEvent; @@ -13150,7 +13150,7 @@ declare namespace chrome { * Manifest: "host_permissions" */ export namespace webRequest { - interface WebRequestEvent + interface WebRequestEvent void, U extends string[]> extends Omit, "addListener"> { addListener(callback: T, filter: RequestFilter, extraInfoSpec?: U): void; @@ -13407,7 +13407,7 @@ declare namespace chrome { * Can return its result via Promise in Manifest V3 or later since Chrome 116. */ export function handlerBehaviorChanged(): Promise; - export function handlerBehaviorChanged(callback: Function): void; + export function handlerBehaviorChanged(callback: () => void): void; /** Fired when a request is about to occur. */ export const onBeforeRequest: WebRequestBodyEvent; @@ -13741,7 +13741,7 @@ declare namespace chrome { */ export function remove(windowId: number): Promise; /** Removes (closes) a window, and all the tabs inside it. */ - export function remove(windowId: number, callback: Function): void; + export function remove(windowId: number, callback: () => void): void; /** * Gets the window that was most recently focused — typically the window 'on top'. */ @@ -14568,7 +14568,7 @@ declare namespace chrome { export function isRegexSupported(regexOptions: RegexOptions): Promise; /** Configures if the action count for tabs should be displayed as the extension action's badge text and provides a way for that action count to be incremented. */ - export function setExtensionActionOptions(options: ExtensionActionOptions, callback: Function): void; + export function setExtensionActionOptions(options: ExtensionActionOptions, callback: () => void): void; /** * Configures if the action count for tabs should be displayed as the extension action's badge text and provides a way for that action count to be incremented. @@ -14600,7 +14600,7 @@ declare namespace chrome { * In case of an error, runtime.lastError will be set and no change will be made to the rule set. * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, internal errors, and others. */ - export function updateDynamicRules(options: UpdateRuleOptions, callback: Function): void; + export function updateDynamicRules(options: UpdateRuleOptions, callback: () => void): void; /** Modifies the current set of dynamic rules for the extension. * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. @@ -14626,7 +14626,7 @@ declare namespace chrome { * In case of an error, runtime.lastError will be set and no change will be made to set of enabled rulesets. * This can happen for multiple reasons, such as invalid ruleset IDs, rule count limit exceeded, or internal errors. */ - export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: Function): void; + export function updateEnabledRulesets(options: UpdateRulesetOptions, callback: () => void): void; /** Updates the set of enabled static rulesets for the extension. * The rulesets with IDs listed in options.disableRulesetIds are first removed, and then the rulesets listed in options.enableRulesetIds are added. @@ -14651,7 +14651,7 @@ declare namespace chrome { * In case of an error, runtime.lastError will be set and no change will be made to the rule set. * This can happen for multiple reasons, such as invalid rule format, duplicate rule ID, rule count limit exceeded, and others. */ - export function updateSessionRules(options: UpdateRuleOptions, callback: Function): void; + export function updateSessionRules(options: UpdateRuleOptions, callback: () => void): void; /** Modifies the current set of session scoped rules for the extension. * The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. diff --git a/types/colornames/package.json b/types/colornames/package.json index a0430770240fe3..8ac65ab5a2b5e6 100644 --- a/types/colornames/package.json +++ b/types/colornames/package.json @@ -9,10 +9,6 @@ "@types/colornames": "workspace:." }, "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - }, { "name": "Benjamin Turner", "githubUsername": "blturner" diff --git a/types/connect-timeout/package.json b/types/connect-timeout/package.json index 372f0928bd19bf..3b385809a3b84a 100644 --- a/types/connect-timeout/package.json +++ b/types/connect-timeout/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/connect-timeout", - "version": "0.0.9999", + "version": "1.9.9999", "projects": [ "https://github.com/expressjs/timeout" ], diff --git a/types/crawler/package.json b/types/crawler/package.json index 22ee6858986385..b7342bd9732b2b 100644 --- a/types/crawler/package.json +++ b/types/crawler/package.json @@ -6,7 +6,7 @@ "https://github.com/bda-research/node-crawler" ], "dependencies": { - "@types/cheerio": "*" + "@types/cheerio": "<1" }, "devDependencies": { "@types/crawler": "workspace:." diff --git a/types/dirty-chai/dirty-chai-tests.ts b/types/dirty-chai/dirty-chai-tests.ts index 10b1120cdd42d4..969ab2a48ca9c7 100644 --- a/types/dirty-chai/dirty-chai-tests.ts +++ b/types/dirty-chai/dirty-chai-tests.ts @@ -4,6 +4,8 @@ import("chai").then(chai => chai.use(chaiAsPromised)); import dirtyChai = require("dirty-chai"); import("chai").then(chai => chai.use(dirtyChai)); +import "chai/register-should"; + declare const expect: Chai.ExpectStatic; // mocha-like stubs so we don't need to use mocha typings diff --git a/types/enzyme/package.json b/types/enzyme/package.json index b32b440cc24a46..8c1b44e8ca82da 100644 --- a/types/enzyme/package.json +++ b/types/enzyme/package.json @@ -6,7 +6,7 @@ "https://github.com/airbnb/enzyme" ], "dependencies": { - "@types/cheerio": "*", + "@types/cheerio": "<1", "@types/react": "^16" }, "devDependencies": { diff --git a/types/express-slow-down/express-slow-down-tests.ts b/types/express-slow-down/express-slow-down-tests.ts deleted file mode 100644 index 7b364b9c57adef..00000000000000 --- a/types/express-slow-down/express-slow-down-tests.ts +++ /dev/null @@ -1,33 +0,0 @@ -import slowDown = require("express-slow-down"); - -const slowerAllDefaults = slowDown({}); - -const slowerWithOptions = slowDown({ - windowMs: 15 * 60 * 1000, // 15 minutes, - delayAfter: 1, - delayMs: 0, // disabled - maxDelayMs: 20000, - skipFailedRequests: false, - skipSuccessfulRequests: true, - headers: true, -}); - -const slowerWithCallbacks = slowDown({ - keyGenerator: (req, res) => req.ip ?? "0.0.0.0", - skip: (req, res) => false, - onLimitReached: (req, res, opts) => { - console.log(req.slowDown.current); - console.log(req.slowDown.remaining); - console.log(req.slowDown.limit); - }, -}); - -class MockStore implements slowDown.Store { - incr(key: string, cb: slowDown.StoreIncrementCallback) {} - decrement(key: string) {} - resetKey(key: string) {} -} - -const slowerWithStore = slowDown({ - store: new MockStore(), -}); diff --git a/types/express-slow-down/index.d.ts b/types/express-slow-down/index.d.ts deleted file mode 100644 index ad0bea3c656081..00000000000000 --- a/types/express-slow-down/index.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import express = require("express"); - -declare namespace SlowDown { - type StoreIncrementCallback = (err?: {}, hits?: number) => void; - - interface SlowDownRequestAugmentation { - /** - * The `options.delayAfter` value - */ - limit: number; - - /** - * The number of requests in the current window - */ - current: number; - - /** - * the number of requests remaining before rate-limiting begins - */ - remaining: number; - - /** - * When the window will reset, `current` will return to `0`, and `remaining` will return - * to limit. Represents milliseconds since epoch (compare to `Date.now()`). This field - * depends on store support. It will be `undefined` if the store does not provide the value. - */ - resetTime?: number | undefined; - - /** - * Amount of delay imposed on current request in milliseconds - */ - delay: number; - } - - /** - * Express Request with the added `slowDown` property - */ - interface RequestWithSlowDown extends express.Request { - slowDown: SlowDownRequestAugmentation; - } - - interface Store { - incr(key: string, cb: StoreIncrementCallback): void; - decrement(key: string): void; - resetKey(key: string): void; - } - - /** - * express-slow-down options - */ - interface Options { - /** - * How long to keep records of requests in memory. Defaults to `60000` (1 minute) - */ - windowMs?: number | undefined; - - /** - * Max number of connections during `windowMs` before starting to delay responses. - * Defaults to `1`. Set to `0` to disable delaying. - */ - delayAfter?: number | undefined; - - /** - * How long to delay the response, multiplied by `(number recent hits - delayAfter)`. - * Defaults to `1000` (1 second). Set to `0` to disable delaying. - */ - delayMs?: number | undefined; - - /** - * Maximum value for `delayMs` after many consecutive attempts, that is, after the n-th request, - * the delay will be always `maxDelayMs`. Important when your application is running behind a - * load balancer or reverse proxy that has a request timeout. Defaults to Infinity. - */ - maxDelayMs?: number | undefined; - - /** - * When `true` failed requests (response status >= 400) won't be counted. Defaults to `false`. - */ - skipFailedRequests?: boolean | undefined; - - /** - * When `true` successful requests (response status < 400) won't be counted. Defaults to `false`. - */ - skipSuccessfulRequests?: boolean | undefined; - - /** - * Add `X-SlowDown-Limit`, `X-SlowDown-Remaining`, and if the store supports it, - * `X-SlowDown-Reset` headers to all responses. - */ - headers?: boolean; - - /** - * Function used to generate keys. By default user IP address (`req.ip`) is used. - * Default: `(req, res) => req.ip` - */ - keyGenerator?(req: express.Request, res: express.Response): string; - - /** - * Function used to skip requests. Returning `true` from the function will skip delaying for that request. - * Default: `(req, res) => false` - */ - skip?(req: express.Request, res: express.Response): boolean; - - /** - * Function to execute the first time the limit is reached within `windowMs`. - * Default: `(req, res, opts) => {}` - */ - onLimitReached?(req: RequestWithSlowDown, res: express.Response, optionsUsed: Options): void; - - /** - * The storage to use when persisting request attempts. By default, the MemoryStore is used. - */ - store?: Store | undefined; - } -} - -declare function SlowDown(options: SlowDown.Options): express.RequestHandler; -export = SlowDown; diff --git a/types/express-slow-down/package.json b/types/express-slow-down/package.json deleted file mode 100644 index ce42767fabbb42..00000000000000 --- a/types/express-slow-down/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "name": "@types/express-slow-down", - "version": "1.3.9999", - "projects": [ - "https://github.com/nfriedly/express-slow-down" - ], - "dependencies": { - "@types/express": "*" - }, - "devDependencies": { - "@types/express-slow-down": "workspace:." - }, - "owners": [ - { - "name": "Jeremy Forsythe", - "githubUsername": "jdforsythe" - }, - { - "name": "Josh Henderson", - "githubUsername": "joshhendo" - } - ] -} diff --git a/types/express-slow-down/tsconfig.json b/types/express-slow-down/tsconfig.json deleted file mode 100644 index 423a300d1d4a47..00000000000000 --- a/types/express-slow-down/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "express-slow-down-tests.ts" - ] -} diff --git a/types/fs-extra/test/fs-extra-tests.ts b/types/fs-extra/test/fs-extra-tests.ts index accf3c017bc6c3..37deccf064484c 100644 --- a/types/fs-extra/test/fs-extra-tests.ts +++ b/types/fs-extra/test/fs-extra-tests.ts @@ -868,14 +868,14 @@ fs.readdir(path, { withFileTypes: true }, (err, files) => { files; // $ExpectType Dirent[] }); -fs.readFile(path); // $ExpectType Promise || Promise> +fs.readFile(path); // $ExpectType Promise || Promise> || Promise fs.readFile(path, "utf-8"); // $ExpectType Promise fs.readFile(path, { encoding: "utf-8" }); // $ExpectType Promise -fs.readFile(path, { flag: "r" }); // $ExpectType Promise || Promise> +fs.readFile(path, { flag: "r" }); // $ExpectType Promise || Promise> || Promise // $ExpectType void fs.readFile(path, (err, data) => { err; // $ExpectType ErrnoException | null - data; // $ExpectType Buffer || Buffer + data; // $ExpectType Buffer || Buffer || NonSharedBuffer }); // $ExpectType void fs.readFile(path, "utf-8", (err, data) => { @@ -890,12 +890,12 @@ fs.readFile(path, { encoding: "utf-8" }, (err, data) => { // $ExpectType void fs.readFile(path, { flag: "r" }, (err, data) => { err; // $ExpectType ErrnoException | null - data; // $ExpectType Buffer || Buffer + data; // $ExpectType Buffer || Buffer || NonSharedBuffer }); // $ExpectType void fs.readFile(path, { signal: new AbortController().signal }, (err, data) => { err; // $ExpectType ErrnoException | null - data; // $ExpectType Buffer || Buffer + data; // $ExpectType Buffer || Buffer || NonSharedBuffer }); fs.readlink(path); // $ExpectType Promise diff --git a/types/glob-stream/package.json b/types/glob-stream/package.json index a50eeb8eac5904..9a48e84035475c 100644 --- a/types/glob-stream/package.json +++ b/types/glob-stream/package.json @@ -21,10 +21,6 @@ { "name": "mrmlnc", "githubUsername": "mrmlnc" - }, - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" } ] } diff --git a/types/gulp-cheerio/package.json b/types/gulp-cheerio/package.json index e9c77a56e4ca35..c138fa63196bbb 100644 --- a/types/gulp-cheerio/package.json +++ b/types/gulp-cheerio/package.json @@ -6,7 +6,7 @@ "https://github.com/KenPowers/gulp-cheerio" ], "dependencies": { - "@types/cheerio": "*", + "@types/cheerio": "<1", "@types/node": "*", "@types/vinyl": "*" }, diff --git a/types/hoxy/package.json b/types/hoxy/package.json index 5a8650b883bf14..bfd0bc3224b5af 100644 --- a/types/hoxy/package.json +++ b/types/hoxy/package.json @@ -6,7 +6,7 @@ "https://github.com/greim/hoxy#readme" ], "dependencies": { - "@types/cheerio": "*" + "@types/cheerio": "<1" }, "devDependencies": { "@types/hoxy": "workspace:." diff --git a/types/iamport-react-native/.npmignore b/types/iamport-react-native/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/iamport-react-native/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/iamport-react-native/iamport-react-native-tests.tsx b/types/iamport-react-native/iamport-react-native-tests.tsx deleted file mode 100644 index 328d096a110fea..00000000000000 --- a/types/iamport-react-native/iamport-react-native-tests.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from "react"; - -import IMP, { CallbackRsp, PaymentData } from "iamport-react-native"; - -const IamportPayment = () => { - const callback = (response: CallbackRsp) => {}; - - const data: PaymentData = { - pg: "html5_inicis", - pay_method: "card", - name: "아임포튞 결제데읎터 분석", - merchant_uid: `mid_${new Date().getTime()}`, - amount: 39000, - buyer_name: "홍Ꞟ동", - buyer_tel: "01012345678", - buyer_email: "example@naver.com", - buyer_addr: "서욞시 강낚구 신사동 661-16", - buyer_postcode: "06018", - app_scheme: "example", - }; - - return ; -}; - -export default IamportPayment; diff --git a/types/iamport-react-native/index.d.ts b/types/iamport-react-native/index.d.ts deleted file mode 100644 index 4e06a75ac9625b..00000000000000 --- a/types/iamport-react-native/index.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -import * as React from "react"; - -export type IMP_CARRIERS = "SKT" | "KTF" | "LGT" | "MVNO"; -export type IMP_PG = - | "html5_inicis" - | "inicis" - | "uplus" - | "kcp" - | "kcp_billing" - | "nice" - | "jtnet" - | "kakao" - | "kakaopay" - | "danal" - | "danal_tpay" - | "kicc" - | "settle" - | "mobilians" - | "payco" - | "eximbay" - | "paypal" - | "naverco" - | "naverpay" - | "smilepay" - | "chai" - | "payple" - | "alipay"; - -export type IMP_PAY_METHOD = - | "card" - | "trans" - | "vbank" - | "phone" - | "samsung" - | "kpay" - | "cultureland" - | "smartculture" - | "happymoney" - | "booknlife" - | "kakaopay" - | "lpay" - | "payco" - | "ssgpay" - | "tosspay"; - -export type IMP_CURRENCY = "KRW" | "USD" | "EUR" | "JPY"; - -// Property Note : https://docs.iamport.kr/tech/imp?lang=en#callback -export interface CallbackRsp { - success?: boolean | undefined; - error_code?: string | undefined; - error_msg?: string | undefined; - imp_uid?: string | undefined; - merchant_uid?: string | undefined; - pay_method?: string | undefined; - paid_amount?: string | undefined; - status?: string | undefined; - name?: string | undefined; - pg_provider?: string | undefined; - pg_tid?: string | undefined; - buyer_name?: string | undefined; - buyer_email?: string | undefined; - buyer_tel?: string | undefined; - buyer_addr?: string | undefined; - buyer_postcode?: string | undefined; - custom_data?: object | undefined; - paid_at?: number | undefined; - receipt_url?: string | undefined; - apply_num?: string | undefined; - vbank_num?: string | undefined; - vbank_name?: string | undefined; - vbank_holder?: string | undefined; - vbank_date?: number | undefined; - imp_success?: string | undefined; -} - -export interface CertificationData { - merchant_uid?: string | undefined; - company?: string | undefined; - carrier?: IMP_CARRIERS | undefined; - name?: string | undefined; - phone?: string | undefined; - min_age?: string | undefined; - app_scheme?: string | undefined; -} - -export interface PaymentData { - pg?: IMP_PG | undefined; - pay_method?: IMP_PAY_METHOD | undefined; - currency?: IMP_CURRENCY | undefined; - notice_url?: string | string[] | undefined; - display?: { card_quota?: number | undefined } | undefined; - merchant_uid: string; - amount: number; - buyer_tel: string; - app_scheme: string; - escrow?: boolean | undefined; - name?: string | undefined; - tax_free?: number | undefined; - buyer_name?: string | undefined; - buyer_email?: string | undefined; - buyer_addr?: string | undefined; - buyer_postcode?: string | undefined; - custom_data?: object | undefined; - vbank_due?: string | undefined; - popup?: boolean | undefined; - digital?: boolean | undefined; - m_redirect_url?: string | undefined; - biz_num?: string | undefined; -} - -export interface CertificationProps { - userCode: string; - tierCode?: string | undefined; - data: CertificationData; - callback: (rsp: CallbackRsp) => void; - loading?: object | undefined; -} - -// Property Note : https://docs.iamport.kr/tech/imp?lang=en#param -export interface PaymentProps { - userCode: string; - tierCode?: string | undefined; - data: PaymentData; - callback: (rsp: CallbackRsp) => void; - loading?: object | undefined; - handleInicisTrans?: ((event: any) => void) | undefined; - open3rdPartyApp?: ((iamportUrl: any) => void) | undefined; -} - -declare const IMP: { - Certification: React.FC; - Payment: React.FC; -}; - -export default IMP; diff --git a/types/iamport-react-native/package.json b/types/iamport-react-native/package.json deleted file mode 100644 index 41917dc5eeaf8e..00000000000000 --- a/types/iamport-react-native/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/iamport-react-native", - "version": "1.5.9999", - "projects": [ - "https://github.com/iamport/iamport-react-native#readme" - ], - "dependencies": { - "@types/react": "*" - }, - "devDependencies": { - "@types/iamport-react-native": "workspace:." - }, - "owners": [ - { - "name": "seongjoojin", - "githubUsername": "seongjoojin" - } - ] -} diff --git a/types/iamport-react-native/tsconfig.json b/types/iamport-react-native/tsconfig.json deleted file mode 100644 index 98097cf0fc7164..00000000000000 --- a/types/iamport-react-native/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "jsx": "react-native", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "iamport-react-native-tests.tsx" - ] -} diff --git a/types/inline-css/package.json b/types/inline-css/package.json index 1f06a6eefbddda..63e4ffc75ef29d 100644 --- a/types/inline-css/package.json +++ b/types/inline-css/package.json @@ -6,7 +6,7 @@ "https://github.com/jonkemp/inline-css" ], "dependencies": { - "@types/cheerio": "*" + "@types/cheerio": "<1" }, "devDependencies": { "@types/inline-css": "workspace:." diff --git a/types/inquirer-npm-name/package.json b/types/inquirer-npm-name/package.json index 8f5fbd886c5352..8f5b4e1aef9be3 100644 --- a/types/inquirer-npm-name/package.json +++ b/types/inquirer-npm-name/package.json @@ -11,10 +11,5 @@ "devDependencies": { "@types/inquirer-npm-name": "workspace:." }, - "owners": [ - { - "name": "manuth", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/inquirer/package.json b/types/inquirer/package.json index 4e1e79b4db986d..76babb8e90c7ce 100644 --- a/types/inquirer/package.json +++ b/types/inquirer/package.json @@ -51,10 +51,6 @@ { "name": "Richard Lea", "githubUsername": "chigix" - }, - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" } ] } diff --git a/types/inquirer/v8/package.json b/types/inquirer/v8/package.json index a00bee5e014826..52fc08c30c7921 100644 --- a/types/inquirer/v8/package.json +++ b/types/inquirer/v8/package.json @@ -50,10 +50,6 @@ { "name": "Richard Lea", "githubUsername": "chigix" - }, - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" } ] } diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index ce29d7d3de7ae6..41cd9b5dfba60e 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -466,6 +466,7 @@ declare namespace jasmine { } interface Clock { + autoTick(): void; install(): Clock; uninstall(): void; /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index ecfd1f1a95058c..6857bd6c06a783 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -1734,6 +1734,14 @@ describe("Manually ticking the Jasmine Clock", () => { }); }); +describe("Automatically ticking the Jasmine Clock", () => { + it("ticks automatically", async () => { + jasmine.clock().install().autoTick(); + await new Promise(resolve => setTimeout(resolve)); + jasmine.clock().uninstall(); + }); +}); + describe("Asynchronous specs", () => { var value: number; beforeEach((done: DoneFn) => { diff --git a/types/json_ml/package.json b/types/json_ml/package.json index 56c4469ae7e31c..b722ff647a0a94 100644 --- a/types/json_ml/package.json +++ b/types/json_ml/package.json @@ -6,7 +6,7 @@ "https://github.com/59naga/json-ml" ], "dependencies": { - "@types/cheerio": "*" + "@types/cheerio": "<1" }, "devDependencies": { "@types/json_ml": "workspace:.", diff --git a/types/karma-chai/karma-chai-tests.ts b/types/karma-chai/karma-chai-tests.ts index b6ce13b6d8412c..28a7940d5b7c39 100644 --- a/types/karma-chai/karma-chai-tests.ts +++ b/types/karma-chai/karma-chai-tests.ts @@ -1,4 +1,5 @@ /// +import "chai/register-should"; declare const expect: Chai.ExpectStatic; declare const assert: Chai.AssertStatic; diff --git a/types/karma-sinon-chai/test/karma-sinon-chai-global-tests.ts b/types/karma-sinon-chai/test/karma-sinon-chai-global-tests.ts index 3f9f3a7480bb3f..168d09a3d370d1 100644 --- a/types/karma-sinon-chai/test/karma-sinon-chai-global-tests.ts +++ b/types/karma-sinon-chai/test/karma-sinon-chai-global-tests.ts @@ -1,5 +1,7 @@ /// /// +import "chai/register-should"; +import * as sinon from "sinon"; // Ref: https://github.com/kmees/karma-sinon-chai#usage // Each of the different Chai assertion suites is available in the tests: diff --git a/types/mixpanel-browser/index.d.ts b/types/mixpanel-browser/index.d.ts index d293c3a73dc1a9..b8eb91b9fc50f1 100644 --- a/types/mixpanel-browser/index.d.ts +++ b/types/mixpanel-browser/index.d.ts @@ -44,6 +44,81 @@ export interface RegisterOptions { persistent: boolean; } +export type TrackPageView = + | boolean + | "url-with-path" + | "url-with-path-and-query-string" + | "full-url"; + +export interface AutocaptureConfig { + /** + * When set to `true`, Mixpanel will track element clicks. It will not track textContent unless `capture_text_content` is also set to `true`. + * @default true + */ + click?: boolean; + /** + * When set to `true`, Mixpanel will track when an input is provided. It will not capture input content. + * @default true + */ + input?: boolean; + /** + * When set, Mixpanel will collect pageviews when some components of the URL change — including UTM parameters. + * @default 'full-url' + */ + pageview?: TrackPageView; + /** + * When set, Mixpanel will collect page scrolls at specified scroll intervals. + * @default true + */ + scroll?: boolean; + /** + * When set to `true`, Mixpanel will track form submissions (but not submission content). + * @default true + */ + submit?: boolean; + /** + * When set to `true`, Mixpanel will capture the textContent of any element. + * @default false + */ + capture_text_content?: boolean; + /** Enables specification of additional attributes to track. */ + capture_extra_attrs?: string[]; + /** + * Establishes the scroll depth intervals which trigger `Page Scroll` event. + * @default [25, 50, 75, 100] + */ + scroll_depth_percent_checkpoints?: number[]; + /** + * When set to true, overrides `scroll_depth_percentage_checkpoints` and captures all scroll events. + * @default false + */ + scroll_capture_all?: boolean; + /** Opts out specific pages from Autocapture. */ + block_url_regexes?: RegExp[]; + /** Opts in specific pages to Autocapture. */ + allow_url_regexes?: RegExp[]; + /** Opts out specific classes from Autocapture. */ + block_selectors?: string[]; + /** Opts in specific classes to Autocapture. */ + allow_selectors?: string[]; + /** Opts out specific attributes from Autocapture. */ + block_attrs?: string[]; + /** + * A user-provided function that determines whether a specific element should be + * tracked via Autocapture or not. The function receives the element as its first + * argument, and the DOM event as its second argument, and should return `true` if + * the element should be tracked (otherwise the element will NOT be tracked). + */ + allow_element_callback?: (element: Element, event: Event) => boolean; + /** + * A user-provided function that determines whether a specific element should be + * blocked from tracking via Autocapture or not. The function receives the element + * as its first argument, and the DOM event as its second argument, and should + * return `true` if the element should be blocked. + */ + block_element_callback?: (element: Element, event: Event) => boolean; +} + export interface Config { api_host: string; api_routes: { @@ -76,11 +151,8 @@ export interface Config { */ debug: boolean; track_links_timeout: number; - track_pageview: - | boolean - | "url-with-path" - | "url-with-path-and-query-string" - | "full-url"; + track_pageview: TrackPageView; + autocapture: boolean | AutocaptureConfig; skip_first_touch_marketing: boolean; cookie_expiration: number; upgrade: boolean; diff --git a/types/mixpanel-browser/mixpanel-browser-tests.ts b/types/mixpanel-browser/mixpanel-browser-tests.ts index 7660f13542706e..e28394e99fbca4 100644 --- a/types/mixpanel-browser/mixpanel-browser-tests.ts +++ b/types/mixpanel-browser/mixpanel-browser-tests.ts @@ -38,6 +38,18 @@ mixpanel.init("token", { mixpanel.init("token", { track_pageview: "full-url", }); +mixpanel.init("token", { + autocapture: true, +}); +mixpanel.init("token", { + autocapture: { + pageview: "url-with-path-and-query-string", + capture_extra_attrs: ["id"], + allow_element_callback: () => false, + scroll_depth_percent_checkpoints: [20], + block_url_regexes: [/\/login\/?$/], + }, +}); mixpanel.push(["register", { a: "b" }]); mixpanel.disable(); mixpanel.track("Registered", { Gender: "Male", Age: 21 }); diff --git a/types/mixpanel-browser/package.json b/types/mixpanel-browser/package.json index 8458dce75332dc..a784e772a97940 100644 --- a/types/mixpanel-browser/package.json +++ b/types/mixpanel-browser/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/mixpanel-browser", - "version": "2.54.9999", + "version": "2.60.9999", "projects": [ "https://github.com/mixpanel/mixpanel-js" ], diff --git a/types/mustache/package.json b/types/mustache/package.json index 478a3a6ad69c70..ac31a17837c1aa 100644 --- a/types/mustache/package.json +++ b/types/mustache/package.json @@ -22,10 +22,6 @@ "name": "Mark Ashley Bell", "githubUsername": "markashleybell" }, - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - }, { "name": "Phillip Johnsen", "githubUsername": "phillipj" diff --git a/types/cheerio/.npmignore b/types/node-red__flow-parser/.npmignore similarity index 100% rename from types/cheerio/.npmignore rename to types/node-red__flow-parser/.npmignore diff --git a/types/node-red__flow-parser/index.d.ts b/types/node-red__flow-parser/index.d.ts new file mode 100644 index 00000000000000..b92b68772773bb --- /dev/null +++ b/types/node-red__flow-parser/index.d.ts @@ -0,0 +1,332 @@ +/** + * parseFlow - Parses a Node-RED Flow object + * + * @param {array} flow An Flow JSON Array + * @return {NRFlowSet} Description + */ +export function parseFlow(flow: unknown[]): NRFlowSet; + +export type Walkable = NRFlow | NRSubflow | NRNode | NRConfigNode | NRGroup; +export type WalkFunction = (obj: Walkable) => void; +/** + * NRFlowSet - Description + */ +export class NRFlowSet { + constructor(flowConfig: unknown[]); + flows: Map; + nodes: Map; + configNodes: Map; + subflows: Map; + groups: Map; + wires: NRWire[]; + globals: NRFlow; + /** + * Export the flow as a Node Array that can be saves as JSON and loaded by Node-RED + * + * @return {Array} an array of node-red objects + */ + export(): unknown[]; // TODO: FIX THIS + /** + * Call the provided callback function for every object in the flow. + * The objects are recursively visited in the following order: + * + * - Subflow definitions + * - Config nodes scoped to this subflow + * - Groups + * - Nodes + * - Global Config nodes + * - Flows + * - Config nodes scoped to this flow + * - Groups + * - Nodes + * + * @param {WalkFunction} callback - A function to call for every object in the flow. + * The function will receive the object as its + * first argument + */ + walk(callback: WalkFunction): void; +} + +/** + * NRObject - Description + */ +export class NRObject { + /** + * constructor - Description + * @param {type} config Description + */ + constructor(config: unknown); + id: string; + z: string; + type: string; + disabled: boolean; + config: Record; + parent: NRFlow | NRSubflow; + /** + * setParent - Sets the parent object of this object. Either a Flow or Subflow + * @param {NRFlow|NRSubflow} parent Description + */ + setParent(parent: NRFlow | NRSubflow): void; + /** + * export - Exports this object as an Object that can be included in a flow + * @return {unknown} the exported object + */ + export(): unknown; + walk(callback: WalkFunction): void; + walkContents(callback: WalkFunction): void; +} + +/** + * NRContainer - Description + * nodes - Flow nodes in this flow/subflow/group + */ +export class NRContainer extends NRObject { + nodes: Map; + /** + * addNode - Description + * @param {NRNode} node Description + */ + addNode(node: NRNode): void; + exportContents(): unknown[]; +} + +/** + * NRFlow - Description + */ +export class NRFlow extends NRContainer { + TYPE: ObjectTypes["Flow"]; + info: string; + configs: Map; + subflows: Map; + groups: Map; + /** + * addSubflow - Description + * @param {NRSubflow} subflow Description + */ + addSubflow(subflow: NRSubflow): void; + /** + * addConfigNode - Description + * @param {NRConfigNode} configNode Description + */ + addConfigNode(configNode: NRConfigNode): void; + /** + * addGroup - Description + * @param {NRGroup} group Description + */ + addGroup(group: NRGroup): void; +} + +/** + * NRSubflow - Description + */ +export class NRSubflow extends NRContainer { + TYPE: ObjectTypes["Subflow"]; + info: string; + configs: Map; + subflows: Map; + groups: Map; + /** + * addSubflow - Description + * @param {NRSubflow} subflow Description + */ + addSubflow(subflow: NRSubflow): void; + /** + * addConfigNode - Description + * @param {NRConfigNode} configNode Description + */ + addConfigNode(configNode: NRConfigNode): void; + /** + * addGroup - Description + * @param {NRGroup} group Description + */ + addGroup(group: NRGroup): void; + instances: Map; + in?: Array<{ x: number; y: number; wires: Array<{ id: string }> }>; + out?: Array<{ x: number; y: number; wires: Array<{ id: string; port: number }> }>; + _ownProperties: string[]; + /** + * addInstance - Description + * + * @param {NRSubflowInstance} node Description + */ + addInstance(node: NRSubflowInstance): void; +} + +/** + * NRSubflowInstance - Description + */ +export class NRSubflowInstance extends NRNode { + subflowId: string; + subflow: NRSubflow; + /** + * setSubflow - Description + * @param {NRSubflow} subflow The Subflow this is an instance of + */ + setSubflow(subflow: NRSubflow): void; +} + +/** + * NRNode - Description + */ +export class NRNode extends NRObject { + TYPE: ObjectTypes["Node"]; + x: number; + y: number; + groupId?: string; + w: number; + h: number; + showLabel: boolean; + inputLabels: string[]; + outputLabels: string[]; + icon: string; + wires: string[][]; + outputCount: number; + info: string; + inboundWires: NRWire[]; + outboundWires: NRWire[]; + /** + * setGroup - Set the group this node is in + * + * @param {NRGroup} group the group this node is a member of + */ + setGroup(group: NRGroup): void; + group?: NRGroup; + /** + * getSiblingNodes - Get the nodes wired directly to this node + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getSiblingNodes(followVirtual: boolean): NRNode[]; + /** + * getPreviousNodes - Get the nodes wired to this node's inputs + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getPreviousNodes(followVirtual: boolean): NRNode[]; + /** + * getNextNodes - Get the nodes wired to this node's outputs + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getNextNodes(followVirtual: boolean): NRNode[]; + /** + * getDownstreamNodes - Get all nodes reachable from this nodes's outputs + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getDownstreamNodes(followVirtual: boolean): NRNode[]; + /** + * getUpstreamNodes - Get all nodes reachable from this nodes's inputs + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getUpstreamNodes(followVirtual: boolean): NRNode[]; + /** + * getConnectedNodes - Get all nodes, not including this one, reachable from its inputs and outputs + * @param {boolean} followVirtual whether to follow Link node virtual wires + * @return {string[]} An array of node ids + */ + getConnectedNodes(followVirtual: boolean): NRNode[]; + /** + * addOutboundWire - Add an outbound wire to this node + * @param {NRWire} wire the outbound wire + */ + addOutboundWire(wire: NRWire): void; + /** + * addInboundWire - Add an inbound wire to this node + * @param {NRWire} wire the inbound wire + */ + addInboundWire(wire: NRWire): void; +} + +/** + * NRWire - Description + * sourceNode - source of the wire + * sourcePortIndex - index of the source port + * destinationNode - destination of the wire + * destinationPortIndex - index of the destination port + * virtual - whether this is a virtual wire between link nodes + */ +export class NRWire { + /** + * constructor - Description + * + * @param {type} config Description + */ + constructor( + sourceNode: NRNode, + sourcePortIndex: number, + destinationNode: NRNode, + destinationPortIndex: number, + virtual?: boolean, + ); + sourceNode: NRNode; + sourcePortIndex: number; + destinationNode: NRNode; + destinationPortIndex: number; + virtual: boolean; + toString(): string; +} + +/** + * NRConfigNode - Description + * users - Nodes that reference this config node + * @inheritdoc + */ +export class NRConfigNode extends NRObject { + TYPE: ObjectTypes["ConfigNode"]; + users: Set; + addUser(node: NRObject): void; +} + +/** + * NRGroup - Description + * groupId - if set, the id of the parent group this group is in (from `node.g`) + * group - the parent group + * info - any documentation for this group + * style - style properties for this group + */ +export class NRGroup extends NRContainer { + TYPE: ObjectTypes["Group"]; + w: number; + h: number; + groupId: string; + style: Record; + info: string; + _nodes: Array; + setGroup(group: NRGroup): void; + group: NRGroup; + addNode(node: NRSubflowInstance | NRNode): void; +} +/** + * Node - A flow node + * ConfigNode - A Configuration node + * Group - A Group + * Flow - A Flow + * Subflow - A Subflow + * @global + */ +export interface ObjectTypes { + /** + * - A flow node + */ + Node: "NRNode"; + /** + * - A Configuration node + */ + ConfigNode: "NRConfigNode"; + /** + * - A Group + */ + Group: "NRGroup"; + /** + * - A Flow + */ + Flow: "NRFlow"; + /** + * - A Subflow + */ + Subflow: "NRSubflow"; +} + +export const types: ObjectTypes; diff --git a/types/node-red__flow-parser/node-red__flow-parser-tests.ts b/types/node-red__flow-parser/node-red__flow-parser-tests.ts new file mode 100644 index 00000000000000..240087fa403d31 --- /dev/null +++ b/types/node-red__flow-parser/node-red__flow-parser-tests.ts @@ -0,0 +1,35 @@ +import FlowParser from "@node-red/flow-parser"; + +function flowParserTests() { + const flow = FlowParser.parseFlow([]); + flow.walk(obj => { + switch (obj.TYPE) { + case FlowParser.types.Flow: + obj.info; + obj.configs; + obj.subflows; + obj.groups; + break; + case FlowParser.types.Subflow: + obj.instances; + obj.in; + obj.out; + break; + case FlowParser.types.Node: + // $ExpectType number + obj.x; + // $ExpectType number + obj.y; + // $ExpectType string | undefined + obj.groupId; + break; + case FlowParser.types.ConfigNode: + obj.users; + break; + case FlowParser.types.Group: + obj.style; + break; + } + }); + flow.export(); +} diff --git a/types/node-red__flow-parser/package.json b/types/node-red__flow-parser/package.json new file mode 100644 index 00000000000000..ba1a27caaccf1a --- /dev/null +++ b/types/node-red__flow-parser/package.json @@ -0,0 +1,17 @@ +{ + "private": true, + "name": "@types/node-red__flow-parser", + "version": "1.0.9999", + "projects": [ + "https://github.com/node-red/flow-parser#readme" + ], + "devDependencies": { + "@types/node-red__flow-parser": "workspace:." + }, + "owners": [ + { + "name": "Nasser Oloumi", + "githubUsername": "noloumi" + } + ] +} diff --git a/types/safe-flat/tsconfig.json b/types/node-red__flow-parser/tsconfig.json similarity index 90% rename from types/safe-flat/tsconfig.json rename to types/node-red__flow-parser/tsconfig.json index be391b25314a73..7ccfa3b2107784 100644 --- a/types/safe-flat/tsconfig.json +++ b/types/node-red__flow-parser/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "safe-flat-tests.ts" + "node-red__flow-parser-tests.ts" ] } diff --git a/types/node-zendesk/.npmignore b/types/node-zendesk/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/node-zendesk/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/node-zendesk/index.d.ts b/types/node-zendesk/index.d.ts deleted file mode 100644 index c69c0761ff5620..00000000000000 --- a/types/node-zendesk/index.d.ts +++ /dev/null @@ -1,1291 +0,0 @@ -/// - -import stream = require("node:stream"); -import { PathLike } from "fs"; - -export type ZendeskCallback = ( - error: Error | undefined, - response: TResponse, - result: TResult, -) => void; - -export interface Client { - accountsettings: unknown; - activitystream: unknown; - attachments: Attachments.Methods; - brand: unknown; - categories: unknown; - customagentroles: unknown; - dynamiccontent: unknown; - forums: unknown; - forumsubscriptions: unknown; - groupmemberships: unknown; - groups: Groups.Methods; - helpers: unknown; - imports: unknown; - installations: unknown; - jobstatuses: JobStatuses.Methods; - locales: unknown; - macros: Macros.Methods; - oauthtokens: unknown; - organizationfields: unknown; - organizationmemberships: unknown; - organizations: Organizations.Methods; - policies: unknown; - requests: Requests.Methods; - satisfactionratings: unknown; - search: unknown; - sessions: unknown; - sharingagreement: unknown; - suspendedtickets: unknown; - tags: unknown; - targets: unknown; - ticketaudits: unknown; - ticketevents: unknown; - ticketexport: unknown; - ticketfields: Tickets.Fields.Methods; - ticketforms: unknown; - ticketimport: unknown; - ticketmetrics: unknown; - tickets: Tickets.Methods; - topiccomments: unknown; - topics: unknown; - topicsubscriptions: unknown; - topicvotes: unknown; - triggers: unknown; - userfields: Users.Fields.Methods; - useridentities: Users.Identities.Methods; - users: Users.Methods; - views: unknown; -} - -export interface ClientOptions { - username: string; - token: string; - remoteUri: string; - oauth?: boolean | undefined; - debug?: boolean | undefined; - disableGlobalState?: boolean | undefined; - asUser?: string | undefined; -} - -export function createClient(config: ClientOptions): Client; - -export namespace Attachments { - interface Methods { - request(httpMethod: string, fields: unknown, config: unknown, cb: ZendeskCallback): unknown; - request(httpMethod: string, fields: unknown, config: unknown): Promise; - - show(attachmentId: number, cb: ZendeskCallback): unknown; - show(attachmentId: number): Promise; - - upload( - file: PathLike | Buffer | stream, - fileOptions: { - filename: string; - token?: string | undefined; - binary?: boolean; - }, - cb: ZendeskCallback, - ): void; - upload( - file: PathLike | Buffer | stream, - fileOptions: { - filename: string; - token?: string | undefined; - binary?: boolean; - }, - ): Promise; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/attachments#json-format} - */ - interface Attachment extends PersistableModel { - readonly content_type?: string | undefined; - readonly content_url?: string | undefined; - readonly deleted?: boolean | undefined; - readonly file_name?: string | undefined; - readonly inline?: boolean | undefined; - readonly mapped_content_url?: string | undefined; - readonly size?: number | undefined; - readonly url?: string | undefined; - } - - interface Model extends Attachment { - thumbnails?: readonly Attachment[] | undefined; - } - - interface ShowResponseModel { - attachment: Attachment; - } - - interface UploadResponseModel { - upload: { - attachment?: Attachment | undefined; - attachments?: Attachment[] | undefined; - token: string; - }; - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/job_statuses|Zendesk Job Statuses} - */ -export namespace JobStatuses { - interface Methods { - show(jobStatusId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - show(jobStatusId: ZendeskID): Promise; - watch( - jobStatusId: ZendeskID, - interval: number, - maxAttempts: number, - cb: ZendeskCallback, - ): unknown; - watch(jobStatusId: ZendeskID, interval: number, maxAttempts: number): Promise; - } - - type Status = "queued" | "working" | "failed" | "completed" | "killed"; - - interface Result extends PersistableModel { - readonly action: string; - readonly success: boolean; - readonly status: string; - } - - interface ResponseModel extends PersistableModel { - readonly url?: string | null | undefined; - readonly total?: number | undefined; - readonly progress?: number | undefined; - readonly status?: Status | undefined; - readonly message?: string | null | undefined; - readonly results?: readonly Result[] | undefined; - } - - interface ResponsePayload { - readonly job_status: ResponseModel; - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/macros|Zendesk Macros} - */ -export namespace Macros { - interface Methods { - applyTicket( - ticketId: ZendeskID, - macroId: number, - cb: ZendeskCallback, - ): ApplyTicketResponsePayload; - applyTicket(ticketId: ZendeskID, macroId: number): Promise; - } - - interface ApplyTicketResponsePayload { - result: { - ticket: Tickets.CreateModel; - comment: { - body: string; - html_body: string; - scoped_body?: unknown | undefined; - public?: boolean | undefined; - }; - }; - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/organizations|Zendesk Organizations} - */ -export namespace Organizations { - interface Methods { - /** Listing Organizations */ - list(cb: ZendeskCallback): ListPayload; - list(): Promise; - - /** Showing Organizations */ - show(organizationId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - show(organizationId: ZendeskID): Promise; - - /** Creating Organizations */ - create(organization: CreatePayload, cb: ZendeskCallback): ResponsePayload; - create(organization: CreatePayload): Promise; - createMany( - organizations: CreateManyPayload, - cb: ZendeskCallback, - ): JobStatuses.ResponsePayload; - createMany(organizations: CreateManyPayload): Promise; - - /** Updating Organizations */ - update( - organizationId: ZendeskID, - organization: UpdatePayload, - cb: ZendeskCallback, - ): ResponsePayload; - update(organizationId: ZendeskID, organization: UpdatePayload): Promise; - updateMany( - organizations: UpdateManyPayload, - cb: ZendeskCallback, - ): JobStatuses.ResponsePayload; - updateMany(organizations: UpdateManyPayload): Promise; - - /** Deleting Organizations */ - delete(organizationId: ZendeskID, cb: ZendeskCallback): unknown; - delete(organizationId: ZendeskID): Promise; - - /** Searching Organizations */ - search(params: unknown, cb: ZendeskCallback): ListPayload; - search(params: unknown): Promise; - autocomplete(params: unknown, cb: ZendeskCallback): ListPayload; - autocomplete(params: unknown): Promise; - } - - interface ResponseModel extends AuditableModel { - readonly url?: string | undefined; - external_id?: string | null | undefined; - name: string; - domain_names?: readonly string[] | undefined; - details?: string | null | undefined; - notes?: string | null | undefined; - group_id?: number | null | undefined; - shared_tickets?: boolean | undefined; - shared_comments?: boolean | undefined; - tags?: readonly string[] | undefined; - organization_fields?: object | null | undefined; - } - - interface CreateModel { - name: string; - } - - interface UpdateModel { - notes: string; - } - - interface UpdateManyModel extends UpdateModel { - id: ZendeskID; - } - - interface ResponsePayload { - readonly organization: ResponseModel; - } - - interface ListPayload extends PaginablePayload { - readonly organizations: readonly ResponseModel[]; - } - - interface CreatePayload { - readonly organization: CreateModel; - } - - interface CreateManyPayload { - readonly organizations: readonly CreateModel[]; - } - - interface UpdatePayload { - readonly organization: UpdateModel; - } - - interface UpdateManyPayload { - readonly organizations: readonly UpdateManyModel[]; - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/requests|Zendesk Requests} - */ -export namespace Requests { - interface Methods { - /** Listing Requests */ - list(cb: ZendeskCallback): ListPayload; - list(): Promise; - listOpen(cb: ZendeskCallback): ListPayload; - listOpen(): Promise; - listSolved(cb: ZendeskCallback): ListPayload; - listSolved(): Promise; - listCCD(organizationId: ZendeskID, cb: ZendeskCallback): ListPayload; - listCCD(organizationId: ZendeskID): Promise; - listByUser(userId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByUser(userId: ZendeskID): Promise; - listByOrganization(organizationId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByOrganization(organizationId: ZendeskID): Promise; - - /** Viewing Requests */ - getRequest(requestId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - getRequest(requestId: ZendeskID): Promise; - - /** Creating Requests */ - create(request: CreatePayload, cb: ZendeskCallback): ResponsePayload; - create(request: CreatePayload): Promise; - - /** Updating Requests */ - update(requestId: ZendeskID, request: UpdatePayload, cb: ZendeskCallback): ResponsePayload; - update(requestId: ZendeskID, request: UpdatePayload): Promise; - - /** Listing Comments */ - listComments(requestId: ZendeskID, cb: ZendeskCallback): Comments.ListPayload; - listComments(requestId: ZendeskID): Promise; - - /** Get Comment */ - getComment( - requestId: ZendeskID, - commentId: ZendeskID, - cb: ZendeskCallback, - ): Comments.ResponsePayload; - getComment(requestId: ZendeskID, commentId: ZendeskID): Promise; - - /** Inherited */ - requestAll(httpMethod: string, fields: unknown, cb: ZendeskCallback): ListPayload; - requestAll(httpMethod: string, fields: unknown): Promise; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/requests#create-request|Zendesk Requests Create} - */ - interface CreateModel { - requester?: RequesterAnonymous | undefined; // Required for anonymous requests - subject: string; - comment: Comments.CreateModel; - priority?: Tickets.Priority | null | undefined; // Anonymous requests can set priority, Authenticated requests cannot - type?: Tickets.TicketType | null | undefined; // Anonymous requests can set type, Authenticated requests cannot - custom_fields?: Tickets.Field[] | null | undefined; - fields?: Tickets.Field[] | null | undefined; - due_at?: string | null | undefined; // Anonymous requests can set due date as long as type == task. Authenticated requests cannot - ticket_form_id?: number | null | undefined; - recipient?: string | null | undefined; - collaborators?: ZendeskID[] | string[] | Collaborator[] | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/requests#update-request|Zendesk Requests Update} - */ - interface UpdateModel { - comment?: Comments.CreateModel | undefined; - solved?: boolean | undefined; - additional_collaborators?: ZendeskID[] | string[] | Collaborator[] | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/requests#json-format|Zendesk Requests JSON Format} - */ - interface ResponseModel extends AuditableModel { - readonly url: string; - readonly subject: string; - readonly description: string; - readonly status: Tickets.Status; - readonly priority: Tickets.Priority | null; - readonly type: Tickets.TicketType | null; - readonly custom_fields: Tickets.Field[] | null; - readonly fields: Tickets.Field[] | null; - readonly organization_id: ZendeskID | null; - readonly requester_id: ZendeskID; - readonly assignee_id: ZendeskID | null; - readonly group_id?: ZendeskID | null | undefined; - readonly collaborator_ids: ZendeskID[]; - readonly email_cc_ids: ZendeskID[]; - readonly via: Tickets.Via; - readonly is_public: boolean; - readonly due_at: string | null; - readonly can_be_solved_by_me?: boolean | undefined; - readonly solved?: boolean | undefined; - readonly ticket_form_id?: number | null | undefined; - readonly recipient: string | null; - readonly followup_source_id: string | null; - } - - interface RequesterAnonymous { - name: string; - email?: string | undefined; - locale_id?: ZendeskID | undefined; - } - - interface Collaborator { - name?: string | undefined; - email: string; - } - - interface CreatePayload { - readonly request: CreateModel; - } - - interface UpdatePayload { - readonly request: UpdateModel; - } - - interface ResponsePayload { - readonly request: ResponseModel; - } - - interface ListPayload extends PaginablePayload { - readonly requests: readonly ResponseModel[]; - } - - namespace Comments { - interface CreateModel { - url?: string | undefined; - request_id?: number | undefined; - body?: string | undefined; - html_body?: string | undefined; - public?: boolean | undefined; - author_id?: ZendeskID | undefined; - uploads?: readonly string[] | undefined; - } - - interface ResponseModel extends TemporalModel { - readonly url: string; - readonly type: RequestType; - readonly request_id: number; - readonly body: string; - readonly html_body: string; - readonly plain_body: string; - readonly public: boolean; - readonly author_id: ZendeskID; - readonly attachments: readonly Attachments.Model[]; - readonly via?: Tickets.Via | undefined; - readonly metadata?: Tickets.Comments.Metadata | undefined; - } - - type RequestType = "Comment" | "VoiceComment"; - - namespace CommentsUsers { - interface ResponseModel extends PersistableModel { - readonly name: string; - readonly photo: Attachments.Model | null; - readonly agent: boolean; - readonly organization_id: number | null; - } - } - - interface ListPayload extends PaginablePayload { - comments: readonly ResponseModel[]; - users: readonly CommentsUsers.ResponseModel[]; - organizations: readonly Tickets.Comments.Organizations.ResponseModel[]; - } - - interface ResponsePayload { - readonly comment: ResponseModel; - } - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/tickets|Zendesk Tickets} - */ -export namespace Tickets { - interface Methods { - /** Listing Tickets */ - list(cb: ZendeskCallback): ListPayload; - list(): Promise; - listAssigned(userId: ZendeskID, cb: ZendeskCallback): ListPayload; - listAssigned(userId: ZendeskID): Promise; - listByOrganization(organizationId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByOrganization(organizationId: ZendeskID): Promise; - listByUserRequested(userId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByUserRequested(userId: ZendeskID): Promise; - listByUserCCD(userId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByUserCCD(userId: ZendeskID): Promise; - listWithFilter(type: string, value: unknown, cb: ZendeskCallback): ListPayload; - listWithFilter(type: string, value: unknown): Promise; - listRecent(cb: ZendeskCallback): ListPayload; - listRecent(): Promise; - listCollaborators(ticketId: ZendeskID, cb: ZendeskCallback): Users.ListPayload; - listCollaborators(ticketId: ZendeskID): Promise; - listIncidents(ticketId: ZendeskID, cb: ZendeskCallback): ListPayload; - listIncidents(ticketId: ZendeskID): Promise; - listMetrics(ticketId: ZendeskID, cb: ZendeskCallback): Metrics.ResponsePayload; - listMetrics(ticketId: ZendeskID): Promise; - - /** Viewing Tickets */ - show(ticketId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - show(ticketId: ZendeskID): Promise; - showMany(ticketIds: readonly ZendeskID[], cb: ZendeskCallback): ListPayload; - showMany(ticketIds: readonly ZendeskID[]): Promise; - - /** Creating Tickets */ - create(ticket: CreatePayload, cb: ZendeskCallback): ResponsePayload; - create(ticket: CreatePayload): Promise; - createMany(tickets: CreateManyPayload, cb: ZendeskCallback): JobStatuses.ResponsePayload; - createMany(tickets: CreateManyPayload): Promise; - - /** Updating Tickets */ - update(ticketId: ZendeskID, ticket: UpdatePayload, cb: ZendeskCallback): ResponsePayload; - update(ticketId: ZendeskID, ticket: UpdatePayload): Promise; - updateMany(tickets: UpdateManyPayload, cb: ZendeskCallback): JobStatuses.ResponsePayload; - updateMany(tickets: UpdateManyPayload): Promise; - - /** Deleting Tickets */ - delete(ticketId: ZendeskID, cb: ZendeskCallback): unknown; - delete(ticketId: ZendeskID): Promise; - deleteMany(ticketIds: readonly ZendeskID[], cb: ZendeskCallback): unknown; - deleteMany(ticketIds: readonly ZendeskID[]): Promise; - - /** Merging Tickets */ - merge( - ticketId: ZendeskID, - mergingTickets: MergePayload, - cb: ZendeskCallback, - ): JobStatuses.ResponsePayload; - merge(ticketId: ZendeskID, mergingTickets: MergePayload): Promise; - - /** Ticket Exports */ - export(startTime: number, cb: ZendeskCallback): unknown; - export(startTime: number): Promise; - exportSample(startTime: number, options: unknown): unknown; - incremental(startTime: number, cb: ZendeskCallback): unknown; - incremental(startTime: number): Promise; - incrementalInclude(startTime: number, include: unknown, cb: ZendeskCallback): unknown; - incrementalInclude(startTime: number, include: unknown): Promise; - incrementalSample(startTime: number, cb: ZendeskCallback): unknown; - incrementalSample(startTime: number): Promise; - - /** Listing Comments */ - getComments(requestId: ZendeskID, cb: ZendeskCallback): Comments.ListPayload; - getComments(requestId: ZendeskID): Promise; - - /** Listing Audits */ - exportAudit(ticketId: ZendeskID, cb: ZendeskCallback): AuditsListPayload; - exportAudit(ticketId: ZendeskID): Promise; - - /** Adding Tags */ - addTags(ticketId: ZendeskID, tags: readonly string[], cb: ZendeskCallback): TagsPayload; - addTags(ticketId: ZendeskID, tags: readonly string[]): Promise; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/tickets#create-ticket|Zendesk Tickets Create} - */ - interface CreateModel { - comment: Requests.Comments.CreateModel; - external_id?: string | null | undefined; - type?: TicketType | null | undefined; - subject?: string | null | undefined; - raw_subject?: string | null | undefined; - priority?: Priority | null | undefined; - status?: Status | null | undefined; - recipient?: string | null | undefined; - requester_id?: ZendeskID | undefined; - requester?: Requests.RequesterAnonymous | undefined; - submitter_id?: ZendeskID | null | undefined; - assignee_id?: ZendeskID | null | undefined; - organization_id?: number | null | undefined; - group_id?: number | null | undefined; - collaborator_ids?: readonly number[] | null | undefined; - collaborators?: readonly any[] | null | undefined; - follower_ids?: readonly number[] | null | undefined; - email_cc_ids?: readonly number[] | null | undefined; - forum_topic_id?: number | null | undefined; - problem_id?: number | null | undefined; - due_at?: string | null | undefined; - tags?: readonly string[] | null | undefined; - custom_fields?: Field[] | null | undefined; - fields?: Field[] | null | undefined; - via_followup_source_id?: number | null | undefined; - macro_ids?: readonly number[] | null | undefined; - ticket_form_id?: number | null | undefined; - brand_id?: number | null | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/tickets#update-ticket|Zendesk Tickets Update} - */ - interface UpdateModel { - subject?: string | null | undefined; - comment?: Requests.Comments.CreateModel | undefined; - requester_id?: ZendeskID | undefined; - assignee_id?: ZendeskID | null | undefined; - assignee_email?: string | null | undefined; - group_id?: number | null | undefined; - organization_id?: number | null | undefined; - collaborator_ids?: readonly number[] | null | undefined; - additional_collaborators?: readonly any[] | null | undefined; - followers?: readonly Follower[] | null | undefined; - email_ccs?: readonly EmailCC[] | null | undefined; - type?: TicketType | null | undefined; - priority?: Priority | null | undefined; - status?: Status | null | undefined; - tags?: readonly string[] | null | undefined; - external_id?: string | null | undefined; - problem_id?: number | null | undefined; - due_at?: string | null | undefined; - custom_fields?: Field[] | null | undefined; - updated_stamp?: string | null | undefined; - safe_update?: boolean | undefined; - sharing_agreement_ids?: readonly number[] | null | undefined; - macro_ids?: readonly number[] | null | undefined; - attribute_value_ids?: readonly number[] | null | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/tickets#json-format|Zendesk Tickets JSON Format} - */ - interface ResponseModel extends AuditableModel { - readonly url: string; - readonly external_id: string | null; - readonly type: TicketType | null; - readonly subject: string | null; - readonly raw_subject: string | null; - readonly description: string; - readonly priority: Priority | null; - readonly status: Status; - readonly recipient: string | null; - readonly requester_id: ZendeskID; - readonly submitter_id: ZendeskID; - readonly assignee_id: ZendeskID | null; - readonly organization_id: number; - readonly group_id: number | null; - readonly collaborator_ids: readonly number[]; - readonly follower_ids: readonly number[]; - readonly email_cc_ids: readonly number[]; - readonly forum_topic_id: number | null; - readonly problem_id: number | null; - readonly has_incidents: boolean; - readonly due_at: string | null; - readonly tags: readonly string[]; - readonly via: Via; - readonly custom_fields: Field[]; - readonly fields: Field[]; - readonly satisfaction_rating: object | string | null; - readonly sharing_agreement_ids: readonly number[]; - readonly followup_ids: readonly number[]; - readonly ticket_form_id?: number | null | undefined; // Enterprise version only - readonly brand_id?: number | null | undefined; // Enterprise version only - readonly allow_channelback: boolean; - readonly allow_attachments: boolean; - readonly is_public: boolean; - readonly comment_count?: number | undefined; - } - - interface Audit { - readonly id: ZendeskID; - readonly ticket_id: ZendeskID; - readonly metadata: unknown | null; - readonly via: Via | null; - readonly created_at: string; - readonly author_id: ZendeskID; - readonly events: readonly unknown[] | null; - } - - interface EmailCC { - user_id?: ZendeskID | undefined; - user_email?: string | undefined; - action: string; - } - - interface Field { - id: number; - value: any; - } - - interface Follower { - user_id?: ZendeskID | undefined; - user_email?: string | undefined; - action: string; - } - - type Priority = "urgent" | "high" | "normal" | "low"; - - type Status = "new" | "open" | "pending" | "hold" | "solved" | "closed"; - - type TicketType = "problem" | "incident" | "question" | "task"; - - interface Via { - channel: ViaChannel; - source: ViaSource; - } - - type ViaChannel = "api" | "web" | "mobile" | "rule" | "system"; - - interface ViaSource { - to: object; - from: object; - rel: string | null; - } - - interface CreatePayload { - readonly ticket: CreateModel; - } - - interface CreateManyPayload { - readonly tickets: readonly CreateModel[]; - } - - interface UpdatePayload { - readonly ticket: UpdateModel; - } - - interface UpdateManyPayload { - readonly tickets: readonly UpdateModel[]; - } - - interface MergePayload { - readonly ids: readonly ZendeskID[]; - readonly target_comment?: string | null | undefined; - readonly source_comment?: string | null | undefined; - } - - interface AuditsListPayload extends PaginablePayload { - readonly audits: readonly Audit[]; - } - - interface TagsPayload { - readonly tags: readonly string[]; - } - - interface ResponsePayload { - readonly ticket: ResponseModel; - readonly audit: Audit; - } - - interface ListPayload extends PaginablePayload { - readonly tickets: readonly ResponseModel[]; - } - - namespace Comments { - interface ResponseModel extends Requests.Comments.ResponseModel { - readonly via?: Via | undefined; - readonly metadata?: Metadata | undefined; - } - - interface Metadata { - flags?: readonly number[] | undefined; - flag_options: unknown; - } - - interface ListPayload extends PaginablePayload { - comments: readonly ResponseModel[]; - } - - namespace CommentsUsers { - interface ResponseModel extends Requests.Comments.CommentsUsers.ResponseModel { - readonly role: Users.Role; - } - } - - namespace Organizations { - interface ResponseModel extends PersistableModel { - readonly name: string; - } - } - } - - namespace Metrics { - interface MinutesObject { - calendar: number; - business: number; - } - - interface ResponseModel extends AuditableModel { - readonly ticket_id?: ZendeskID | undefined; - readonly url?: string | undefined; - readonly group_stations?: number | undefined; - readonly assignee_stations?: number | undefined; - readonly reopens?: number | undefined; - readonly replies?: number | undefined; - readonly assignee_updated_at?: string | null | undefined; - readonly requester_updated_at?: string | null | undefined; - readonly initially_assigned_at?: string | null | undefined; - readonly assigned_at?: string | null | undefined; - readonly solved_at?: string | null | undefined; - readonly latest_comment_added_at?: string | null | undefined; - readonly first_resolution_time_in_minutes?: MinutesObject | undefined; - readonly reply_time_in_minutes?: MinutesObject | undefined; - readonly full_resolution_time_in_minutes?: MinutesObject | undefined; - readonly agent_wait_time_in_minutes?: MinutesObject | undefined; - readonly requester_wait_time_in_minutes?: MinutesObject | undefined; - } - - interface ResponsePayload { - readonly ticket_metric: ResponseModel; - } - - interface ListPayload { - readonly ticket_metrics: readonly ResponseModel[]; - } - } - - namespace Fields { - interface Methods { - list(cb: ZendeskCallback): unknown; - list(): Promise; - show(fieldId: ZendeskID, cb: ZendeskCallback): unknown; - show(fieldId: ZendeskID): Promise; - create(field: CreateTicketField, cb: ZendeskCallback): unknown; - create(field: CreateTicketField): Promise; - create(field: CreateTicketField, cb: ZendeskCallback): unknown; - update(fieldId: ZendeskID, field: unknown, cb: ZendeskCallback): unknown; - update(fieldId: ZendeskID, field: unknown): Promise; - delete(fieldId: ZendeskID, cb: ZendeskCallback): unknown; - delete(fieldId: ZendeskID): Promise; - } - - /** - * Represents 'ticket_fields' - */ - interface TicketField { - readonly type: string | undefined; - readonly title: string | undefined; - id?: number | undefined; - active?: true; - agent_description?: string | undefined; - collapsed_for_agents?: boolean | undefined; - created_at?: Date | undefined; - description?: string | undefined; - editable_in_portal?: boolean | undefined; - position?: number | undefined; - raw_description?: string | undefined; - raw_title?: string | undefined; - raw_title_in_portal?: string | undefined; - regexp_for_validation?: string | undefined; - removable?: boolean | undefined; - required?: boolean | undefined; - required_in_portal?: boolean | undefined; - tag?: string | undefined; - title_in_portal?: string | undefined; - updated_at?: Date | undefined; - visible_in_portal?: boolean | undefined; - url?: string | undefined; - } - interface CreateTicketField extends TicketField { - key: string; - } - interface CustomFieldOptions { - [key: string]: unknown; - } - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/groups|Zendesk Groups} - */ -export namespace Groups { - interface Methods { - /** Listing Groups */ - list(): Promise; - list(cb: ZendeskCallback): ListPayload; - - /** Viewing Groups */ - assignable(): Promise; - assignable(cb: ZendeskCallback): ListPayload; - show(groupId: GroupID): Promise; - show(groupId: GroupID, cb: ZendeskCallback): ListPayload; - - /** Creating Groups */ - create(group: CreatePayload): Promise; - create(group: CreatePayload, cb: ZendeskCallback): ResponsePayload; - - /** Updating Groups */ - update(groupID: GroupID, group: UpdatePayload): Promise; - update(groupID: GroupID, group: UpdatePayload, cb: ZendeskCallback): ResponsePayload; - - /** Deleting Groups */ - delete(groupID: GroupID): Promise; - delete(groupID: GroupID, cb: ZendeskCallback): unknown; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/groups#create-group|Zendesk Groups Create} - */ - interface CreateModel { - name: string | null | undefined; - default?: boolean; - description?: string | null | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/groups#update-group|Zendesk Groups Update} - */ - interface UpdateModel { - name?: string; - description?: string | null | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/groups/#json-format|Zendesk Groups JSON Format} - */ - interface ResponseModel extends AuditableModel { - readonly default: boolean; - readonly deleted: boolean; - readonly description: string; - readonly name: string | null; - readonly url: string | null; - } - - interface CreatePayload { - readonly group: CreateModel; - } - - interface UpdatePayload { - readonly group: UpdateModel; - } - - interface ResponsePayload { - readonly group: ResponseModel; - } - - interface ListPayload extends PaginablePayload { - readonly groups: readonly ResponseModel[]; - } -} - -/** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/users|Zendesk Users} - */ -export namespace Users { - interface Methods { - /** User Auth */ - auth(cb: ZendeskCallback): unknown; - auth(): Promise; - - /** Listing Users */ - list(cb: ZendeskCallback): ListPayload; - list(): Promise; - listByGroup(groupId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByGroup(groupId: ZendeskID): Promise; - listByOrganization(organizationId: ZendeskID, cb: ZendeskCallback): ListPayload; - listByOrganization(organizationId: ZendeskID): Promise; - - /** Showing Users */ - show(userId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - show(userId: ZendeskID): Promise; - showMany(userIds: readonly ZendeskID[], cb: ZendeskCallback): ListPayload; - showMany(userIds: readonly ZendeskID[]): Promise; - - /** Creating Users */ - create(user: CreatePayload, cb: ZendeskCallback): ResponsePayload; - create(user: CreatePayload): Promise; - createMany(users: CreateManyPayload, cb: ZendeskCallback): JobStatuses.ResponsePayload; - createMany(users: CreateManyPayload): Promise; - createOrUpdate(user: CreatePayload, cb: ZendeskCallback): ResponsePayload; - createOrUpdate(user: CreatePayload): Promise; - createOrUpdateMany( - users: CreateManyPayload, - cb: ZendeskCallback, - ): JobStatuses.ResponsePayload; - createOrUpdateMany(users: CreateManyPayload): Promise; - - /** Updating Users */ - update(userId: ZendeskID, user: UpdatePayload, cb: ZendeskCallback): ResponsePayload; - update(userId: ZendeskID, user: UpdatePayload): Promise; - updateMany( - userIds: UpdateIdPayload, - users: UpdateManyPayload, - cb: ZendeskCallback, - ): JobStatuses.ResponsePayload; - updateMany(userIds: UpdateIdPayload, users: UpdateManyPayload): Promise; - - /** Suspending Users */ - suspend(userId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - suspend(userId: ZendeskID): Promise; - unsuspend(userId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - unsuspend(userId: ZendeskID): Promise; - - /** Deleting Users */ - delete(userId: ZendeskID, cb: ZendeskCallback): unknown; - delete(userId: ZendeskID): Promise; - - /** Searching Users */ - search(params: unknown, cb: ZendeskCallback): ListPayload; - search(params: unknown): Promise; - - /** Getting own User */ - me(cb: ZendeskCallback): ResponsePayload; - me(): Promise; - - /** Merging Users */ - merge(userId: ZendeskID, targetUserId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - merge(userId: ZendeskID, targetUserId: ZendeskID): Promise; - - /** Changing User Password */ - password( - userId: ZendeskID, - oldPassword: string, - newPassword: string, - cb: ZendeskCallback, - ): unknown; - password(userId: ZendeskID, oldPassword: string, newPassword: string): Promise; - - /** Users Export */ - incrementalInclude(startTime: number, include: unknown, cb: ZendeskCallback): ListPayload; - incrementalInclude(startTime: number, include: unknown): Promise; - incremental(startTime: number, cb: ZendeskCallback): ListPayload; - incremental(startTime: number): Promise; - incrementalSample(startTime: number, cb: ZendeskCallback): ListPayload; - incrementalSample(startTime: number): Promise; - } - - interface BaseModel { - email?: string | null | undefined; - alias?: string | null | undefined; - custom_role_id?: number | null | undefined; - details?: string | null | undefined; - external_id?: string | null | undefined; - locale_id?: number | null | undefined; - moderator?: boolean | null | undefined; - notes?: string | null | undefined; - only_private_comments?: boolean | null | undefined; - organization_id?: number | null | undefined; - default_group_id?: number | null | undefined; - phone?: string | null | undefined; - photo?: Attachments.Model | null | undefined; - restricted_agent?: boolean | null | undefined; - role?: Role | null | undefined; - signature?: string | null | undefined; - suspended?: boolean | null | undefined; - tags?: readonly unknown[] | null | undefined; - ticket_restriction?: TicketRestriction | null | undefined; - time_zone?: string | null | undefined; - user_fields?: object | null | undefined; - verified?: boolean | null | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/users#create-user|Zendesk Users Create} - */ - interface CreateModel extends BaseModel { - name: string; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/users#update-user|Zendesk Users Update} - */ - interface UpdateModel extends BaseModel { - name?: string | undefined; - } - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/users#json-format-for-agent-or-admin-requests|Zendesk Users JSON Format} - */ - interface ResponseModel extends AuditableModel { - readonly email: string | null; - readonly name: string; - readonly active: boolean; - readonly alias: string | null; - readonly chat_only: boolean; - readonly custom_role_id: number | null; - readonly role_type: RoleType; - readonly details: string | null; - readonly external_id: string | null; - readonly last_login_at: string | null; - readonly locale: string | null; - readonly locale_id: number | null; - readonly moderator: boolean; - readonly notes: string | null; - readonly only_private_comments: boolean; - readonly organization_id: number | null; - readonly default_group_id: number | null; - readonly phone: string | null; - readonly shared_phone_number: boolean | null; - readonly photo: Attachments.Model | null; - readonly restricted_agent: boolean; - readonly role: Role; - readonly shared: boolean; - readonly shared_agent: boolean; - readonly signature: string | null; - readonly suspended: boolean; - readonly tags?: readonly unknown[] | null | undefined; - readonly ticket_restriction: TicketRestriction | null; - readonly time_zone: string | null; - readonly two_factor_auth_enabled: boolean; - readonly url: string; - readonly user_fields?: object | null | undefined; - readonly verified: boolean; - readonly report_csv: boolean; - } - - type UpdateIdPayload = - | string - | readonly ZendeskID[] - | { ids: readonly ZendeskID[] } - | { external_ids: readonly ZendeskID[] }; - - interface CreatePayload { - user: CreateModel; - } - - interface CreateManyPayload { - users: readonly CreateModel[]; - } - - interface UpdatePayload { - user: UpdateModel; - } - - interface UpdateManyPayload { - users: readonly UpdateModel[]; - } - - interface ResponsePayload { - user: ResponseModel; - } - - interface ListPayload extends PaginablePayload { - users: readonly ResponseModel[]; - } - - type Role = "admin" | "agent" | "end-user"; - - /** - * Defines an agent type - * 0 - Custom - * 1 - Light - * 2 - Chat - */ - type RoleType = 0 | 1 | 2; - - type TicketRestriction = "assigned" | "groups" | "organization" | "requested"; - - /** - * @see {@link https://developer.zendesk.com/rest_api/docs/support/user_identities|Zendesk User Identities} - */ - namespace Identities { - interface Methods { - /** Listing Identities */ - list(userId: ZendeskID, cb: ZendeskCallback): ListPayload; - list(userId: ZendeskID): Promise; - - /** Viewing Identities */ - show(userId: ZendeskID, identityId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - show(userId: ZendeskID, identityId: ZendeskID): Promise; - - /** Creating Identities */ - create(userId: ZendeskID, identity: CreatePayload, cb: ZendeskCallback): ResponseModel; - create(userId: ZendeskID, identity: CreatePayload): Promise; - - /** Updating Identities */ - update( - userId: ZendeskID, - identityId: ZendeskID, - identity: UpdatePayload, - cb: ZendeskCallback, - ): ResponsePayload; - update(userId: ZendeskID, identityId: ZendeskID, identity: UpdatePayload): Promise; - makePrimary(userId: ZendeskID, identityId: ZendeskID, cb: ZendeskCallback): ListPayload; - makePrimary(userId: ZendeskID, identityId: ZendeskID): Promise; - verify(userId: ZendeskID, identityId: ZendeskID, cb: ZendeskCallback): ResponsePayload; - verify(userId: ZendeskID, identityId: ZendeskID): Promise; - requestVerification( - userId: ZendeskID, - identityId: ZendeskID, - cb: ZendeskCallback, - ): unknown; - requestVerification(userId: ZendeskID, identityId: ZendeskID): Promise; - - /** Deleting Identities */ - delete(userId: ZendeskID, identityId: ZendeskID, cb: ZendeskCallback): unknown; - delete(userId: ZendeskID, identityId: ZendeskID): Promise; - } - - interface CreateModel { - type: IdentityType; - value: string; - verified?: boolean | undefined; - primary?: boolean | undefined; - } - - interface UpdateModel { - value?: string | undefined; - verified?: boolean | undefined; - } - - interface ResponseModel extends AuditableModel { - readonly url: string; - readonly user_id: ZendeskID; - readonly type: IdentityType; - readonly value: string; - readonly verified: boolean; - readonly primary: boolean; - readonly undeliverable_count: number; - readonly deliverable_state: DeliverableState; - } - - interface CreatePayload { - readonly identity: CreateModel; - } - - interface UpdatePayload { - readonly identity: UpdateModel; - } - - interface ListPayload extends PaginablePayload { - readonly identities: readonly ResponseModel[]; - } - - interface ResponsePayload { - readonly identity: ResponseModel; - } - - type IdentityType = "agent_forwarding" | "email" | "facebook" | "google" | "phone_number" | "sdk"; - - type DeliverableState = "deliverable" | "undeliverable"; - } - - namespace Fields { - interface Methods { - list(cb: ZendeskCallback): unknown; - list(): Promise; - show(fieldId: ZendeskID, cb: ZendeskCallback): unknown; - show(fieldId: ZendeskID): Promise; - create(field: CreateUserField, cb: ZendeskCallback): unknown; - create(field: CreateUserField): Promise; - create(field: CreateUserField, cb: ZendeskCallback): unknown; - update(fieldId: ZendeskID, field: unknown, cb: ZendeskCallback): unknown; - update(fieldId: ZendeskID, field: unknown): Promise; - delete(fieldId: ZendeskID, cb: ZendeskCallback): unknown; - delete(fieldId: ZendeskID): Promise; - } - /** - * Types of custom fields that can be created - * @default 'text' - */ - type UserFieldType = "text" | "textarea" | "checkbox" | "date" | "integer" | "decimal" | "regexp" | "tagger"; - - /** - * Represents 'user_field' - */ - interface UserField { - readonly id?: number | undefined; - readonly url?: string | undefined; - readonly type?: UserFieldType | undefined; - key?: string | undefined; - title: string; - raw_title?: string | undefined; - description?: string | undefined; - raw_description?: string | undefined; - position?: number | undefined; - active?: boolean | undefined; - readonly system?: boolean | undefined; - regexp_for_validation?: string | undefined; - created_at?: Date | undefined; - updated_at?: Date | undefined; - tag?: string | undefined; - custom_field_options?: CustomFieldOptions[] | undefined; - } - interface CreateUserField extends UserField { - key: string; - } - interface CustomFieldOptions { - [key: string]: unknown; - } - } -} - -export interface PaginablePayload { - next_page: string | null; - previous_page: string | null; - count: number; -} - -export interface PersistableModel { - readonly id: ZendeskID; -} - -export interface TemporalModel extends PersistableModel { - readonly created_at: string; -} - -export interface AuditableModel extends TemporalModel { - readonly updated_at: string | null; -} - -export type ZendeskID = number; - -export type GroupID = number; diff --git a/types/node-zendesk/node-zendesk-tests.ts b/types/node-zendesk/node-zendesk-tests.ts deleted file mode 100644 index 30bba410093c7e..00000000000000 --- a/types/node-zendesk/node-zendesk-tests.ts +++ /dev/null @@ -1,298 +0,0 @@ -import { Attachments, Client, createClient } from "node-zendesk"; -import * as path from "path"; - -const client: Client = createClient({ - username: "foo", - token: "secret", - remoteUri: "/example", -}); - -const zendeskCallback = () => {}; - -const listPayload = client.organizations.list(() => {}); -listPayload.next_page; // $ExpectType string | null -listPayload.previous_page; // $ExpectType string | null - -/** Job Statuses Methods */ -client.jobstatuses.show(123, zendeskCallback); -client.jobstatuses.show(123).then(zendeskCallback); -client.jobstatuses.watch(123, 2, 3, zendeskCallback); -client.jobstatuses.watch(123, 2, 3).then(zendeskCallback); - -/** Macros Methods */ -client.macros.applyTicket(123, 123, zendeskCallback); -client.macros.applyTicket(123, 123).then(zendeskCallback); - -/** Organizations Methods */ -client.organizations.list(zendeskCallback); -client.organizations.list().then(zendeskCallback); -client.organizations.show(123, zendeskCallback); -client.organizations.show(123).then(zendeskCallback); -client.organizations.create({ organization: { name: "foo" } }, zendeskCallback); -client.organizations.create({ organization: { name: "foo" } }).then(zendeskCallback); -client.organizations.createMany({ organizations: [{ name: "foo" }, { name: "bar" }] }, zendeskCallback); -client.organizations.createMany({ organizations: [{ name: "foo" }, { name: "bar" }] }).then(zendeskCallback); -client.organizations.update(123, { organization: { notes: "foo" } }, zendeskCallback); -client.organizations.update(123, { organization: { notes: "foo" } }).then(zendeskCallback); -client.organizations.updateMany( - { organizations: [{ id: 123, notes: "foo" }, { id: 456, notes: "bar" }] }, - zendeskCallback, -); -client.organizations.updateMany({ organizations: [{ id: 123, notes: "foo" }, { id: 456, notes: "bar" }] }).then( - zendeskCallback, -); -client.organizations.delete(123, zendeskCallback); -client.organizations.delete(123).then(zendeskCallback); -client.organizations.search({ external_id: 123 }, zendeskCallback); -client.organizations.search({ external_id: 123 }).then(zendeskCallback); -client.organizations.autocomplete({ name: "foo" }, zendeskCallback); -client.organizations.autocomplete({ name: "foo" }).then(zendeskCallback); - -/** Requests Methods */ -client.requests.list(zendeskCallback); -client.requests.list().then(zendeskCallback); -client.requests.listOpen(zendeskCallback); -client.requests.listOpen().then(zendeskCallback); -client.requests.listSolved(zendeskCallback); -client.requests.listSolved().then(zendeskCallback); -client.requests.listCCD(123, zendeskCallback); -client.requests.listCCD(123).then(zendeskCallback); -client.requests.listByUser(123, zendeskCallback); -client.requests.listByUser(123).then(zendeskCallback); -client.requests.listByOrganization(123, zendeskCallback); -client.requests.listByOrganization(123).then(zendeskCallback); -client.requests.getRequest(123, zendeskCallback); -client.requests.getRequest(123).then(zendeskCallback); -client.requests.create({ request: { subject: "foo", comment: {} } }, zendeskCallback); -client.requests.create({ request: { subject: "foo", comment: {} } }).then(zendeskCallback); -client.requests.update(123, { request: {} }, zendeskCallback); -client.requests.update(123, { request: {} }).then(zendeskCallback); -client.requests.listComments(123, zendeskCallback); -client.requests.listComments(123).then(zendeskCallback); -client.requests.getComment(123, 123, zendeskCallback); -client.requests.getComment(123, 123).then(zendeskCallback); - -/** Attachments Methods */ -client.attachments.upload( - path.resolve("./examples/busey.gif"), - { - filename: "busey.gif", - }, - (err, req, result) => { - if (err) { - console.log(err); - return; - } - console.log(JSON.stringify(result, null, 2)); - }, -); - -const { r2: { upload: { token } } } = await (async () => { - const r1: Attachments.ShowResponseModel = await client.attachments.show(1); - const r2: Attachments.UploadResponseModel = await client.attachments.upload("/path/to/file", { - filename: "filename", - }); - const r3: Attachments.UploadResponseModel = await client.attachments.upload(Buffer.alloc(8), { - filename: "filename", - }); - const r4: Attachments.UploadResponseModel = await client.attachments.upload(Buffer.from("Test"), { - filename: "filename", - binary: true, - }); - - return { r1, r2, r3, r4 }; -})(); - -/** Tickets Methods */ -client.tickets.list(zendeskCallback); -client.tickets.list().then(zendeskCallback); -client.tickets.listByOrganization(123, zendeskCallback); -client.tickets.listByOrganization(123).then(zendeskCallback); -client.tickets.listByUserRequested(123, zendeskCallback); -client.tickets.listByUserRequested(123).then(zendeskCallback); -client.tickets.listByUserCCD(123, zendeskCallback); -client.tickets.listByUserCCD(123).then(zendeskCallback); -client.tickets.listAssigned(123, zendeskCallback); -client.tickets.listAssigned(123).then(zendeskCallback); -client.tickets.listWithFilter("foo", "bar", zendeskCallback); -client.tickets.listWithFilter("foo", "bar").then(zendeskCallback); -client.tickets.listRecent(zendeskCallback); -client.tickets.listRecent().then(zendeskCallback); -client.tickets.listCollaborators(123, zendeskCallback); -client.tickets.listCollaborators(123).then(zendeskCallback); -client.tickets.listIncidents(123, zendeskCallback); -client.tickets.listIncidents(123).then(zendeskCallback); -client.tickets.listMetrics(123, zendeskCallback); -client.tickets.listMetrics(123).then(zendeskCallback); -client.tickets.show(123, zendeskCallback); -client.tickets.show(123).then(zendeskCallback); -client.tickets.showMany([123, 234], zendeskCallback); -client.tickets.showMany([123, 234]).then(zendeskCallback); -client.tickets.create({ - ticket: { - comment: { - uploads: [token], - }, - }, -}, zendeskCallback); -client.tickets.create({ ticket: { comment: {} } }).then(zendeskCallback); -client.tickets.create({ ticket: { comment: {}, requester: { name: "" } } }).then(zendeskCallback); -client.tickets.createMany({ tickets: [{ comment: {} }] }, zendeskCallback); -client.tickets.createMany({ tickets: [{ comment: {} }] }).then(zendeskCallback); -client.tickets.update(123, { ticket: {} }, zendeskCallback); -client.tickets.update(123, { ticket: {} }).then(zendeskCallback); -client.tickets.updateMany({ tickets: [{}] }, zendeskCallback); -client.tickets.updateMany({ tickets: [{}] }).then(zendeskCallback); -client.tickets.delete(123, zendeskCallback); -client.tickets.delete(123).then(zendeskCallback); -client.tickets.deleteMany([123, 234], zendeskCallback); -client.tickets.deleteMany([123, 234]).then(zendeskCallback); -client.tickets.merge(123, { ids: [234, 345] }, zendeskCallback); -client.tickets.merge(123, { ids: [234, 345] }).then(zendeskCallback); -client.tickets.export(1332034771, zendeskCallback); -client.tickets.export(1332034771).then(zendeskCallback); -client.tickets.exportSample(1332034771, {}); -client.tickets.incremental(1332034771, zendeskCallback); -client.tickets.incremental(1332034771).then(zendeskCallback); -client.tickets.incrementalInclude(1332034771, {}, zendeskCallback); -client.tickets.incrementalInclude(1332034771, {}).then(zendeskCallback); -client.tickets.incrementalSample(1332034771, zendeskCallback); -client.tickets.incrementalSample(1332034771).then(zendeskCallback); -client.tickets.getComments(123, zendeskCallback); -client.tickets.getComments(123).then(zendeskCallback); -client.tickets.exportAudit(123, zendeskCallback); -client.tickets.exportAudit(123).then(zendeskCallback); -client.tickets.addTags(123, ["foo", "bar"], zendeskCallback); -client.tickets.addTags(123, ["foo", "bar"]).then(zendeskCallback); - -/** Ticket Fields */ -client.ticketfields.create( - { - type: "subject", - title: "Subject", - description: "This is the agent only description for the subject field", - position: 0, - active: true, - key: "subject", - }, - zendeskCallback, -); - -/** Groups Methods */ -client.groups.list(zendeskCallback); -client.groups.list().then(zendeskCallback); -client.groups.assignable(zendeskCallback); -client.groups.assignable().then(zendeskCallback); -client.groups.show(123, zendeskCallback); -client.groups.show(123).then(zendeskCallback); -client.groups.create({ group: { name: "foo", default: false, description: "bar" } }, zendeskCallback); -client.groups.create({ group: { name: "foo", default: false, description: "bar" } }).then(zendeskCallback); -client.groups.update(123, { group: { name: "foo" } }, zendeskCallback); -client.groups.update(123, { group: { name: "foo" } }).then(zendeskCallback); -client.groups.delete(123, zendeskCallback); -client.groups.delete(123).then(zendeskCallback); - -/** Users Methods */ -client.users.auth(zendeskCallback); -client.users.auth().then(zendeskCallback); -client.users.list(zendeskCallback); -client.users.list().then(zendeskCallback); -client.users.listByGroup(123, zendeskCallback); -client.users.listByGroup(123).then(zendeskCallback); -client.users.listByOrganization(123, zendeskCallback); -client.users.listByOrganization(123).then(zendeskCallback); -client.users.show(123, zendeskCallback); -client.users.show(123).then(zendeskCallback); -client.users.showMany([123, 234], zendeskCallback); -client.users.showMany([123, 234]).then(zendeskCallback); -client.users.create({ user: { name: "foo" } }, zendeskCallback); -client.users.create({ user: { name: "foo" } }).then(zendeskCallback); -client.users.createMany({ users: [{ name: "foo" }] }, zendeskCallback); -client.users.createMany({ users: [{ name: "foo" }] }).then(zendeskCallback); -client.users.createOrUpdate({ user: { name: "foo" } }, zendeskCallback); -client.users.createOrUpdate({ user: { name: "foo" } }).then(zendeskCallback); -client.users.createOrUpdateMany({ users: [{ name: "foo" }] }, zendeskCallback); -client.users.createOrUpdateMany({ users: [{ name: "foo" }] }).then(zendeskCallback); -client.users.update(123, { user: {} }, zendeskCallback); -client.users.update(123, { user: {} }).then(zendeskCallback); -client.users.updateMany([123, 234], { users: [{}, {}] }, zendeskCallback); -client.users.updateMany([123, 234], { users: [{}, {}] }).then(zendeskCallback); -client.users.suspend(123, zendeskCallback); -client.users.suspend(123).then(zendeskCallback); -client.users.unsuspend(123, zendeskCallback); -client.users.unsuspend(123).then(zendeskCallback); -client.users.delete(123, zendeskCallback); -client.users.delete(123).then(zendeskCallback); -client.users.search({}, zendeskCallback); -client.users.search({}).then(zendeskCallback); -client.users.me(zendeskCallback); -client.users.me().then(zendeskCallback); -client.users.merge(123, 234, zendeskCallback); -client.users.merge(123, 234).then(zendeskCallback); -client.users.password(123, "foo", "bar", zendeskCallback); -client.users.password(123, "foo", "bar").then(zendeskCallback); -client.users.incrementalInclude(1332034771, {}, zendeskCallback); -client.users.incrementalInclude(1332034771, {}).then(zendeskCallback); -client.users.incremental(1332034771, zendeskCallback); -client.users.incremental(1332034771).then(zendeskCallback); -client.users.incrementalSample(1332034771, zendeskCallback); -client.users.incrementalSample(1332034771).then(zendeskCallback); - -/** User Identities Methods */ -client.useridentities.list(123, zendeskCallback); -client.useridentities.list(123).then(zendeskCallback); -client.useridentities.show(123, 234, zendeskCallback); -client.useridentities.show(123, 234).then(zendeskCallback); -client.useridentities.create(123, { identity: { type: "email", value: "foo@example.com" } }, zendeskCallback); -client.useridentities.create(123, { identity: { type: "email", value: "foo@example.com" } }).then(zendeskCallback); -client.useridentities.update(123, 234, { identity: {} }, zendeskCallback); -client.useridentities.update(123, 234, { identity: {} }).then(zendeskCallback); -client.useridentities.makePrimary(123, 234, zendeskCallback); -client.useridentities.makePrimary(123, 234).then(zendeskCallback); -client.useridentities.verify(123, 234, zendeskCallback); -client.useridentities.verify(123, 234).then(zendeskCallback); -client.useridentities.requestVerification(123, 234, zendeskCallback); -client.useridentities.requestVerification(123, 234).then(zendeskCallback); -client.useridentities.delete(123, 234, zendeskCallback); -client.useridentities.delete(123, 234).then(zendeskCallback); - -/** User Fields */ -client.userfields.create( - { - title: "Support description (type text is default)", - description: "This field describes the support plan this user has", - position: 0, - active: true, - key: "support_description", - }, - zendeskCallback, -); -client.userfields.create( - { - type: "textarea", - title: "Support description", - description: "This field describes the support plan this user has", - position: 0, - active: true, - key: "support_description", - }, - zendeskCallback, -); -client.userfields.create( - { - type: "tagger", - title: "Support description", - description: "This field describes the support plan this user has", - position: 0, - active: true, - key: "support_description", - custom_field_options: [ - { - id: 1, - name: "Custom Fielld Option", - value: 5, - }, - ], - }, - zendeskCallback, -); diff --git a/types/node-zendesk/package.json b/types/node-zendesk/package.json deleted file mode 100644 index cf40ddd5ac4b34..00000000000000 --- a/types/node-zendesk/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "name": "@types/node-zendesk", - "version": "2.0.9999", - "projects": [ - "https://github.com/blakmatrix/node-zendesk" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/node-zendesk": "workspace:." - }, - "owners": [ - { - "name": "jgeth", - "githubUsername": "jgeth" - }, - { - "name": "dannyhostetler", - "githubUsername": "dannyhostetler" - } - ] -} diff --git a/types/node/async_hooks.d.ts b/types/node/async_hooks.d.ts index cffce43d9ea8f1..91f6763be29abb 100644 --- a/types/node/async_hooks.d.ts +++ b/types/node/async_hooks.d.ts @@ -533,6 +533,70 @@ declare module "async_hooks" { */ enterWith(store: T): void; } + /** + * @since v17.2.0, v16.14.0 + * @return A map of provider types to the corresponding numeric id. + * This map contains all the event types that might be emitted by the `async_hooks.init()` event. + */ + namespace asyncWrapProviders { + const NONE: number; + const DIRHANDLE: number; + const DNSCHANNEL: number; + const ELDHISTOGRAM: number; + const FILEHANDLE: number; + const FILEHANDLECLOSEREQ: number; + const FIXEDSIZEBLOBCOPY: number; + const FSEVENTWRAP: number; + const FSREQCALLBACK: number; + const FSREQPROMISE: number; + const GETADDRINFOREQWRAP: number; + const GETNAMEINFOREQWRAP: number; + const HEAPSNAPSHOT: number; + const HTTP2SESSION: number; + const HTTP2STREAM: number; + const HTTP2PING: number; + const HTTP2SETTINGS: number; + const HTTPINCOMINGMESSAGE: number; + const HTTPCLIENTREQUEST: number; + const JSSTREAM: number; + const JSUDPWRAP: number; + const MESSAGEPORT: number; + const PIPECONNECTWRAP: number; + const PIPESERVERWRAP: number; + const PIPEWRAP: number; + const PROCESSWRAP: number; + const PROMISE: number; + const QUERYWRAP: number; + const SHUTDOWNWRAP: number; + const SIGNALWRAP: number; + const STATWATCHER: number; + const STREAMPIPE: number; + const TCPCONNECTWRAP: number; + const TCPSERVERWRAP: number; + const TCPWRAP: number; + const TTYWRAP: number; + const UDPSENDWRAP: number; + const UDPWRAP: number; + const SIGINTWATCHDOG: number; + const WORKER: number; + const WORKERHEAPSNAPSHOT: number; + const WRITEWRAP: number; + const ZLIB: number; + const CHECKPRIMEREQUEST: number; + const PBKDF2REQUEST: number; + const KEYPAIRGENREQUEST: number; + const KEYGENREQUEST: number; + const KEYEXPORTREQUEST: number; + const CIPHERREQUEST: number; + const DERIVEBITSREQUEST: number; + const HASHREQUEST: number; + const RANDOMBYTESREQUEST: number; + const RANDOMPRIMEREQUEST: number; + const SCRYPTREQUEST: number; + const SIGNREQUEST: number; + const TLSWRAP: number; + const VERIFYREQUEST: number; + } } declare module "node:async_hooks" { export * from "async_hooks"; diff --git a/types/node/buffer.buffer.d.ts b/types/node/buffer.buffer.d.ts index acb8342ff27462..b22f83a291507d 100644 --- a/types/node/buffer.buffer.d.ts +++ b/types/node/buffer.buffer.d.ts @@ -451,6 +451,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/buffer.d.ts b/types/node/buffer.d.ts index c5d2fcecb37f2a..68fc249d07ac4e 100644 --- a/types/node/buffer.d.ts +++ b/types/node/buffer.d.ts @@ -69,7 +69,7 @@ declare module "buffer" { * @param input The input to validate. */ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - export const INSPECT_MAX_BYTES: number; + export let INSPECT_MAX_BYTES: number; export const kMaxLength: number; export const kStringMaxLength: number; export const constants: { @@ -122,7 +122,7 @@ declare module "buffer" { * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. */ export function resolveObjectURL(id: string): Blob | undefined; - export { Buffer }; + export { type AllowSharedBuffer, Buffer, type NonSharedBuffer }; /** * @experimental */ diff --git a/types/node/fs.d.ts b/types/node/fs.d.ts index 7f0bf4b48a219f..fcd095dc494406 100644 --- a/types/node/fs.d.ts +++ b/types/node/fs.d.ts @@ -2684,7 +2684,7 @@ declare module "fs" { } & Abortable) | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2719,7 +2719,7 @@ declare module "fs" { | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2728,7 +2728,7 @@ declare module "fs" { */ export function readFile( path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; export namespace readFile { /** @@ -2744,7 +2744,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Promise; + ): Promise; /** * Asynchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2778,7 +2778,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): Promise; + ): Promise; } /** * Returns the contents of the `path`. @@ -2810,7 +2810,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Buffer; + ): NonSharedBuffer; /** * Synchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2842,7 +2842,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): string | Buffer; + ): string | NonSharedBuffer; export type WriteFileOptions = | ( & ObjectEncodingOptions diff --git a/types/node/fs/promises.d.ts b/types/node/fs/promises.d.ts index 870eac0c3500c9..f0e1a517fa2436 100644 --- a/types/node/fs/promises.d.ts +++ b/types/node/fs/promises.d.ts @@ -277,36 +277,26 @@ declare module "fs/promises" { * data will be a string. */ readFile( - options?: { - encoding?: null | undefined; - flag?: OpenMode | undefined; - } | null, + options?: + | ({ encoding?: null | undefined } & Abortable) + | null, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options: - | { - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } + | ({ encoding: BufferEncoding } & Abortable) | BufferEncoding, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options?: - | (ObjectEncodingOptions & { - flag?: OpenMode | undefined; - }) + | (ObjectEncodingOptions & Abortable) | BufferEncoding | null, ): Promise; diff --git a/types/node/globals.d.ts b/types/node/globals.d.ts index 9d8b1edf268145..4085e0fa6eeb47 100644 --- a/types/node/globals.d.ts +++ b/types/node/globals.d.ts @@ -18,43 +18,11 @@ type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import(" // Conditional type definitions for webstorage interface, which conflicts with lib.dom otherwise. type _Storage = typeof globalThis extends { onabort: any } ? {} : { - /** - * Returns the number of key/value pairs. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length) - */ readonly length: number; - /** - * Removes all key/value pairs, if there are any. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear) - */ clear(): void; - /** - * Returns the current value associated with the given key, or null if the given key does not exist. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem) - */ getItem(key: string): string | null; - /** - * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key) - */ key(index: number): string | null; - /** - * Removes the key/value pair with the given key, if a key/value pair with the given key exists. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem) - */ removeItem(key: string): void; - /** - * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously. - * - * Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem) - */ setItem(key: string, value: string): void; [key: string]: any; }; @@ -62,15 +30,8 @@ type _Storage = typeof globalThis extends { onabort: any } ? {} : { // #region DOMException type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException; interface NodeDOMException extends Error { - /** - * @deprecated - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) - */ readonly code: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ readonly message: string; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ readonly name: string; readonly INDEX_SIZE_ERR: 1; readonly DOMSTRING_SIZE_ERR: 2; @@ -130,263 +91,104 @@ interface NodeDOMExceptionConstructor { // #endregion DOMException declare global { - // Declare "static" methods in Error - interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - - stackTraceLimit: number; - } - - /*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - var global: typeof globalThis; var process: NodeJS.Process; var console: Console; - interface GCFunction { - (options: { - execution?: "sync"; - flavor?: "regular" | "last-resort"; - type?: "major-snapshot" | "major" | "minor"; - filename?: string; - }): void; - (options: { - execution: "async"; - flavor?: "regular" | "last-resort"; - type?: "major-snapshot" | "major" | "minor"; - filename?: string; - }): Promise; - (options?: boolean): void; - } - - /** - * Only available if `--expose-gc` is passed to the process. - */ - var gc: undefined | GCFunction; - - // #region borrowed - // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib - /** A controller object that allows you to abort one or more DOM requests as and when desired. */ - interface AbortController { + interface ErrorConstructor { /** - * Returns the AbortSignal object associated with this object. + * Creates a `.stack` property on `targetObject`, which when accessed returns + * a string representing the location in the code at which + * `Error.captureStackTrace()` was called. + * + * ```js + * const myObject = {}; + * Error.captureStackTrace(myObject); + * myObject.stack; // Similar to `new Error().stack` + * ``` + * + * The first line of the trace will be prefixed with + * `${myObject.name}: ${myObject.message}`. + * + * The optional `constructorOpt` argument accepts a function. If given, all frames + * above `constructorOpt`, including `constructorOpt`, will be omitted from the + * generated stack trace. + * + * The `constructorOpt` argument is useful for hiding implementation + * details of error generation from the user. For instance: + * + * ```js + * function a() { + * b(); + * } + * + * function b() { + * c(); + * } + * + * function c() { + * // Create an error without stack trace to avoid calculating the stack trace twice. + * const { stackTraceLimit } = Error; + * Error.stackTraceLimit = 0; + * const error = new Error(); + * Error.stackTraceLimit = stackTraceLimit; + * + * // Capture the stack trace above function b + * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + * throw error; + * } + * + * a(); + * ``` */ - - readonly signal: AbortSignal; + captureStackTrace(targetObject: object, constructorOpt?: Function): void; /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces */ - abort(reason?: any): void; - } - - /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ - interface AbortSignal extends EventTarget { + prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + * The `Error.stackTraceLimit` property specifies the number of stack frames + * collected by a stack trace (whether generated by `new Error().stack` or + * `Error.captureStackTrace(obj)`). + * + * The default value is `10` but may be set to any valid JavaScript number. Changes + * will affect any stack trace captured _after_ the value has been changed. + * + * If set to a non-number value, or set to a negative number, stack traces will + * not capture any frames. */ - readonly aborted: boolean; - readonly reason: any; - onabort: null | ((this: AbortSignal, event: Event) => any); - throwIfAborted(): void; + stackTraceLimit: number; } - var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T - : { - prototype: AbortController; - new(): AbortController; - }; - - var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T - : { - prototype: AbortSignal; - new(): AbortSignal; - abort(reason?: any): AbortSignal; - timeout(milliseconds: number): AbortSignal; - any(signals: AbortSignal[]): AbortSignal; - }; - // #endregion borrowed - - // #region Storage - /** - * This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage) - */ - interface Storage extends _Storage {} - - // Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker - var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T - : { - prototype: Storage; - new(): Storage; - }; - - /** - * A browser-compatible implementation of [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). Data is stored - * unencrypted in the file specified by the `--localstorage-file` CLI flag. - * The maximum amount of data that can be stored is 10 MB. - * Any modification of this data outside of the Web Storage API is not supported. - * Enable this API with the `--experimental-webstorage` CLI flag. - * `localStorage` data is not stored per user or per request when used in the context - * of a server, it is shared across all users and requests. - * @since v22.4.0 - */ - var localStorage: Storage; - - /** - * A browser-compatible implementation of [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). Data is stored in - * memory, with a storage quota of 10 MB. `sessionStorage` data persists only within - * the currently running process, and is not shared between workers. - * @since v22.4.0 - */ - var sessionStorage: Storage; - // #endregion Storage - - /** - * @since v17.0.0 - * - * Creates a deep clone of an object. - */ - function structuredClone( - value: T, - transfer?: { transfer: ReadonlyArray }, - ): T; - - // #region DOMException - /** - * @since v17.0.0 - * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) - */ - interface DOMException extends _DOMException {} - /** - * @since v17.0.0 - * - * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details. + * Enable this API with the `--expose-gc` CLI flag. */ - var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T - : NodeDOMExceptionConstructor; - // #endregion DOMException + var gc: NodeJS.GCFunction | undefined; - /*----------------------------------------------* - * * - * GLOBAL INTERFACES * - * * - *-----------------------------------------------*/ namespace NodeJS { interface CallSite { - /** - * Value of "this" - */ - getThis(): unknown; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ + getColumnNumber(): number | null; + getEnclosingColumnNumber(): number | null; + getEnclosingLineNumber(): number | null; + getEvalOrigin(): string | undefined; + getFileName(): string | null; getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | undefined; - - /** - * Current line number [if this function was defined in a script] - */ getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ + getMethodName(): string | null; + getPosition(): number; + getPromiseIndex(): number | null; + getScriptHash(): string; + getScriptNameOrSourceURL(): string | null; + getThis(): unknown; + getTypeName(): string | null; + isAsync(): boolean; + isConstructor(): boolean; isEval(): boolean; - - /** - * Is this call in native V8 code? - */ isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - - /** - * is this an async call (i.e. await, Promise.all(), or Promise.any())? - */ - isAsync(): boolean; - - /** - * is this an async call to Promise.all()? - */ isPromiseAll(): boolean; - - /** - * returns the index of the promise element that was followed in - * Promise.all() or Promise.any() for async stack traces, or null - * if the CallSite is not an async - */ - getPromiseIndex(): number | null; - - getScriptNameOrSourceURL(): string; - getScriptHash(): string; - - getEnclosingColumnNumber(): number; - getEnclosingLineNumber(): number; - getPosition(): number; - - toString(): string; + isToplevel(): boolean; } interface ErrnoException extends Error { @@ -434,6 +236,19 @@ declare global { readonly [key: string]: T | undefined; } + interface GCFunction { + (minor?: boolean): void; + (options: NodeJS.GCOptions & { execution: "async" }): Promise; + (options: NodeJS.GCOptions): void; + } + + interface GCOptions { + execution?: "sync" | "async" | undefined; + flavor?: "regular" | "last-resort" | undefined; + type?: "major-snapshot" | "major" | "minor" | undefined; + filename?: string | undefined; + } + /** An iterable iterator returned by the Node.js API. */ // Default TReturn/TNext in v22 is `any`, for compatibility with the previously-used IterableIterator. // TODO: In next major @types/node version, change default TReturn to undefined. @@ -449,6 +264,58 @@ declare global { } } + // Global DOM types + + function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, + ): T; + + interface DOMException extends _DOMException {} + var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T + : NodeDOMExceptionConstructor; + + // #region AbortController + interface AbortController { + readonly signal: AbortSignal; + abort(reason?: any): void; + } + var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T + : { + prototype: AbortController; + new(): AbortController; + }; + + interface AbortSignal extends EventTarget { + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + readonly reason: any; + throwIfAborted(): void; + } + var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + any(signals: AbortSignal[]): AbortSignal; + timeout(milliseconds: number): AbortSignal; + }; + // #endregion AbortController + + // #region Storage + interface Storage extends _Storage {} + // Conditional on `onabort` rather than `onmessage`, in order to exclude lib.webworker + var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T + : { + prototype: Storage; + new(): Storage; + }; + + var localStorage: Storage; + var sessionStorage: Storage; + // #endregion Storage + + // #region fetch interface RequestInit extends _RequestInit {} function fetch( @@ -487,9 +354,6 @@ declare global { : typeof import("undici-types").Headers; interface MessageEvent extends _MessageEvent {} - /** - * @since v15.0.0 - */ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T; @@ -501,11 +365,7 @@ declare global { : typeof import("undici-types").WebSocket; interface EventSource extends _EventSource {} - /** - * Only available through the [--experimental-eventsource](https://nodejs.org/api/cli.html#--experimental-eventsource) flag. - * - * @since v22.3.0 - */ var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof import("undici-types").EventSource; + // #endregion fetch } diff --git a/types/node/http.d.ts b/types/node/http.d.ts index c3c2b28e2c3abd..cbfb2dfe62fa64 100644 --- a/types/node/http.d.ts +++ b/types/node/http.d.ts @@ -269,6 +269,13 @@ declare module "http" { * @default 30000 */ connectionsCheckingInterval?: number | undefined; + /** + * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. + * See {@link Server.headersTimeout} for more information. + * @default 60000 + * @since 18.0.0 + */ + headersTimeout?: number | undefined; /** * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. @@ -296,6 +303,13 @@ declare module "http" { * @since v16.5.0 */ noDelay?: boolean | undefined; + /** + * If set to `true`, it forces the server to respond with a 400 (Bad Request) status code + * to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification). + * @default true + * @since 20.0.0 + */ + requireHostHeader?: boolean | undefined; /** * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. @@ -314,6 +328,12 @@ declare module "http" { * If the header's value is an array, the items will be joined using `; `. */ uniqueHeaders?: Array | undefined; + /** + * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. + * @default false + * @since v18.17.0, v20.2.0 + */ + rejectNonStandardBodyWrites?: boolean | undefined; } type RequestListener< Request extends typeof IncomingMessage = typeof IncomingMessage, diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aa902e1ffb9642..0d58fb3f6c7b3d 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -44,181 +44,3 @@ import "./test/vm"; import "./test/wasi"; import "./test/worker_threads"; import "./test/zlib"; - -import * as http from "node:http"; -import * as http2 from "node:http2"; -import * as https from "node:https"; -import * as inspector from "node:inspector"; -import * as net from "node:net"; -import * as stream from "node:stream"; -import * as trace_events from "node:trace_events"; -import * as url from "node:url"; - -////////////////////////////////////////////////////// -/// Https tests : https://nodejs.org/api/https.html /// -////////////////////////////////////////////////////// - -{ - let agent: https.Agent = new https.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256, - maxCachedSessions: 100, - timeout: 15000, - family: 4, - }); - - agent = https.globalAgent; - - let sockets: NodeJS.ReadOnlyDict = agent.sockets; - sockets = agent.freeSockets; - - https.request({ - agent: false, - }); - https.request({ - agent, - }); - https.request({ - agent: undefined, - }); - - https.get("http://www.example.com/xyz"); - https.request("http://www.example.com/xyz"); - - https.get("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - https.request("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - - https.get(new url.URL("http://www.example.com/xyz")); - https.request(new url.URL("http://www.example.com/xyz")); - - https.get(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - - const opts: https.RequestOptions = { - path: "/some/path", - }; - https.get(new url.URL("http://www.example.com"), opts); - https.request(new url.URL("http://www.example.com"), opts); - https.get(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - - https.globalAgent.options.ca = []; - - { - function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {} - - class MyIncomingMessage extends http.IncomingMessage { - foo: number; - } - - class MyServerResponse - extends http.ServerResponse - { - foo: string; - } - - let server: https.Server; - - server = new https.Server(); - server = new https.Server(reqListener); - server = new https.Server({ IncomingMessage: MyIncomingMessage }); - - server = new https.Server({ - IncomingMessage: MyIncomingMessage, - ServerResponse: MyServerResponse, - }, reqListener); - - server = https.createServer(); - server = https.createServer(reqListener); - server = https.createServer({ IncomingMessage: MyIncomingMessage }); - server = https.createServer({ ServerResponse: MyServerResponse }, reqListener); - - const timeout: number = server.timeout; - const listening: boolean = server.listening; - const keepAliveTimeout: number = server.keepAliveTimeout; - const maxHeadersCount: number | null = server.maxHeadersCount; - const headersTimeout: number = server.headersTimeout; - server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {}); - } -} - -///////////////////////////////////////////////////////// -/// Errors Tests : https://nodejs.org/api/errors.html /// -///////////////////////////////////////////////////////// - -{ - { - Error.stackTraceLimit = Infinity; - } - { - const myObject = {}; - Error.captureStackTrace(myObject); - } - { - const frames: NodeJS.CallSite[] = []; - Error.prepareStackTrace!(new Error(), frames); - } - { - const frame: NodeJS.CallSite = null!; - const frameThis: unknown = frame.getThis(); - const typeName: string | null = frame.getTypeName(); - const func: Function | undefined = frame.getFunction(); - const funcName: string | null = frame.getFunctionName(); - const meth: string | null = frame.getMethodName(); - const fname: string | undefined = frame.getFileName(); - const lineno: number | null = frame.getLineNumber(); - const colno: number | null = frame.getColumnNumber(); - const evalOrigin: string | undefined = frame.getEvalOrigin(); - const isTop: boolean = frame.isToplevel(); - const isEval: boolean = frame.isEval(); - const isNative: boolean = frame.isNative(); - const isConstr: boolean = frame.isConstructor(); - } -} - -/***************************************************************************** - * * - * The following tests are the modules not mentioned in document but existed * - * * - *****************************************************************************/ - -/////////////////////////////////////////////////////////// -/// Trace Events Tests /// -/////////////////////////////////////////////////////////// - -{ - const enabledCategories: string | undefined = trace_events.getEnabledCategories(); - const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ["node", "v8"] }); - const categories: string = tracing.categories; - const enabled: boolean = tracing.enabled; - tracing.enable(); - tracing.disable(); -} - -//////////////////////////////////////////////////// -/// Node.js ESNEXT Support -//////////////////////////////////////////////////// - -{ - const s = "foo"; - const s1: string = s.trimLeft(); - const s2: string = s.trimRight(); - const s3: string = s.trimStart(); - const s4: string = s.trimEnd(); -} - -//////////////////////////////////////////////////// -/// Node.js http2 tests -//////////////////////////////////////////////////// - -{ - http2.connect("https://foo.com", { - createConnection: (authority, option) => { - authority; // $ExpectType URL - option; // $ExpectType SessionOptions - return new stream.Duplex(); - }, - }); -} diff --git a/types/node/querystring.d.ts b/types/node/querystring.d.ts index 4d6dac18d6d775..f0d525701ccbc0 100644 --- a/types/node/querystring.d.ts +++ b/types/node/querystring.d.ts @@ -37,9 +37,8 @@ declare module "querystring" { | string | number | boolean - | readonly string[] - | readonly number[] - | readonly boolean[] + | bigint + | ReadonlyArray | null > {} diff --git a/types/node/stream/web.d.ts b/types/node/stream/web.d.ts index 8f88f9773b6531..2f444da66cfeca 100644 --- a/types/node/stream/web.d.ts +++ b/types/node/stream/web.d.ts @@ -97,7 +97,7 @@ declare module "stream/web" { signal?: AbortSignal; } interface ReadableStreamGenericReader { - readonly closed: Promise; + readonly closed: Promise; cancel(reason?: any): Promise; } type ReadableStreamController = ReadableStreamDefaultController; @@ -307,9 +307,9 @@ declare module "stream/web" { * sink. */ interface WritableStreamDefaultWriter { - readonly closed: Promise; + readonly closed: Promise; readonly desiredSize: number | null; - readonly ready: Promise; + readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; diff --git a/types/node/test/async_hooks.ts b/types/node/test/async_hooks.ts index 2165adc0db930c..e651e98c377e16 100644 --- a/types/node/test/async_hooks.ts +++ b/types/node/test/async_hooks.ts @@ -1,6 +1,7 @@ import { AsyncLocalStorage, AsyncResource, + asyncWrapProviders, createHook, executionAsyncId, executionAsyncResource, @@ -98,3 +99,20 @@ import { return runInAsyncScope(() => asyncLocalStorage.getStore()); }); } + +{ + // $ExpectType number + asyncWrapProviders.NONE; + // $ExpectType number + asyncWrapProviders.DIRHANDLE; + + // $ExpectType number + asyncWrapProviders.TLSWRAP; + // $ExpectType number + asyncWrapProviders.VERIFYREQUEST; + + // @ts-expect-error - Cannot assign to asyncWrapProviders.NONE + asyncWrapProviders.NONE = 1; + // @ts-expect-error - Cannot assign to asyncWrapProviders['...'] + asyncWrapProviders.foo = 1; +} diff --git a/types/node/test/buffer.ts b/types/node/test/buffer.ts index 41c372e038a8d9..95e6e1146a4ecf 100644 --- a/types/node/test/buffer.ts +++ b/types/node/test/buffer.ts @@ -1,3 +1,5 @@ +import bufferModule = require("node:buffer"); + // Specifically test buffer module regression. import { Blob as NodeBlob, @@ -43,6 +45,18 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ const value4: number = kStringMaxLength; } +// Module variables +{ + // $ExpectType number + bufferModule.INSPECT_MAX_BYTES; + bufferModule.INSPECT_MAX_BYTES = 0; + + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES; + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES = 2; +} + // Module methods { const bool1: boolean = isUtf8(new Buffer("hello")); diff --git a/types/node/test/fs.ts b/types/node/test/fs.ts index 0b6cb15ce584e4..e5372417d3cfd8 100644 --- a/types/node/test/fs.ts +++ b/types/node/test/fs.ts @@ -1094,4 +1094,8 @@ const anyStatFs: fs.StatsFs | fs.BigIntStatsFs = fs.statfsSync(".", { bigint: Ma fd.appendFile("test", { signal: new AbortSignal(), encoding: "utf-8" }); // @ts-expect-error fd.appendFile("test", { mode: 0o777, flush: true, flag: "a" }); + + fd.readFile({ signal: new AbortSignal(), encoding: "utf-8" }); + // @ts-expect-error + fd.readFile({ encoding: "utf-8", flag: "r" }); }); diff --git a/types/node/test/globals.ts b/types/node/test/globals.ts index 5ad9ddc9d9e55e..76edac50a56064 100644 --- a/types/node/test/globals.ts +++ b/types/node/test/globals.ts @@ -1,23 +1,62 @@ -////////////////////////////////////////////////////////////////////////// -/// `globalThis` Tests: https://node.green/#ES2020-features-globalThis /// -////////////////////////////////////////////////////////////////////////// - +// global / globalThis { const isGlobalThis: typeof globalThis = global; - - const accessibleToGlobalThisMembers: true = global.RANDOM_GLOBAL_VARIABLE; + const accessibleAsGlobalProperty: true = global.RANDOM_GLOBAL_VARIABLE; } declare var RANDOM_GLOBAL_VARIABLE: true; -// exposed gc +// ErrorConstructor +{ + { + Error.stackTraceLimit = Infinity; + } + { + const myObject = {}; + Error.captureStackTrace(myObject); + } + { + const original = Error.prepareStackTrace; + Error.prepareStackTrace = (error, frames) => { + error; // $ExpectType Error + + const [frame] = frames; + frame.getColumnNumber(); // $ExpectType number | null + frame.getEnclosingColumnNumber(); // $ExpectType number | null + frame.getEnclosingLineNumber(); // $ExpectType number | null + frame.getEvalOrigin(); // $ExpectType string | undefined + frame.getFileName(); // $ExpectType string | null + frame.getFunction(); // $ExpectType Function | undefined + frame.getFunctionName(); // $ExpectType string | null + frame.getLineNumber(); // $ExpectType number | null + frame.getMethodName(); // $ExpectType string | null + frame.getPosition(); // $ExpectType number + frame.getPromiseIndex(); // $ExpectType number | null + frame.getScriptHash(); // $ExpectType string + frame.getScriptNameOrSourceURL(); // $ExpectType string | null + frame.getThis(); // $ExpectType unknown + frame.getTypeName(); // $ExpectType string | null + frame.isAsync(); // $ExpectType boolean + frame.isConstructor(); // $ExpectType boolean + frame.isEval(); // $ExpectType boolean + frame.isNative(); // $ExpectType boolean + frame.isPromiseAll(); // $ExpectType boolean + frame.isToplevel(); // $ExpectType boolean + + return original(error, frames); + }; + } +} + +// gc() { - if (gc) { - gc(); - gc(true); + if (typeof gc === "function") { + gc(); // $ExpectType void + gc(true); // $ExpectType void + gc({ flavor: "regular", type: "major-snapshot", filename: "/tmp/snapshot" }); // $ExpectType void gc({ execution: "sync" }); // $ExpectType void gc({ execution: "async" }); // $ExpectType Promise - gc({ execution: "async", flavor: "regular", type: "major" }); // $ExpectType Promise + gc({ execution: Math.random() > 0.5 ? "sync" : "async" }); // $ExpectType void } } diff --git a/types/node/test/http.ts b/types/node/test/http.ts index 873ee6d64f5f3a..e9522ba9b9f7bd 100644 --- a/types/node/test/http.ts +++ b/types/node/test/http.ts @@ -30,11 +30,15 @@ import * as url from "node:url"; server = http.createServer(reqListener); server = http.createServer({ IncomingMessage: MyIncomingMessage }); server = http.createServer({ ServerResponse: MyServerResponse }, reqListener); + // TODO: add test for all remaining options server = http.createServer({ insecureHTTPParser: true, keepAlive: true, keepAliveInitialDelay: 1000, keepAliveTimeout: 100, + headersTimeout: 50000, + requireHostHeader: false, + rejectNonStandardBodyWrites: false, }, reqListener); server.close(); diff --git a/types/node/test/querystring.ts b/types/node/test/querystring.ts index 977c3ec39e923d..ac6b22901bd34b 100644 --- a/types/node/test/querystring.ts +++ b/types/node/test/querystring.ts @@ -25,17 +25,14 @@ interface SampleObject { querystring.stringify({ foo: { bar: 1 } }); querystring.stringify({ - foo: "foo", - bar: 1, - baz: true, - foo2: ["a", "b"], - bar2: [1, 2], - baz2: [true, false], - rfoo2: ["a", "b"] as readonly string[], - rbar2: [1, 2] as readonly number[], - rbaz2: [true, false] as readonly boolean[], - a: undefined, - b: null, + str: "foo", + num: 1, + bool: true, + bigInt: 1n, + list: ["a", 1, true, 1n], + listReadonly: ["a", 1, true, 1n] as const, + undef: undefined, + nul: null, }); } diff --git a/types/node/test/stream.ts b/types/node/test/stream.ts index 4ba432cec98f2b..d2c591321c21b6 100644 --- a/types/node/test/stream.ts +++ b/types/node/test/stream.ts @@ -811,7 +811,7 @@ async function testTransferringStreamWithPostMessage() { // $ExpectType Promise byobReader.cancel("reason"); - // $ExpectType Promise + // $ExpectType Promise byobReader.closed; // $ExpectType Promise>> diff --git a/types/node/test/tls.ts b/types/node/test/tls.ts index 067544eca18b13..775881b23febd0 100644 --- a/types/node/test/tls.ts +++ b/types/node/test/tls.ts @@ -97,6 +97,14 @@ import { cert: fs.readFileSync("cert_filepath"), key: fs.readFileSync("key_filepath"), }); + + _server.addContext( + "example", + createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", + }), + ); } { diff --git a/types/node/test/util.ts b/types/node/test/util.ts index 75e8706fc8710a..e50052c1065f30 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -80,6 +80,12 @@ console.log( console.log( util.styleText(["red", "green"], "text"), ); +console.log( + util.styleText("blue", "text", { validateStream: false }), +); +console.log( + util.styleText("yellow", "text", { stream: process.stdout }), +); // util.callbackify class callbackifyTest { diff --git a/types/node/tls.d.ts b/types/node/tls.d.ts index 252412160bb41b..96540a34b57fb5 100644 --- a/types/node/tls.d.ts +++ b/types/node/tls.d.ts @@ -647,7 +647,7 @@ declare module "tls" { * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created * with {@link createSecureContext} itself. */ - addContext(hostname: string, context: SecureContextOptions): void; + addContext(hostname: string, context: SecureContextOptions | SecureContext): void; /** * Returns the session ticket keys. * diff --git a/types/node/ts5.6/buffer.buffer.d.ts b/types/node/ts5.6/buffer.buffer.d.ts index aea019fbf0fd1c..d19026dc2ff99c 100644 --- a/types/node/ts5.6/buffer.buffer.d.ts +++ b/types/node/ts5.6/buffer.buffer.d.ts @@ -448,6 +448,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/util.d.ts b/types/node/util.d.ts index 408c36a2bb37d6..2b252bfbdab57c 100644 --- a/types/node/util.d.ts +++ b/types/node/util.d.ts @@ -1466,6 +1466,18 @@ declare module "util" { | "reset" | "strikethrough" | "underline"; + export interface StyleTextOptions { + /** + * When true, `stream` is checked to see if it can handle colors. + * @default true + */ + validateStream?: boolean | undefined; + /** + * A stream that will be validated if it can be colored. + * @default process.stdout + */ + stream?: NodeJS.WritableStream | undefined; + } /** * This function returns a formatted text considering the `format` passed * for printing in a terminal. It is aware of the terminal's capabilities @@ -1518,6 +1530,7 @@ declare module "util" { | Modifiers | Array, text: string, + options?: StyleTextOptions, ): string; /** * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. diff --git a/types/node/v18/async_hooks.d.ts b/types/node/v18/async_hooks.d.ts index 1ae688538873eb..8396603bcc9755 100644 --- a/types/node/v18/async_hooks.d.ts +++ b/types/node/v18/async_hooks.d.ts @@ -516,6 +516,70 @@ declare module "async_hooks" { */ enterWith(store: T): void; } + /** + * @since v17.2.0, v16.14.0 + * @return A map of provider types to the corresponding numeric id. + * This map contains all the event types that might be emitted by the `async_hooks.init()` event. + */ + namespace asyncWrapProviders { + const NONE: number; + const DIRHANDLE: number; + const DNSCHANNEL: number; + const ELDHISTOGRAM: number; + const FILEHANDLE: number; + const FILEHANDLECLOSEREQ: number; + const FIXEDSIZEBLOBCOPY: number; + const FSEVENTWRAP: number; + const FSREQCALLBACK: number; + const FSREQPROMISE: number; + const GETADDRINFOREQWRAP: number; + const GETNAMEINFOREQWRAP: number; + const HEAPSNAPSHOT: number; + const HTTP2SESSION: number; + const HTTP2STREAM: number; + const HTTP2PING: number; + const HTTP2SETTINGS: number; + const HTTPINCOMINGMESSAGE: number; + const HTTPCLIENTREQUEST: number; + const JSSTREAM: number; + const JSUDPWRAP: number; + const MESSAGEPORT: number; + const PIPECONNECTWRAP: number; + const PIPESERVERWRAP: number; + const PIPEWRAP: number; + const PROCESSWRAP: number; + const PROMISE: number; + const QUERYWRAP: number; + const SHUTDOWNWRAP: number; + const SIGNALWRAP: number; + const STATWATCHER: number; + const STREAMPIPE: number; + const TCPCONNECTWRAP: number; + const TCPSERVERWRAP: number; + const TCPWRAP: number; + const TTYWRAP: number; + const UDPSENDWRAP: number; + const UDPWRAP: number; + const SIGINTWATCHDOG: number; + const WORKER: number; + const WORKERHEAPSNAPSHOT: number; + const WRITEWRAP: number; + const ZLIB: number; + const CHECKPRIMEREQUEST: number; + const PBKDF2REQUEST: number; + const KEYPAIRGENREQUEST: number; + const KEYGENREQUEST: number; + const KEYEXPORTREQUEST: number; + const CIPHERREQUEST: number; + const DERIVEBITSREQUEST: number; + const HASHREQUEST: number; + const RANDOMBYTESREQUEST: number; + const RANDOMPRIMEREQUEST: number; + const SCRYPTREQUEST: number; + const SIGNREQUEST: number; + const TLSWRAP: number; + const VERIFYREQUEST: number; + } } declare module "node:async_hooks" { export * from "async_hooks"; diff --git a/types/node/v18/buffer.buffer.d.ts b/types/node/v18/buffer.buffer.d.ts index f5b1b3e2eda0c8..4eb3b64554fa0a 100644 --- a/types/node/v18/buffer.buffer.d.ts +++ b/types/node/v18/buffer.buffer.d.ts @@ -445,6 +445,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/v18/buffer.d.ts b/types/node/v18/buffer.d.ts index 789b7134159949..3938b2fb736892 100644 --- a/types/node/v18/buffer.d.ts +++ b/types/node/v18/buffer.d.ts @@ -68,7 +68,7 @@ declare module "buffer" { * @param input The input to validate. */ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - export const INSPECT_MAX_BYTES: number; + export let INSPECT_MAX_BYTES: number; export const kMaxLength: number; export const kStringMaxLength: number; export const constants: { @@ -112,7 +112,7 @@ declare module "buffer" { * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. */ export function resolveObjectURL(id: string): Blob | undefined; - export { Buffer }; + export { type AllowSharedBuffer, Buffer, type NonSharedBuffer }; /** * @experimental */ diff --git a/types/node/v18/fs.d.ts b/types/node/v18/fs.d.ts index 591083f0378bd4..3c083e99fd6b55 100644 --- a/types/node/v18/fs.d.ts +++ b/types/node/v18/fs.d.ts @@ -2695,7 +2695,7 @@ declare module "fs" { } & Abortable) | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2730,7 +2730,7 @@ declare module "fs" { | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2739,7 +2739,7 @@ declare module "fs" { */ export function readFile( path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; export namespace readFile { /** @@ -2755,7 +2755,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Promise; + ): Promise; /** * Asynchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2789,7 +2789,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): Promise; + ): Promise; } /** * Returns the contents of the `path`. @@ -2821,7 +2821,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Buffer; + ): NonSharedBuffer; /** * Synchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2853,7 +2853,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): string | Buffer; + ): string | NonSharedBuffer; export type WriteFileOptions = | ( & ObjectEncodingOptions diff --git a/types/node/v18/fs/promises.d.ts b/types/node/v18/fs/promises.d.ts index 631a776da9a364..c273c426992b01 100644 --- a/types/node/v18/fs/promises.d.ts +++ b/types/node/v18/fs/promises.d.ts @@ -271,36 +271,26 @@ declare module "fs/promises" { * data will be a string. */ readFile( - options?: { - encoding?: null | undefined; - flag?: OpenMode | undefined; - } | null, + options?: + | ({ encoding?: null | undefined } & Abortable) + | null, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options: - | { - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } + | ({ encoding: BufferEncoding } & Abortable) | BufferEncoding, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options?: - | (ObjectEncodingOptions & { - flag?: OpenMode | undefined; - }) + | (ObjectEncodingOptions & Abortable) | BufferEncoding | null, ): Promise; diff --git a/types/node/v18/globals.d.ts b/types/node/v18/globals.d.ts index 83bd0d8da61975..4f4223057551d6 100644 --- a/types/node/v18/globals.d.ts +++ b/types/node/v18/globals.d.ts @@ -17,15 +17,8 @@ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} // #region DOMException type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException; interface NodeDOMException extends Error { - /** - * @deprecated - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) - */ readonly code: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ readonly message: string; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ readonly name: string; readonly INDEX_SIZE_ERR: 1; readonly DOMSTRING_SIZE_ERR: 2; @@ -85,197 +78,104 @@ interface NodeDOMExceptionConstructor { // #endregion DOMException declare global { - // Declare "static" methods in Error - interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - - stackTraceLimit: number; - } - - /*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - var global: typeof globalThis; var process: NodeJS.Process; var console: Console; - interface GCFunction { - (options: { - execution?: "sync"; - type?: "major" | "minor"; - }): void; - (options: { - execution: "async"; - type?: "major" | "minor"; - }): Promise; - (options?: boolean): void; - } - - /** - * Only available if `--expose-gc` is passed to the process. - */ - var gc: undefined | GCFunction; - - // #region borrowed - // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib - /** A controller object that allows you to abort one or more DOM requests as and when desired. */ - interface AbortController { + interface ErrorConstructor { /** - * Returns the AbortSignal object associated with this object. + * Creates a `.stack` property on `targetObject`, which when accessed returns + * a string representing the location in the code at which + * `Error.captureStackTrace()` was called. + * + * ```js + * const myObject = {}; + * Error.captureStackTrace(myObject); + * myObject.stack; // Similar to `new Error().stack` + * ``` + * + * The first line of the trace will be prefixed with + * `${myObject.name}: ${myObject.message}`. + * + * The optional `constructorOpt` argument accepts a function. If given, all frames + * above `constructorOpt`, including `constructorOpt`, will be omitted from the + * generated stack trace. + * + * The `constructorOpt` argument is useful for hiding implementation + * details of error generation from the user. For instance: + * + * ```js + * function a() { + * b(); + * } + * + * function b() { + * c(); + * } + * + * function c() { + * // Create an error without stack trace to avoid calculating the stack trace twice. + * const { stackTraceLimit } = Error; + * Error.stackTraceLimit = 0; + * const error = new Error(); + * Error.stackTraceLimit = stackTraceLimit; + * + * // Capture the stack trace above function b + * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + * throw error; + * } + * + * a(); + * ``` */ - - readonly signal: AbortSignal; + captureStackTrace(targetObject: object, constructorOpt?: Function): void; /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces */ - abort(reason?: any): void; - } - - /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ - interface AbortSignal extends EventTarget { + prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + * The `Error.stackTraceLimit` property specifies the number of stack frames + * collected by a stack trace (whether generated by `new Error().stack` or + * `Error.captureStackTrace(obj)`). + * + * The default value is `10` but may be set to any valid JavaScript number. Changes + * will affect any stack trace captured _after_ the value has been changed. + * + * If set to a non-number value, or set to a negative number, stack traces will + * not capture any frames. */ - readonly aborted: boolean; - readonly reason: any; - onabort: null | ((this: AbortSignal, event: Event) => any); - throwIfAborted(): void; + stackTraceLimit: number; } - var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T - : { - prototype: AbortController; - new(): AbortController; - }; - - var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T - : { - prototype: AbortSignal; - new(): AbortSignal; - abort(reason?: any): AbortSignal; - timeout(milliseconds: number): AbortSignal; - any(signals: AbortSignal[]): AbortSignal; - }; - // #endregion borrowed - - /** - * @since v17.0.0 - * - * Creates a deep clone of an object. - */ - function structuredClone( - value: T, - transfer?: { transfer: ReadonlyArray }, - ): T; - - // #region DOMException - /** - * @since v17.0.0 - * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) - */ - interface DOMException extends _DOMException {} - /** - * @since v17.0.0 - * - * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details. + * Enable this API with the `--expose-gc` CLI flag. */ - var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T - : NodeDOMExceptionConstructor; - // #endregion DOMException + var gc: NodeJS.GCFunction | undefined; - /*----------------------------------------------* - * * - * GLOBAL INTERFACES * - * * - *-----------------------------------------------*/ namespace NodeJS { interface CallSite { - /** - * Value of "this" - */ - getThis(): unknown; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ + getColumnNumber(): number | null; + getEnclosingColumnNumber(): number | null; + getEnclosingLineNumber(): number | null; + getEvalOrigin(): string | undefined; + getFileName(): string | null; getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | undefined; - - /** - * Current line number [if this function was defined in a script] - */ getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ + getMethodName(): string | null; + getPosition(): number; + getPromiseIndex(): number | null; + getScriptHash(): string; + getScriptNameOrSourceURL(): string | null; + getThis(): unknown; + getTypeName(): string | null; + isAsync(): boolean; + isConstructor(): boolean; isEval(): boolean; - - /** - * Is this call in native V8 code? - */ isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; + isPromiseAll(): boolean; + isToplevel(): boolean; } interface ErrnoException extends Error { @@ -323,6 +223,17 @@ declare global { readonly [key: string]: T | undefined; } + interface GCFunction { + (minor?: boolean): void; + (options: NodeJS.GCOptions & { execution: "async" }): Promise; + (options: NodeJS.GCOptions): void; + } + + interface GCOptions { + execution?: "sync" | "async" | undefined; + type?: "major" | "minor" | undefined; + } + /** An iterable iterator returned by the Node.js API. */ // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used IterableIterator. interface Iterator extends IteratorObject { @@ -336,6 +247,45 @@ declare global { } } + // Global DOM types + + function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, + ): T; + + interface DOMException extends _DOMException {} + var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T + : NodeDOMExceptionConstructor; + + // #region AbortController + interface AbortController { + readonly signal: AbortSignal; + abort(reason?: any): void; + } + var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T + : { + prototype: AbortController; + new(): AbortController; + }; + + interface AbortSignal extends EventTarget { + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + readonly reason: any; + throwIfAborted(): void; + } + var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + any(signals: AbortSignal[]): AbortSignal; + timeout(milliseconds: number): AbortSignal; + }; + // #endregion AbortController + + // #region fetch interface RequestInit extends _RequestInit {} function fetch( @@ -374,12 +324,10 @@ declare global { : typeof import("undici-types").Headers; interface MessageEvent extends _MessageEvent {} - /** - * @since v15.0.0 - */ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T; } ? T : typeof import("undici-types").MessageEvent; + // #endregion fetch } diff --git a/types/node/v18/http.d.ts b/types/node/v18/http.d.ts index 88780cd95d5b82..aa0d342606bba4 100644 --- a/types/node/v18/http.d.ts +++ b/types/node/v18/http.d.ts @@ -267,6 +267,13 @@ declare module "http" { * @default 30000 */ connectionsCheckingInterval?: number | undefined; + /** + * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. + * See {@link Server.headersTimeout} for more information. + * @default 60000 + * @since 18.0.0 + */ + headersTimeout?: number | undefined; /** * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. @@ -313,6 +320,12 @@ declare module "http" { * If the header's value is an array, the items will be joined using `; `. */ uniqueHeaders?: Array | undefined; + /** + * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. + * @default false + * @since v18.17.0, v20.2.0 + */ + rejectNonStandardBodyWrites?: boolean | undefined; } type RequestListener< Request extends typeof IncomingMessage = typeof IncomingMessage, diff --git a/types/node/v18/node-tests.ts b/types/node/v18/node-tests.ts index b92bb29f8b8ae6..f5587dc84e316c 100644 --- a/types/node/v18/node-tests.ts +++ b/types/node/v18/node-tests.ts @@ -43,233 +43,3 @@ import "./test/vm"; import "./test/wasi"; import "./test/worker_threads"; import "./test/zlib"; - -import * as http from "node:http"; -import * as http2 from "node:http2"; -import * as https from "node:https"; -import * as inspector from "node:inspector"; -import * as net from "node:net"; -import * as stream from "node:stream"; -import * as trace_events from "node:trace_events"; -import * as url from "node:url"; - -////////////////////////////////////////////////////// -/// Https tests : https://nodejs.org/api/https.html /// -////////////////////////////////////////////////////// - -{ - let agent: https.Agent = new https.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256, - maxCachedSessions: 100, - timeout: 15000, - family: 4, - }); - - agent = https.globalAgent; - - let sockets: NodeJS.ReadOnlyDict = agent.sockets; - sockets = agent.freeSockets; - - https.request({ - agent: false, - }); - https.request({ - agent, - }); - https.request({ - agent: undefined, - }); - - https.get("http://www.example.com/xyz"); - https.request("http://www.example.com/xyz"); - - https.get("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - https.request("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - - https.get(new url.URL("http://www.example.com/xyz")); - https.request(new url.URL("http://www.example.com/xyz")); - - https.get(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - - const opts: https.RequestOptions = { - path: "/some/path", - }; - https.get(new url.URL("http://www.example.com"), opts); - https.request(new url.URL("http://www.example.com"), opts); - https.get(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - - https.globalAgent.options.ca = []; - - { - function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {} - - class MyIncomingMessage extends http.IncomingMessage { - foo: number; - } - - class MyServerResponse - extends http.ServerResponse - { - foo: string; - } - - let server: https.Server; - - server = new https.Server(); - server = new https.Server(reqListener); - server = new https.Server({ IncomingMessage: MyIncomingMessage }); - - server = new https.Server({ - IncomingMessage: MyIncomingMessage, - ServerResponse: MyServerResponse, - }, reqListener); - - server = https.createServer(); - server = https.createServer(reqListener); - server = https.createServer({ IncomingMessage: MyIncomingMessage }); - server = https.createServer({ ServerResponse: MyServerResponse }, reqListener); - - const timeout: number = server.timeout; - const listening: boolean = server.listening; - const keepAliveTimeout: number = server.keepAliveTimeout; - const maxHeadersCount: number | null = server.maxHeadersCount; - const headersTimeout: number = server.headersTimeout; - server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {}); - } -} - -///////////////////////////////////////////////////////// -/// Errors Tests : https://nodejs.org/api/errors.html /// -///////////////////////////////////////////////////////// - -{ - { - Error.stackTraceLimit = Infinity; - } - { - const myObject = {}; - Error.captureStackTrace(myObject); - } - { - const frames: NodeJS.CallSite[] = []; - Error.prepareStackTrace!(new Error(), frames); - } - { - const frame: NodeJS.CallSite = null!; - const frameThis: unknown = frame.getThis(); - const typeName: string | null = frame.getTypeName(); - const func: Function | undefined = frame.getFunction(); - const funcName: string | null = frame.getFunctionName(); - const meth: string | null = frame.getMethodName(); - const fname: string | undefined = frame.getFileName(); - const lineno: number | null = frame.getLineNumber(); - const colno: number | null = frame.getColumnNumber(); - const evalOrigin: string | undefined = frame.getEvalOrigin(); - const isTop: boolean = frame.isToplevel(); - const isEval: boolean = frame.isEval(); - const isNative: boolean = frame.isNative(); - const isConstr: boolean = frame.isConstructor(); - } -} - -/***************************************************************************** - * * - * The following tests are the modules not mentioned in document but existed * - * * - *****************************************************************************/ - -/////////////////////////////////////////////////////////// -/// Inspector Tests /// -/////////////////////////////////////////////////////////// - -{ - { - const b: inspector.Console.ConsoleMessage = { source: "test", text: "test", level: "error" }; - inspector.open(); - inspector.open(0); - inspector.open(0, "localhost"); - inspector.open(0, "localhost", true); - inspector.close(); - const inspectorUrl: string | undefined = inspector.url(); - - const session = new inspector.Session(); - session.connect(); - session.disconnect(); - - // Unknown post method - session.post("A.b", { key: "value" }, (err, params) => {}); - // TODO: parameters are implicitly 'any' and need type annotation - session.post("A.b", (err: Error | null, params?: {}) => {}); - session.post("A.b"); - // Known post method - const parameter: inspector.Runtime.EvaluateParameterType = { expression: "2 + 2" }; - session.post( - "Runtime.evaluate", - parameter, - (err: Error | null, params: inspector.Runtime.EvaluateReturnType) => {}, - ); - session.post("Runtime.evaluate", (err: Error, params: inspector.Runtime.EvaluateReturnType) => { - const exceptionDetails: inspector.Runtime.ExceptionDetails = params.exceptionDetails!; - const resultClassName: string = params.result.className!; - }); - session.post("Runtime.evaluate"); - - // General event - session.on("inspectorNotification", message => { - message; // $ExpectType InspectorNotification<{}> - }); - // Known events - session.on( - "Debugger.paused", - (message: inspector.InspectorNotification) => { - const method: string = message.method; - const pauseReason: string = message.params.reason; - }, - ); - session.on("Debugger.resumed", () => {}); - } -} - -/////////////////////////////////////////////////////////// -/// Trace Events Tests /// -/////////////////////////////////////////////////////////// - -{ - const enabledCategories: string | undefined = trace_events.getEnabledCategories(); - const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ["node", "v8"] }); - const categories: string = tracing.categories; - const enabled: boolean = tracing.enabled; - tracing.enable(); - tracing.disable(); -} - -//////////////////////////////////////////////////// -/// Node.js ESNEXT Support -//////////////////////////////////////////////////// - -{ - const s = "foo"; - const s1: string = s.trimLeft(); - const s2: string = s.trimRight(); - const s3: string = s.trimStart(); - const s4: string = s.trimEnd(); -} - -//////////////////////////////////////////////////// -/// Node.js http2 tests -//////////////////////////////////////////////////// - -{ - http2.connect("https://foo.com", { - createConnection: (authority, option) => { - authority; // $ExpectType URL - option; // $ExpectType SessionOptions - return new stream.Duplex(); - }, - }); -} diff --git a/types/node/v18/querystring.d.ts b/types/node/v18/querystring.d.ts index 1434752eb6f387..a35d5c1dcd4a1e 100644 --- a/types/node/v18/querystring.d.ts +++ b/types/node/v18/querystring.d.ts @@ -25,9 +25,8 @@ declare module "querystring" { | string | number | boolean - | readonly string[] - | readonly number[] - | readonly boolean[] + | bigint + | ReadonlyArray | null > {} diff --git a/types/node/v18/stream/web.d.ts b/types/node/v18/stream/web.d.ts index 16b582e95b5ce8..ab123b8d03935b 100644 --- a/types/node/v18/stream/web.d.ts +++ b/types/node/v18/stream/web.d.ts @@ -97,7 +97,7 @@ declare module "stream/web" { signal?: AbortSignal; } interface ReadableStreamGenericReader { - readonly closed: Promise; + readonly closed: Promise; cancel(reason?: any): Promise; } type ReadableStreamController = ReadableStreamDefaultController; @@ -301,9 +301,9 @@ declare module "stream/web" { * sink. */ interface WritableStreamDefaultWriter { - readonly closed: Promise; + readonly closed: Promise; readonly desiredSize: number | null; - readonly ready: Promise; + readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; diff --git a/types/node/v18/test/async_hooks.ts b/types/node/v18/test/async_hooks.ts index 2165adc0db930c..e651e98c377e16 100644 --- a/types/node/v18/test/async_hooks.ts +++ b/types/node/v18/test/async_hooks.ts @@ -1,6 +1,7 @@ import { AsyncLocalStorage, AsyncResource, + asyncWrapProviders, createHook, executionAsyncId, executionAsyncResource, @@ -98,3 +99,20 @@ import { return runInAsyncScope(() => asyncLocalStorage.getStore()); }); } + +{ + // $ExpectType number + asyncWrapProviders.NONE; + // $ExpectType number + asyncWrapProviders.DIRHANDLE; + + // $ExpectType number + asyncWrapProviders.TLSWRAP; + // $ExpectType number + asyncWrapProviders.VERIFYREQUEST; + + // @ts-expect-error - Cannot assign to asyncWrapProviders.NONE + asyncWrapProviders.NONE = 1; + // @ts-expect-error - Cannot assign to asyncWrapProviders['...'] + asyncWrapProviders.foo = 1; +} diff --git a/types/node/v18/test/buffer.ts b/types/node/v18/test/buffer.ts index a31602020af51f..e23816509d6042 100644 --- a/types/node/v18/test/buffer.ts +++ b/types/node/v18/test/buffer.ts @@ -1,3 +1,5 @@ +import bufferModule = require("node:buffer"); + // Specifically test buffer module regression. import { Blob as NodeBlob, @@ -42,6 +44,18 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ const value4: number = kStringMaxLength; } +// Module variables +{ + // $ExpectType number + bufferModule.INSPECT_MAX_BYTES; + bufferModule.INSPECT_MAX_BYTES = 0; + + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES; + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES = 2; +} + // Module methods { const bool1: boolean = isUtf8(new Buffer("hello")); diff --git a/types/node/v18/test/fs.ts b/types/node/v18/test/fs.ts index c556d1b18e5c76..939dd4bfdf4030 100644 --- a/types/node/v18/test/fs.ts +++ b/types/node/v18/test/fs.ts @@ -883,4 +883,8 @@ const anyStatFs: fs.StatsFs | fs.BigIntStatsFs = fs.statfsSync(".", { bigint: Ma fd.appendFile("test", { signal: new AbortSignal(), encoding: "utf-8" }); // @ts-expect-error fd.appendFile("test", { mode: 0o777, flush: true, flag: "a" }); + + fd.readFile({ signal: new AbortSignal(), encoding: "utf-8" }); + // @ts-expect-error + fd.readFile({ encoding: "utf-8", flag: "r" }); }); diff --git a/types/node/v18/test/globals.ts b/types/node/v18/test/globals.ts index 0108f6e88a7383..ed0a0bf8354128 100644 --- a/types/node/v18/test/globals.ts +++ b/types/node/v18/test/globals.ts @@ -1,19 +1,61 @@ -////////////////////////////////////////////////////////////////////////// -/// `globalThis` Tests: https://node.green/#ES2020-features-globalThis /// -////////////////////////////////////////////////////////////////////////// - +// global / globalThis { const isGlobalThis: typeof globalThis = global; - - const accessibleToGlobalThisMembers: true = global.RANDOM_GLOBAL_VARIABLE; + const accessibleAsGlobalProperty: true = global.RANDOM_GLOBAL_VARIABLE; } declare var RANDOM_GLOBAL_VARIABLE: true; -// exposed gc +// ErrorConstructor +{ + { + Error.stackTraceLimit = Infinity; + } + { + const myObject = {}; + Error.captureStackTrace(myObject); + } + { + const original = Error.prepareStackTrace; + Error.prepareStackTrace = (error, frames) => { + error; // $ExpectType Error + + const [frame] = frames; + frame.getColumnNumber(); // $ExpectType number | null + frame.getEnclosingColumnNumber(); // $ExpectType number | null + frame.getEnclosingLineNumber(); // $ExpectType number | null + frame.getEvalOrigin(); // $ExpectType string | undefined + frame.getFileName(); // $ExpectType string | null + frame.getFunction(); // $ExpectType Function | undefined + frame.getFunctionName(); // $ExpectType string | null + frame.getLineNumber(); // $ExpectType number | null + frame.getMethodName(); // $ExpectType string | null + frame.getPosition(); // $ExpectType number + frame.getPromiseIndex(); // $ExpectType number | null + frame.getScriptHash(); // $ExpectType string + frame.getScriptNameOrSourceURL(); // $ExpectType string | null + frame.getThis(); // $ExpectType unknown + frame.getTypeName(); // $ExpectType string | null + frame.isAsync(); // $ExpectType boolean + frame.isConstructor(); // $ExpectType boolean + frame.isEval(); // $ExpectType boolean + frame.isNative(); // $ExpectType boolean + frame.isPromiseAll(); // $ExpectType boolean + frame.isToplevel(); // $ExpectType boolean + + return original(error, frames); + }; + } +} + +// gc() { - if (gc) { - gc(); + if (typeof gc === "function") { + gc(); // $ExpectType void + gc(true); // $ExpectType void + gc({ execution: "sync" }); // $ExpectType void + gc({ execution: "async" }); // $ExpectType Promise + gc({ execution: Math.random() > 0.5 ? "sync" : "async" }); // $ExpectType void } } diff --git a/types/node/v18/test/http.ts b/types/node/v18/test/http.ts index 13192f78c538a7..cd2f5ad32d68e8 100644 --- a/types/node/v18/test/http.ts +++ b/types/node/v18/test/http.ts @@ -30,11 +30,14 @@ import * as url from "node:url"; server = http.createServer(reqListener); server = http.createServer({ IncomingMessage: MyIncomingMessage }); server = http.createServer({ ServerResponse: MyServerResponse }, reqListener); + // TODO: add test for all remaining options server = http.createServer({ insecureHTTPParser: true, keepAlive: true, keepAliveInitialDelay: 1000, keepAliveTimeout: 100, + headersTimeout: 50000, + rejectNonStandardBodyWrites: false, }, reqListener); server.close(); diff --git a/types/node/v18/test/querystring.ts b/types/node/v18/test/querystring.ts index 977c3ec39e923d..ac6b22901bd34b 100644 --- a/types/node/v18/test/querystring.ts +++ b/types/node/v18/test/querystring.ts @@ -25,17 +25,14 @@ interface SampleObject { querystring.stringify({ foo: { bar: 1 } }); querystring.stringify({ - foo: "foo", - bar: 1, - baz: true, - foo2: ["a", "b"], - bar2: [1, 2], - baz2: [true, false], - rfoo2: ["a", "b"] as readonly string[], - rbar2: [1, 2] as readonly number[], - rbaz2: [true, false] as readonly boolean[], - a: undefined, - b: null, + str: "foo", + num: 1, + bool: true, + bigInt: 1n, + list: ["a", 1, true, 1n], + listReadonly: ["a", 1, true, 1n] as const, + undef: undefined, + nul: null, }); } diff --git a/types/node/v18/test/stream.ts b/types/node/v18/test/stream.ts index 5179c7ec6f03d2..9c8c3b07e3c87c 100644 --- a/types/node/v18/test/stream.ts +++ b/types/node/v18/test/stream.ts @@ -731,7 +731,7 @@ async function testTransferringStreamWithPostMessage() { // $ExpectType Promise byobReader.cancel("reason"); - // $ExpectType Promise + // $ExpectType Promise byobReader.closed; // $ExpectType Promise>> diff --git a/types/node/v18/test/tls.ts b/types/node/v18/test/tls.ts index b319a459535cda..6d5b90cbbfe8b5 100644 --- a/types/node/v18/test/tls.ts +++ b/types/node/v18/test/tls.ts @@ -86,6 +86,14 @@ import { cert: fs.readFileSync("cert_filepath"), key: fs.readFileSync("key_filepath"), }); + + _server.addContext( + "example", + createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", + }), + ); } { diff --git a/types/node/v18/tls.d.ts b/types/node/v18/tls.d.ts index 3f4e91061548c4..a3bd7ebfc80a5e 100644 --- a/types/node/v18/tls.d.ts +++ b/types/node/v18/tls.d.ts @@ -636,9 +636,10 @@ declare module "tls" { * used. * @since v0.5.3 * @param hostname A SNI host name or wildcard (e.g. `'*'`) - * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created + * with {@link createSecureContext} itself. */ - addContext(hostname: string, context: SecureContextOptions): void; + addContext(hostname: string, context: SecureContextOptions | SecureContext): void; /** * Returns the session ticket keys. * diff --git a/types/node/v18/ts5.6/buffer.buffer.d.ts b/types/node/v18/ts5.6/buffer.buffer.d.ts index 9fc5a7e7f6b8af..8430b2639c0287 100644 --- a/types/node/v18/ts5.6/buffer.buffer.d.ts +++ b/types/node/v18/ts5.6/buffer.buffer.d.ts @@ -443,6 +443,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/v20/async_hooks.d.ts b/types/node/v20/async_hooks.d.ts index f5432e238d14c4..fd9d2aa3e64958 100644 --- a/types/node/v20/async_hooks.d.ts +++ b/types/node/v20/async_hooks.d.ts @@ -535,6 +535,70 @@ declare module "async_hooks" { */ enterWith(store: T): void; } + /** + * @since v17.2.0, v16.14.0 + * @return A map of provider types to the corresponding numeric id. + * This map contains all the event types that might be emitted by the `async_hooks.init()` event. + */ + namespace asyncWrapProviders { + const NONE: number; + const DIRHANDLE: number; + const DNSCHANNEL: number; + const ELDHISTOGRAM: number; + const FILEHANDLE: number; + const FILEHANDLECLOSEREQ: number; + const FIXEDSIZEBLOBCOPY: number; + const FSEVENTWRAP: number; + const FSREQCALLBACK: number; + const FSREQPROMISE: number; + const GETADDRINFOREQWRAP: number; + const GETNAMEINFOREQWRAP: number; + const HEAPSNAPSHOT: number; + const HTTP2SESSION: number; + const HTTP2STREAM: number; + const HTTP2PING: number; + const HTTP2SETTINGS: number; + const HTTPINCOMINGMESSAGE: number; + const HTTPCLIENTREQUEST: number; + const JSSTREAM: number; + const JSUDPWRAP: number; + const MESSAGEPORT: number; + const PIPECONNECTWRAP: number; + const PIPESERVERWRAP: number; + const PIPEWRAP: number; + const PROCESSWRAP: number; + const PROMISE: number; + const QUERYWRAP: number; + const SHUTDOWNWRAP: number; + const SIGNALWRAP: number; + const STATWATCHER: number; + const STREAMPIPE: number; + const TCPCONNECTWRAP: number; + const TCPSERVERWRAP: number; + const TCPWRAP: number; + const TTYWRAP: number; + const UDPSENDWRAP: number; + const UDPWRAP: number; + const SIGINTWATCHDOG: number; + const WORKER: number; + const WORKERHEAPSNAPSHOT: number; + const WRITEWRAP: number; + const ZLIB: number; + const CHECKPRIMEREQUEST: number; + const PBKDF2REQUEST: number; + const KEYPAIRGENREQUEST: number; + const KEYGENREQUEST: number; + const KEYEXPORTREQUEST: number; + const CIPHERREQUEST: number; + const DERIVEBITSREQUEST: number; + const HASHREQUEST: number; + const RANDOMBYTESREQUEST: number; + const RANDOMPRIMEREQUEST: number; + const SCRYPTREQUEST: number; + const SIGNREQUEST: number; + const TLSWRAP: number; + const VERIFYREQUEST: number; + } } declare module "node:async_hooks" { export * from "async_hooks"; diff --git a/types/node/v20/buffer.buffer.d.ts b/types/node/v20/buffer.buffer.d.ts index 10004003edc008..e6f977f4293c2e 100644 --- a/types/node/v20/buffer.buffer.d.ts +++ b/types/node/v20/buffer.buffer.d.ts @@ -450,6 +450,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/v20/buffer.d.ts b/types/node/v20/buffer.d.ts index b537ea19886a86..c4c12854cbe3ba 100644 --- a/types/node/v20/buffer.d.ts +++ b/types/node/v20/buffer.d.ts @@ -69,7 +69,7 @@ declare module "buffer" { * @param input The input to validate. */ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - export const INSPECT_MAX_BYTES: number; + export let INSPECT_MAX_BYTES: number; export const kMaxLength: number; export const kStringMaxLength: number; export const constants: { @@ -122,7 +122,7 @@ declare module "buffer" { * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. */ export function resolveObjectURL(id: string): Blob | undefined; - export { Buffer }; + export { type AllowSharedBuffer, Buffer, type NonSharedBuffer }; /** * @experimental */ diff --git a/types/node/v20/fs.d.ts b/types/node/v20/fs.d.ts index afee55f69b717c..4330ac4c312876 100644 --- a/types/node/v20/fs.d.ts +++ b/types/node/v20/fs.d.ts @@ -2682,7 +2682,7 @@ declare module "fs" { } & Abortable) | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2717,7 +2717,7 @@ declare module "fs" { | BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void, ): void; /** * Asynchronously reads the entire contents of a file. @@ -2726,7 +2726,7 @@ declare module "fs" { */ export function readFile( path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, + callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void, ): void; export namespace readFile { /** @@ -2742,7 +2742,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Promise; + ): Promise; /** * Asynchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2776,7 +2776,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): Promise; + ): Promise; } /** * Returns the contents of the `path`. @@ -2808,7 +2808,7 @@ declare module "fs" { encoding?: null | undefined; flag?: string | undefined; } | null, - ): Buffer; + ): NonSharedBuffer; /** * Synchronously reads the entire contents of a file. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. @@ -2840,7 +2840,7 @@ declare module "fs" { }) | BufferEncoding | null, - ): string | Buffer; + ): string | NonSharedBuffer; export type WriteFileOptions = | ( & ObjectEncodingOptions diff --git a/types/node/v20/fs/promises.d.ts b/types/node/v20/fs/promises.d.ts index 03d2d628926dbb..09a4ed57c15dc8 100644 --- a/types/node/v20/fs/promises.d.ts +++ b/types/node/v20/fs/promises.d.ts @@ -276,36 +276,26 @@ declare module "fs/promises" { * data will be a string. */ readFile( - options?: { - encoding?: null | undefined; - flag?: OpenMode | undefined; - } | null, + options?: + | ({ encoding?: null | undefined } & Abortable) + | null, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options: - | { - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } + | ({ encoding: BufferEncoding } & Abortable) | BufferEncoding, ): Promise; /** * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. */ readFile( options?: - | (ObjectEncodingOptions & { - flag?: OpenMode | undefined; - }) + | (ObjectEncodingOptions & Abortable) | BufferEncoding | null, ): Promise; diff --git a/types/node/v20/globals.d.ts b/types/node/v20/globals.d.ts index 61d5198e83d194..1dc2aa923a010c 100644 --- a/types/node/v20/globals.d.ts +++ b/types/node/v20/globals.d.ts @@ -17,15 +17,8 @@ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} // #region DOMException type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException; interface NodeDOMException extends Error { - /** - * @deprecated - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) - */ readonly code: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ readonly message: string; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ readonly name: string; readonly INDEX_SIZE_ERR: 1; readonly DOMSTRING_SIZE_ERR: 2; @@ -85,223 +78,104 @@ interface NodeDOMExceptionConstructor { // #endregion DOMException declare global { - // Declare "static" methods in Error - interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - - stackTraceLimit: number; - } - - /*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - var global: typeof globalThis; var process: NodeJS.Process; var console: Console; - interface GCFunction { - (options: { - execution?: "sync"; - type?: "major" | "minor"; - }): void; - (options: { - execution: "async"; - type?: "major" | "minor"; - }): Promise; - (options?: boolean): void; - } - - /** - * Only available if `--expose-gc` is passed to the process. - */ - var gc: undefined | GCFunction; - - // #region borrowed - // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib - /** A controller object that allows you to abort one or more DOM requests as and when desired. */ - interface AbortController { + interface ErrorConstructor { /** - * Returns the AbortSignal object associated with this object. + * Creates a `.stack` property on `targetObject`, which when accessed returns + * a string representing the location in the code at which + * `Error.captureStackTrace()` was called. + * + * ```js + * const myObject = {}; + * Error.captureStackTrace(myObject); + * myObject.stack; // Similar to `new Error().stack` + * ``` + * + * The first line of the trace will be prefixed with + * `${myObject.name}: ${myObject.message}`. + * + * The optional `constructorOpt` argument accepts a function. If given, all frames + * above `constructorOpt`, including `constructorOpt`, will be omitted from the + * generated stack trace. + * + * The `constructorOpt` argument is useful for hiding implementation + * details of error generation from the user. For instance: + * + * ```js + * function a() { + * b(); + * } + * + * function b() { + * c(); + * } + * + * function c() { + * // Create an error without stack trace to avoid calculating the stack trace twice. + * const { stackTraceLimit } = Error; + * Error.stackTraceLimit = 0; + * const error = new Error(); + * Error.stackTraceLimit = stackTraceLimit; + * + * // Capture the stack trace above function b + * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + * throw error; + * } + * + * a(); + * ``` */ - - readonly signal: AbortSignal; + captureStackTrace(targetObject: object, constructorOpt?: Function): void; /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces */ - abort(reason?: any): void; - } - - /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ - interface AbortSignal extends EventTarget { + prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + * The `Error.stackTraceLimit` property specifies the number of stack frames + * collected by a stack trace (whether generated by `new Error().stack` or + * `Error.captureStackTrace(obj)`). + * + * The default value is `10` but may be set to any valid JavaScript number. Changes + * will affect any stack trace captured _after_ the value has been changed. + * + * If set to a non-number value, or set to a negative number, stack traces will + * not capture any frames. */ - readonly aborted: boolean; - readonly reason: any; - onabort: null | ((this: AbortSignal, event: Event) => any); - throwIfAborted(): void; + stackTraceLimit: number; } - var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T - : { - prototype: AbortController; - new(): AbortController; - }; - - var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T - : { - prototype: AbortSignal; - new(): AbortSignal; - abort(reason?: any): AbortSignal; - timeout(milliseconds: number): AbortSignal; - any(signals: AbortSignal[]): AbortSignal; - }; - // #endregion borrowed - - /** - * @since v17.0.0 - * - * Creates a deep clone of an object. - */ - function structuredClone( - value: T, - transfer?: { transfer: ReadonlyArray }, - ): T; - - // #region DOMException /** - * @since v17.0.0 - * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) + * Enable this API with the `--expose-gc` CLI flag. */ - interface DOMException extends _DOMException {} + var gc: NodeJS.GCFunction | undefined; - /** - * @since v17.0.0 - * - * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details. - */ - var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T - : NodeDOMExceptionConstructor; - // #endregion DOMException - - /*----------------------------------------------* - * * - * GLOBAL INTERFACES * - * * - *-----------------------------------------------*/ namespace NodeJS { interface CallSite { - /** - * Value of "this" - */ - getThis(): unknown; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ + getColumnNumber(): number | null; + getEnclosingColumnNumber(): number | null; + getEnclosingLineNumber(): number | null; + getEvalOrigin(): string | undefined; + getFileName(): string | null; getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | undefined; - - /** - * Current line number [if this function was defined in a script] - */ getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ + getMethodName(): string | null; + getPosition(): number; + getPromiseIndex(): number | null; + getScriptHash(): string; + getScriptNameOrSourceURL(): string | null; + getThis(): unknown; + getTypeName(): string | null; + isAsync(): boolean; + isConstructor(): boolean; isEval(): boolean; - - /** - * Is this call in native V8 code? - */ isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - - /** - * is this an async call (i.e. await, Promise.all(), or Promise.any())? - */ - isAsync(): boolean; - - /** - * is this an async call to Promise.all()? - */ isPromiseAll(): boolean; - - /** - * returns the index of the promise element that was followed in - * Promise.all() or Promise.any() for async stack traces, or null - * if the CallSite is not an async - */ - getPromiseIndex(): number | null; - - getScriptNameOrSourceURL(): string; - getScriptHash(): string; - - getEnclosingColumnNumber(): number; - getEnclosingLineNumber(): number; - getPosition(): number; - - toString(): string; + isToplevel(): boolean; } interface ErrnoException extends Error { @@ -349,6 +223,19 @@ declare global { readonly [key: string]: T | undefined; } + interface GCFunction { + (minor?: boolean): void; + (options: NodeJS.GCOptions & { execution: "async" }): Promise; + (options: NodeJS.GCOptions): void; + } + + interface GCOptions { + execution?: "sync" | "async" | undefined; + flavor?: "regular" | "last-resort" | undefined; + type?: "major-snapshot" | "major" | "minor" | undefined; + filename?: string | undefined; + } + /** An iterable iterator returned by the Node.js API. */ // Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used IterableIterator. interface Iterator extends IteratorObject { @@ -362,6 +249,45 @@ declare global { } } + // Global DOM types + + function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, + ): T; + + interface DOMException extends _DOMException {} + var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T + : NodeDOMExceptionConstructor; + + // #region AbortController + interface AbortController { + readonly signal: AbortSignal; + abort(reason?: any): void; + } + var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T + : { + prototype: AbortController; + new(): AbortController; + }; + + interface AbortSignal extends EventTarget { + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + readonly reason: any; + throwIfAborted(): void; + } + var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + any(signals: AbortSignal[]): AbortSignal; + timeout(milliseconds: number): AbortSignal; + }; + // #endregion AbortController + + // #region fetch interface RequestInit extends _RequestInit {} function fetch( @@ -400,12 +326,11 @@ declare global { : typeof import("undici-types").Headers; interface MessageEvent extends _MessageEvent {} - /** - * @since v15.0.0 - */ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T; } ? T : typeof import("undici-types").MessageEvent; + + // #endregion fetch } diff --git a/types/node/v20/http.d.ts b/types/node/v20/http.d.ts index 99a855b0fb71eb..6b7c796e62a41c 100644 --- a/types/node/v20/http.d.ts +++ b/types/node/v20/http.d.ts @@ -267,6 +267,13 @@ declare module "http" { * @default 30000 */ connectionsCheckingInterval?: number | undefined; + /** + * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. + * See {@link Server.headersTimeout} for more information. + * @default 60000 + * @since 18.0.0 + */ + headersTimeout?: number | undefined; /** * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. @@ -294,6 +301,13 @@ declare module "http" { * @since v16.5.0 */ noDelay?: boolean | undefined; + /** + * If set to `true`, it forces the server to respond with a 400 (Bad Request) status code + * to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification). + * @default true + * @since 20.0.0 + */ + requireHostHeader?: boolean | undefined; /** * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. @@ -312,6 +326,12 @@ declare module "http" { * If the header's value is an array, the items will be joined using `; `. */ uniqueHeaders?: Array | undefined; + /** + * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. + * @default false + * @since v18.17.0, v20.2.0 + */ + rejectNonStandardBodyWrites?: boolean | undefined; } type RequestListener< Request extends typeof IncomingMessage = typeof IncomingMessage, diff --git a/types/node/v20/node-tests.ts b/types/node/v20/node-tests.ts index ed64e8d7ea4dbf..ad1a8922092b9f 100644 --- a/types/node/v20/node-tests.ts +++ b/types/node/v20/node-tests.ts @@ -43,181 +43,3 @@ import "./test/vm"; import "./test/wasi"; import "./test/worker_threads"; import "./test/zlib"; - -import * as http from "node:http"; -import * as http2 from "node:http2"; -import * as https from "node:https"; -import * as inspector from "node:inspector"; -import * as net from "node:net"; -import * as stream from "node:stream"; -import * as trace_events from "node:trace_events"; -import * as url from "node:url"; - -////////////////////////////////////////////////////// -/// Https tests : https://nodejs.org/api/https.html /// -////////////////////////////////////////////////////// - -{ - let agent: https.Agent = new https.Agent({ - keepAlive: true, - keepAliveMsecs: 10000, - maxSockets: Infinity, - maxFreeSockets: 256, - maxCachedSessions: 100, - timeout: 15000, - family: 4, - }); - - agent = https.globalAgent; - - let sockets: NodeJS.ReadOnlyDict = agent.sockets; - sockets = agent.freeSockets; - - https.request({ - agent: false, - }); - https.request({ - agent, - }); - https.request({ - agent: undefined, - }); - - https.get("http://www.example.com/xyz"); - https.request("http://www.example.com/xyz"); - - https.get("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - https.request("http://www.example.com/xyz", (res: http.IncomingMessage): void => {}); - - https.get(new url.URL("http://www.example.com/xyz")); - https.request(new url.URL("http://www.example.com/xyz")); - - https.get(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), (res: http.IncomingMessage): void => {}); - - const opts: https.RequestOptions = { - path: "/some/path", - }; - https.get(new url.URL("http://www.example.com"), opts); - https.request(new url.URL("http://www.example.com"), opts); - https.get(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - https.request(new url.URL("http://www.example.com/xyz"), opts, (res: http.IncomingMessage): void => {}); - - https.globalAgent.options.ca = []; - - { - function reqListener(req: http.IncomingMessage, res: http.ServerResponse): void {} - - class MyIncomingMessage extends http.IncomingMessage { - foo: number; - } - - class MyServerResponse - extends http.ServerResponse - { - foo: string; - } - - let server: https.Server; - - server = new https.Server(); - server = new https.Server(reqListener); - server = new https.Server({ IncomingMessage: MyIncomingMessage }); - - server = new https.Server({ - IncomingMessage: MyIncomingMessage, - ServerResponse: MyServerResponse, - }, reqListener); - - server = https.createServer(); - server = https.createServer(reqListener); - server = https.createServer({ IncomingMessage: MyIncomingMessage }); - server = https.createServer({ ServerResponse: MyServerResponse }, reqListener); - - const timeout: number = server.timeout; - const listening: boolean = server.listening; - const keepAliveTimeout: number = server.keepAliveTimeout; - const maxHeadersCount: number | null = server.maxHeadersCount; - const headersTimeout: number = server.headersTimeout; - server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {}); - } -} - -///////////////////////////////////////////////////////// -/// Errors Tests : https://nodejs.org/api/errors.html /// -///////////////////////////////////////////////////////// - -{ - { - Error.stackTraceLimit = Infinity; - } - { - const myObject = {}; - Error.captureStackTrace(myObject); - } - { - const frames: NodeJS.CallSite[] = []; - Error.prepareStackTrace!(new Error(), frames); - } - { - const frame: NodeJS.CallSite = null!; - const frameThis: unknown = frame.getThis(); - const typeName: string | null = frame.getTypeName(); - const func: Function | undefined = frame.getFunction(); - const funcName: string | null = frame.getFunctionName(); - const meth: string | null = frame.getMethodName(); - const fname: string | undefined = frame.getFileName(); - const lineno: number | null = frame.getLineNumber(); - const colno: number | null = frame.getColumnNumber(); - const evalOrigin: string | undefined = frame.getEvalOrigin(); - const isTop: boolean = frame.isToplevel(); - const isEval: boolean = frame.isEval(); - const isNative: boolean = frame.isNative(); - const isConstr: boolean = frame.isConstructor(); - } -} - -/***************************************************************************** - * * - * The following tests are the modules not mentioned in document but existed * - * * - *****************************************************************************/ - -/////////////////////////////////////////////////////////// -/// Trace Events Tests /// -/////////////////////////////////////////////////////////// - -{ - const enabledCategories: string | undefined = trace_events.getEnabledCategories(); - const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ["node", "v8"] }); - const categories: string = tracing.categories; - const enabled: boolean = tracing.enabled; - tracing.enable(); - tracing.disable(); -} - -//////////////////////////////////////////////////// -/// Node.js ESNEXT Support -//////////////////////////////////////////////////// - -{ - const s = "foo"; - const s1: string = s.trimLeft(); - const s2: string = s.trimRight(); - const s3: string = s.trimStart(); - const s4: string = s.trimEnd(); -} - -//////////////////////////////////////////////////// -/// Node.js http2 tests -//////////////////////////////////////////////////// - -{ - http2.connect("https://foo.com", { - createConnection: (authority, option) => { - authority; // $ExpectType URL - option; // $ExpectType SessionOptions - return new stream.Duplex(); - }, - }); -} diff --git a/types/node/v20/querystring.d.ts b/types/node/v20/querystring.d.ts index 592033c396a15c..27eaed25493b03 100644 --- a/types/node/v20/querystring.d.ts +++ b/types/node/v20/querystring.d.ts @@ -37,9 +37,8 @@ declare module "querystring" { | string | number | boolean - | readonly string[] - | readonly number[] - | readonly boolean[] + | bigint + | ReadonlyArray | null > {} diff --git a/types/node/v20/stream/web.d.ts b/types/node/v20/stream/web.d.ts index 235684746c0cda..a6e6b5774f89b3 100644 --- a/types/node/v20/stream/web.d.ts +++ b/types/node/v20/stream/web.d.ts @@ -97,7 +97,7 @@ declare module "stream/web" { signal?: AbortSignal; } interface ReadableStreamGenericReader { - readonly closed: Promise; + readonly closed: Promise; cancel(reason?: any): Promise; } type ReadableStreamController = ReadableStreamDefaultController; @@ -307,9 +307,9 @@ declare module "stream/web" { * sink. */ interface WritableStreamDefaultWriter { - readonly closed: Promise; + readonly closed: Promise; readonly desiredSize: number | null; - readonly ready: Promise; + readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; diff --git a/types/node/v20/test/async_hooks.ts b/types/node/v20/test/async_hooks.ts index 2165adc0db930c..e651e98c377e16 100644 --- a/types/node/v20/test/async_hooks.ts +++ b/types/node/v20/test/async_hooks.ts @@ -1,6 +1,7 @@ import { AsyncLocalStorage, AsyncResource, + asyncWrapProviders, createHook, executionAsyncId, executionAsyncResource, @@ -98,3 +99,20 @@ import { return runInAsyncScope(() => asyncLocalStorage.getStore()); }); } + +{ + // $ExpectType number + asyncWrapProviders.NONE; + // $ExpectType number + asyncWrapProviders.DIRHANDLE; + + // $ExpectType number + asyncWrapProviders.TLSWRAP; + // $ExpectType number + asyncWrapProviders.VERIFYREQUEST; + + // @ts-expect-error - Cannot assign to asyncWrapProviders.NONE + asyncWrapProviders.NONE = 1; + // @ts-expect-error - Cannot assign to asyncWrapProviders['...'] + asyncWrapProviders.foo = 1; +} diff --git a/types/node/v20/test/buffer.ts b/types/node/v20/test/buffer.ts index 41c372e038a8d9..95e6e1146a4ecf 100644 --- a/types/node/v20/test/buffer.ts +++ b/types/node/v20/test/buffer.ts @@ -1,3 +1,5 @@ +import bufferModule = require("node:buffer"); + // Specifically test buffer module regression. import { Blob as NodeBlob, @@ -43,6 +45,18 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer] as readonly Uint8Array[ const value4: number = kStringMaxLength; } +// Module variables +{ + // $ExpectType number + bufferModule.INSPECT_MAX_BYTES; + bufferModule.INSPECT_MAX_BYTES = 0; + + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES; + // @ts-expect-error - This variable is in `exports`, but not in `exports.Buffer`. + Buffer.INSPECT_MAX_BYTES = 2; +} + // Module methods { const bool1: boolean = isUtf8(new Buffer("hello")); diff --git a/types/node/v20/test/fs.ts b/types/node/v20/test/fs.ts index c2dff5e2853a91..d3ab658c297269 100644 --- a/types/node/v20/test/fs.ts +++ b/types/node/v20/test/fs.ts @@ -912,4 +912,8 @@ const anyStatFs: fs.StatsFs | fs.BigIntStatsFs = fs.statfsSync(".", { bigint: Ma fd.appendFile("test", { signal: new AbortSignal(), encoding: "utf-8" }); // @ts-expect-error fd.appendFile("test", { mode: 0o777, flush: true, flag: "a" }); + + fd.readFile({ signal: new AbortSignal(), encoding: "utf-8" }); + // @ts-expect-error + fd.readFile({ encoding: "utf-8", flag: "r" }); }); diff --git a/types/node/v20/test/globals.ts b/types/node/v20/test/globals.ts index 0108f6e88a7383..f1e80d47af2439 100644 --- a/types/node/v20/test/globals.ts +++ b/types/node/v20/test/globals.ts @@ -1,19 +1,62 @@ -////////////////////////////////////////////////////////////////////////// -/// `globalThis` Tests: https://node.green/#ES2020-features-globalThis /// -////////////////////////////////////////////////////////////////////////// - +// global / globalThis { const isGlobalThis: typeof globalThis = global; - - const accessibleToGlobalThisMembers: true = global.RANDOM_GLOBAL_VARIABLE; + const accessibleAsGlobalProperty: true = global.RANDOM_GLOBAL_VARIABLE; } declare var RANDOM_GLOBAL_VARIABLE: true; -// exposed gc +// ErrorConstructor +{ + { + Error.stackTraceLimit = Infinity; + } + { + const myObject = {}; + Error.captureStackTrace(myObject); + } + { + const original = Error.prepareStackTrace; + Error.prepareStackTrace = (error, frames) => { + error; // $ExpectType Error + + const [frame] = frames; + frame.getColumnNumber(); // $ExpectType number | null + frame.getEnclosingColumnNumber(); // $ExpectType number | null + frame.getEnclosingLineNumber(); // $ExpectType number | null + frame.getEvalOrigin(); // $ExpectType string | undefined + frame.getFileName(); // $ExpectType string | null + frame.getFunction(); // $ExpectType Function | undefined + frame.getFunctionName(); // $ExpectType string | null + frame.getLineNumber(); // $ExpectType number | null + frame.getMethodName(); // $ExpectType string | null + frame.getPosition(); // $ExpectType number + frame.getPromiseIndex(); // $ExpectType number | null + frame.getScriptHash(); // $ExpectType string + frame.getScriptNameOrSourceURL(); // $ExpectType string | null + frame.getThis(); // $ExpectType unknown + frame.getTypeName(); // $ExpectType string | null + frame.isAsync(); // $ExpectType boolean + frame.isConstructor(); // $ExpectType boolean + frame.isEval(); // $ExpectType boolean + frame.isNative(); // $ExpectType boolean + frame.isPromiseAll(); // $ExpectType boolean + frame.isToplevel(); // $ExpectType boolean + + return original(error, frames); + }; + } +} + +// gc() { - if (gc) { - gc(); + if (typeof gc === "function") { + gc(); // $ExpectType void + gc(true); // $ExpectType void + gc({ flavor: "regular", type: "major-snapshot", filename: "/tmp/snapshot" }); // $ExpectType void + gc({ execution: "sync" }); // $ExpectType void + gc({ execution: "async" }); // $ExpectType Promise + gc({ execution: Math.random() > 0.5 ? "sync" : "async" }); // $ExpectType void } } diff --git a/types/node/v20/test/http.ts b/types/node/v20/test/http.ts index d6727ebec1d7b2..fac3fa2812de68 100644 --- a/types/node/v20/test/http.ts +++ b/types/node/v20/test/http.ts @@ -30,11 +30,15 @@ import * as url from "node:url"; server = http.createServer(reqListener); server = http.createServer({ IncomingMessage: MyIncomingMessage }); server = http.createServer({ ServerResponse: MyServerResponse }, reqListener); + // TODO: add test for all remaining options server = http.createServer({ insecureHTTPParser: true, keepAlive: true, keepAliveInitialDelay: 1000, keepAliveTimeout: 100, + headersTimeout: 50000, + requireHostHeader: false, + rejectNonStandardBodyWrites: false, }, reqListener); server.close(); diff --git a/types/node/v20/test/querystring.ts b/types/node/v20/test/querystring.ts index 977c3ec39e923d..ac6b22901bd34b 100644 --- a/types/node/v20/test/querystring.ts +++ b/types/node/v20/test/querystring.ts @@ -25,17 +25,14 @@ interface SampleObject { querystring.stringify({ foo: { bar: 1 } }); querystring.stringify({ - foo: "foo", - bar: 1, - baz: true, - foo2: ["a", "b"], - bar2: [1, 2], - baz2: [true, false], - rfoo2: ["a", "b"] as readonly string[], - rbar2: [1, 2] as readonly number[], - rbaz2: [true, false] as readonly boolean[], - a: undefined, - b: null, + str: "foo", + num: 1, + bool: true, + bigInt: 1n, + list: ["a", 1, true, 1n], + listReadonly: ["a", 1, true, 1n] as const, + undef: undefined, + nul: null, }); } diff --git a/types/node/v20/test/stream.ts b/types/node/v20/test/stream.ts index 4ba432cec98f2b..d2c591321c21b6 100644 --- a/types/node/v20/test/stream.ts +++ b/types/node/v20/test/stream.ts @@ -811,7 +811,7 @@ async function testTransferringStreamWithPostMessage() { // $ExpectType Promise byobReader.cancel("reason"); - // $ExpectType Promise + // $ExpectType Promise byobReader.closed; // $ExpectType Promise>> diff --git a/types/node/v20/test/tls.ts b/types/node/v20/test/tls.ts index aecade9a2427b3..c9e7e32d9a2046 100644 --- a/types/node/v20/test/tls.ts +++ b/types/node/v20/test/tls.ts @@ -95,6 +95,14 @@ import { cert: fs.readFileSync("cert_filepath"), key: fs.readFileSync("key_filepath"), }); + + _server.addContext( + "example", + createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", + }), + ); } { diff --git a/types/node/v20/test/util.ts b/types/node/v20/test/util.ts index 55a0a8d3f53988..76649fd1fed9af 100644 --- a/types/node/v20/test/util.ts +++ b/types/node/v20/test/util.ts @@ -71,6 +71,12 @@ console.log( console.log( util.styleText(["red", "green"], "text"), ); +console.log( + util.styleText("blue", "text", { validateStream: false }), +); +console.log( + util.styleText("yellow", "text", { stream: process.stdout }), +); // util.callbackify class callbackifyTest { diff --git a/types/node/v20/tls.d.ts b/types/node/v20/tls.d.ts index 103ca626df9430..b97b1ac1c290fb 100644 --- a/types/node/v20/tls.d.ts +++ b/types/node/v20/tls.d.ts @@ -647,7 +647,7 @@ declare module "tls" { * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created * with {@link createSecureContext} itself. */ - addContext(hostname: string, context: SecureContextOptions): void; + addContext(hostname: string, context: SecureContextOptions | SecureContext): void; /** * Returns the session ticket keys. * diff --git a/types/node/v20/ts5.6/buffer.buffer.d.ts b/types/node/v20/ts5.6/buffer.buffer.d.ts index aea019fbf0fd1c..d19026dc2ff99c 100644 --- a/types/node/v20/ts5.6/buffer.buffer.d.ts +++ b/types/node/v20/ts5.6/buffer.buffer.d.ts @@ -448,6 +448,8 @@ declare module "buffer" { */ subarray(start?: number, end?: number): Buffer; } + type NonSharedBuffer = Buffer; + type AllowSharedBuffer = Buffer; } /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */ var SlowBuffer: { diff --git a/types/node/v20/util.d.ts b/types/node/v20/util.d.ts index b3c0f5cb04754e..9902a47145b067 100644 --- a/types/node/v20/util.d.ts +++ b/types/node/v20/util.d.ts @@ -1241,6 +1241,18 @@ declare module "util" { | "reset" | "strikethrough" | "underline"; + export interface StyleTextOptions { + /** + * When true, `stream` is checked to see if it can handle colors. + * @default true + */ + validateStream?: boolean | undefined; + /** + * A stream that will be validated if it can be colored. + * @default process.stdout + */ + stream?: NodeJS.WritableStream | undefined; + } /** * Stability: 1.1 - Active development * @@ -1281,6 +1293,7 @@ declare module "util" { | Modifiers | Array, text: string, + options?: StyleTextOptions, ): string; /** * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. diff --git a/types/npm-run/package.json b/types/npm-run/package.json index 615aa2e3ad4f4f..5be53bf2ab33f6 100644 --- a/types/npm-run/package.json +++ b/types/npm-run/package.json @@ -11,10 +11,5 @@ "devDependencies": { "@types/npm-run": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/npm-which/package.json b/types/npm-which/package.json index f80652a8cfe8a9..0002e0c2783ad1 100644 --- a/types/npm-which/package.json +++ b/types/npm-which/package.json @@ -11,10 +11,5 @@ "devDependencies": { "@types/npm-which": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 3216dfd320a6ab..4e154fed70ecc3 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -4613,7 +4613,7 @@ declare namespace Office { * * @remarks * - * The `contentLanguage` value reflects the **Editing Language** setting specified with **File** \> **Options** \> **Language** in the Office + * The `contentLanguage` value reflects the **Editing Language** setting specified with **File** > **Options** > **Language** in the Office * application. * * **Support details** @@ -4649,7 +4649,7 @@ declare namespace Office { * * The returned value is a string in the RFC 1766 Language tag format, such as en-US. * - * The `displayLanguage` value reflects the current **Display Language** setting specified with **File** \> **Options** \> **Language** in the Office + * The `displayLanguage` value reflects the current **Display Language** setting specified with **File** > **Options** > **Language** in the Office * application. * * When using in Outlook, the applicable modes are Compose or Read. @@ -7154,7 +7154,7 @@ declare namespace Office { * Provides access to the properties for Office theme colors. * * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user. - * The user sets a theme in an Office application through **File** \> **Account** or **Office Account** \> **Office Theme**. + * The user sets a theme in an Office application through **File** > **Account** or **Office Account** > **Office Theme**. * The selected theme is then applied across all Office applications. Using Office theme colors is appropriate for mail and * task pane add-ins. * @@ -8146,7 +8146,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. @@ -8200,7 +8200,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. @@ -8257,7 +8257,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The * property name specifies the name of the formatting property to set, and value specifies the property value. @@ -8356,7 +8356,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The * property name specifies the name of the formatting property to set, and value specifies the property value. @@ -133493,6 +133493,7 @@ declare namespace PowerPoint { /** * Returns the selected {@link PowerPoint.TextRange} in the current view of the presentation. If no text is selected, an object with an `isNullObject` property set to `true` is returned. + For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] @@ -135468,7 +135469,7 @@ declare namespace PowerPoint { */ right = "Right", /** - * Align text so that it is justified across the whole line. + * Align text so that it's justified across the whole line. * @remarks * [Api set: PowerPointApi 1.4] */ @@ -135553,7 +135554,7 @@ declare namespace PowerPoint { */ foregroundColor: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -136149,7 +136150,7 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets the table cell using its zero-based index in the collection. If the `TableCell` does not exist, then this method returns an object with its `isNullObject` property set to `true`. For further information, see {@link [https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties](https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties) | *OrNullObject methods and properties}. + * Gets the table cell using its zero-based index in the collection. If the `TableCell` doesn't exist, then this method returns an object with its `isNullObject` property set to `true`. For further information, see {@link [https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties](https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties) | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.8] @@ -136439,7 +136440,7 @@ declare namespace PowerPoint { * * @param rowIndex The zero-based row index of the cell. * @param columnIndex The zero-based column index of the cell. - * @returns The cell at the specified row and column. If the cell is part of a merged area and not the top left cell of the merged area, an object with the `isNullObject` property set to `true` is returned. + * @returns The cell at the specified row and column. If the cell is part of a merged area and not the top left cell of the merged area, an object with the `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. */ getCellOrNullObject(rowIndex: number, columnIndex: number): PowerPoint.TableCell; /** @@ -136496,7 +136497,7 @@ declare namespace PowerPoint { When a table is being added, for columns whose width is undefined, the column width will be calculated by evenly dividing the remaining width - of the table amongst those columns. If the table does not have a defined width, + of the table amongst those columns. If the table doesn't have a defined width, a default column width will be used. * * @remarks @@ -136554,7 +136555,7 @@ declare namespace PowerPoint { When a table is being added, for rows whose height is undefined, the row height will be calculated by evenly dividing the remaining height - of the table amongst those rows. If the table does not have a defined height, + of the table amongst those rows. If the table doesn't have a defined height, a default row height will be used. * * @remarks @@ -136580,7 +136581,7 @@ declare namespace PowerPoint { columns?: PowerPoint.TableColumnProperties[]; /** * Specifies the height, in points, of the table. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. Throws an `InvalidArgument` exception when set with a negative value. * * @remarks @@ -136589,7 +136590,7 @@ declare namespace PowerPoint { height?: number | undefined; /** * Specifies the distance, in points, from the left side of the table to the left side of the slide. - The table is centered horizontally when this parameter is not provided. + The table is centered horizontally when this parameter isn't provided. * * @remarks * [Api set: PowerPointApi 1.8] @@ -136615,7 +136616,7 @@ declare namespace PowerPoint { * If provided, specifies properties for each cell in the table. This should be an 2D array with the same number of rows and columns as the table. - If a cell does not require specific formatting, specify an empty object for that cell. + If a cell doesn't require specific formatting, specify an empty object for that cell. Only the top left cell of a merged are can have properties specified, which will be applied to the entire merged area. For the other cells in the merged area, an empty object should be provided. * @@ -136625,7 +136626,7 @@ declare namespace PowerPoint { specificCellProperties?: PowerPoint.TableCellProperties[][]; /** * Specifies the distance, in points, from the top edge of the table to the top edge of the slide. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. * * @remarks * [Api set: PowerPointApi 1.8] @@ -136641,7 +136642,7 @@ declare namespace PowerPoint { appearance as when the user adds a table through the PowerPoint UI. To provide a plain appearance for the table, set this property to an empty object - and do not specify specificCellProperties. + and don't specify specificCellProperties. * * @remarks * [Api set: PowerPointApi 1.8] @@ -136661,7 +136662,7 @@ declare namespace PowerPoint { values?: string[][]; /** * Specifies the width, in points, of the table. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. Throws an `InvalidArgument` exception when set with a negative value. * * @remarks @@ -136767,13 +136768,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a shape using its unique ID. An error is thrown if the shape does not exist. + * Gets a shape using its unique ID. An error is thrown if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an error is thrown. + * @returns The shape with the unique ID. If such a shape doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Shape; /** @@ -136787,13 +136788,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Shape; /** - * Gets a shape using its unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a shape using its unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.3] * * @param id The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The shape with the unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(id: string): PowerPoint.Shape; /** @@ -137169,7 +137170,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.3] * * @param key The ID of the layout. - * @returns The layout with the unique ID. If such a layout does not exist, an error is thrown. + * @returns The layout with the unique ID. If such a layout doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.SlideLayout; /** @@ -137183,7 +137184,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.SlideLayout; /** - * Gets a layout using its unique ID. If such a layout does not exist, an object with an `isNullObject` property set to true is returned. For further information, + * Gets a layout using its unique ID. If such a layout doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -137355,12 +137356,12 @@ declare namespace PowerPoint { * @remarks * [Api set: PowerPointApi 1.3] * - * @param key The unique ID of a tag, which is unique within this `TagCollection`. 'key' parameter is case-insensitive, but it is always capitalized when saved in the document. + * @param key The unique ID of a tag, which is unique within this `TagCollection`. 'key' parameter is case-insensitive, but it's always capitalized when saved in the document. * @param value The value of the tag. */ add(key: string, value: string): void; /** - * Deletes the tag with the given `key` in this collection. Does nothing if the `key` does not exist. + * Deletes the tag with the given `key` in this collection. Does nothing if the `key` doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] @@ -137377,13 +137378,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a tag using its unique ID. An error is thrown if the tag does not exist. + * Gets a tag using its unique ID. An error is thrown if the tag doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the tag. - * @returns The tag with the unique ID. If such a tag does not exist, an error is thrown. + * @returns The tag with the unique ID. If such a tag doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Tag; /** @@ -137397,13 +137398,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Tag; /** - * Gets a tag using its unique ID. If such a tag does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a tag using its unique ID. If such a tag doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the tag. - * @returns The tag with the unique ID. If such a tag does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The tag with the unique ID. If such a tag doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(key: string): PowerPoint.Tag; /** @@ -137505,7 +137506,7 @@ declare namespace PowerPoint { */ applyLayout(slideLayout: PowerPoint.SlideLayout): void; /** - * Deletes the slide from the presentation. Does nothing if the slide does not exist. + * Deletes the slide from the presentation. Does nothing if the slide doesn't exist. * * @remarks * [Api set: PowerPointApi 1.2] @@ -137595,13 +137596,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a shape using its unique ID. An error is thrown if the shape does not exist. + * Gets a shape using its unique ID. An error is thrown if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.5] * * @param key The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an error is thrown. + * @returns The shape with the unique ID. If such a shape doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Shape; /** @@ -137615,13 +137616,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Shape; /** - * Gets a shape using its unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a shape using its unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] * * @param id The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The shape with the unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(id: string): PowerPoint.Shape; /** @@ -137776,14 +137777,14 @@ declare namespace PowerPoint { */ color: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -137804,7 +137805,7 @@ declare namespace PowerPoint { */ visible: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -138343,49 +138344,49 @@ declare namespace PowerPoint { */ readonly zOrderPosition: number; /** - * Deletes the shape from the shape collection. Does nothing if the shape does not exist. + * Deletes the shape from the shape collection. Does nothing if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] */ delete(): void; /** - * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. Throws an exception if this shape does not belong to a `Slide`. + * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `Slide`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlide(): PowerPoint.Slide; /** - * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. Throws an exception if this shape does not belong to a `SlideLayout`. + * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `SlideLayout`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideLayout(): PowerPoint.SlideLayout; /** - * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. If this shape does not belong to a `SlideLayout`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. If this shape doesn't belong to a `SlideLayout`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideLayoutOrNullObject(): PowerPoint.SlideLayout; /** - * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. Throws an exception if this shape does not belong to a `SlideMaster`. + * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `SlideMaster`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideMaster(): PowerPoint.SlideMaster; /** - * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. If this shape does not belong to a `SlideMaster`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. If this shape doesn't belong to a `SlideMaster`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideMasterOrNullObject(): PowerPoint.SlideMaster; /** - * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. If this shape does not belong to a `Slide`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. If this shape doesn't belong to a `Slide`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] @@ -138474,7 +138475,7 @@ declare namespace PowerPoint { */ delete(): void; /** - * Returns the shape represented by the binding. Will throw an error if the binding is not of the correct type. + * Returns the shape represented by the binding. Will throw an error if the binding isn't of the correct type. * * @remarks * [Api set: PowerPointApi 1.8] @@ -138960,8 +138961,8 @@ declare namespace PowerPoint { /** * Specifies the slides from the source presentation that will be inserted into the current presentation. These slides are represented by their IDs which can be retrieved from a `Slide` object. The order of these slides is preserved during the insertion. - If any of the source slides are not found, or if the IDs are invalid, the operation throws a `SlideNotFound` exception and no slides will be inserted. - All of the source slides will be inserted when `sourceSlideIds` is not provided (this is the default behavior). + If any of the source slides aren't found, or if the IDs are invalid, the operation throws a `SlideNotFound` exception and no slides will be inserted. + All of the source slides will be inserted when `sourceSlideIds` isn't provided (this is the default behavior). * * @remarks * [Api set: PowerPointApi 1.2] @@ -138969,8 +138970,8 @@ declare namespace PowerPoint { sourceSlideIds?: string[]; /** * Specifies where in the presentation the new slides will be inserted. The new slides will be inserted after the slide with the given slide ID. - If `targetSlideId` is not provided, the slides will be inserted at the beginning of the presentation. - If `targetSlideId` is invalid or if it is pointing to a non-existing slide, the operation throws a `SlideNotFound` exception and no slides will be inserted. + If `targetSlideId` isn't provided, the slides will be inserted at the beginning of the presentation. + If `targetSlideId` is invalid or if it's pointing to a non-existing slide, the operation throws a `SlideNotFound` exception and no slides will be inserted. * * @remarks * [Api set: PowerPointApi 1.2] @@ -139012,7 +139013,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.2] * * @param key The ID of the slide. - * @returns The slide with the unique ID. If such a slide does not exist, an error is thrown. + * @returns The slide with the unique ID. If such a slide doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Slide; /** @@ -139027,7 +139028,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Slide; /** - * Gets a slide using its unique ID. If such a slide does not exist, an object with an `isNullObject` property set to true is returned. For further information, see + * Gets a slide using its unique ID. If such a slide doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -139087,7 +139088,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.5] * * @param key The ID of the slide. - * @returns The slide with the unique ID. If such a slide does not exist, an error is thrown. + * @returns The slide with the unique ID. If such a slide doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Slide; /** @@ -139101,7 +139102,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Slide; /** - * Gets a slide using its unique ID. If such a slide does not exist, an object with an `isNullObject` property set to true is returned. For further information, see + * Gets a slide using its unique ID. If such a slide doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -139161,7 +139162,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.3] * * @param key The ID of the Slide Master. - * @returns The Slide Master with the unique ID. If such a Slide Master does not exist, an error is thrown. + * @returns The Slide Master with the unique ID. If such a Slide Master doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.SlideMaster; /** @@ -139175,7 +139176,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.SlideMaster; /** - * Gets a Slide Master using its unique ID. If such a Slide Master does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a Slide Master using its unique ID. If such a Slide Master doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -139265,7 +139266,7 @@ declare namespace PowerPoint { */ foregroundColor?: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -139334,7 +139335,7 @@ declare namespace PowerPoint { */ italic?: boolean | null; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -139457,14 +139458,14 @@ declare namespace PowerPoint { */ color?: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -139485,7 +139486,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -139810,7 +139811,7 @@ declare namespace PowerPoint { */ foregroundColor?: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -139886,7 +139887,7 @@ declare namespace PowerPoint { */ italic?: boolean | null; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -140138,14 +140139,14 @@ declare namespace PowerPoint { */ color?: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -140166,7 +140167,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -140696,7 +140697,7 @@ declare namespace PowerPoint { */ foregroundColor?: boolean; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -140781,7 +140782,7 @@ declare namespace PowerPoint { */ italic?: boolean; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -141468,14 +141469,14 @@ declare namespace PowerPoint { */ color?: boolean; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: boolean; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -141496,7 +141497,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 642c55a69772cf..4e8f583d7b8e54 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -4561,7 +4561,7 @@ declare namespace Office { * * @remarks * - * The `contentLanguage` value reflects the **Editing Language** setting specified with **File** \> **Options** \> **Language** in the Office + * The `contentLanguage` value reflects the **Editing Language** setting specified with **File** > **Options** > **Language** in the Office * application. * * **Support details** @@ -4597,7 +4597,7 @@ declare namespace Office { * * The returned value is a string in the RFC 1766 Language tag format, such as en-US. * - * The `displayLanguage` value reflects the current **Display Language** setting specified with **File** \> **Options** \> **Language** in the Office + * The `displayLanguage` value reflects the current **Display Language** setting specified with **File** > **Options** > **Language** in the Office * application. * * When using in Outlook, the applicable modes are Compose or Read. @@ -7102,7 +7102,7 @@ declare namespace Office { * Provides access to the properties for Office theme colors. * * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user. - * The user sets a theme in an Office application through **File** \> **Account** or **Office Account** \> **Office Theme**. + * The user sets a theme in an Office application through **File** > **Account** or **Office Account** > **Office Theme**. * The selected theme is then applied across all Office applications. Using Office theme colors is appropriate for mail and * task pane add-ins. * @@ -8094,7 +8094,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. @@ -8148,7 +8148,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. @@ -8205,7 +8205,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The * property name specifies the name of the formatting property to set, and value specifies the property value. @@ -8304,7 +8304,7 @@ declare namespace Office { * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** \> **Format** \> **Format Cells**). + * (Open the context menu (right-click or select and hold) then select **Format Cells**, or **Home** > **Format** > **Format Cells**). * * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The * property name specifies the name of the formatting property to set, and value specifies the property value. @@ -125205,6 +125205,7 @@ declare namespace PowerPoint { /** * Returns the selected {@link PowerPoint.TextRange} in the current view of the presentation. If no text is selected, an object with an `isNullObject` property set to `true` is returned. + For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] @@ -127180,7 +127181,7 @@ declare namespace PowerPoint { */ right = "Right", /** - * Align text so that it is justified across the whole line. + * Align text so that it's justified across the whole line. * @remarks * [Api set: PowerPointApi 1.4] */ @@ -127265,7 +127266,7 @@ declare namespace PowerPoint { */ foregroundColor: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -127861,7 +127862,7 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets the table cell using its zero-based index in the collection. If the `TableCell` does not exist, then this method returns an object with its `isNullObject` property set to `true`. For further information, see {@link [https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties](https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties) | *OrNullObject methods and properties}. + * Gets the table cell using its zero-based index in the collection. If the `TableCell` doesn't exist, then this method returns an object with its `isNullObject` property set to `true`. For further information, see {@link [https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties](https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties) | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.8] @@ -128151,7 +128152,7 @@ declare namespace PowerPoint { * * @param rowIndex The zero-based row index of the cell. * @param columnIndex The zero-based column index of the cell. - * @returns The cell at the specified row and column. If the cell is part of a merged area and not the top left cell of the merged area, an object with the `isNullObject` property set to `true` is returned. + * @returns The cell at the specified row and column. If the cell is part of a merged area and not the top left cell of the merged area, an object with the `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. */ getCellOrNullObject(rowIndex: number, columnIndex: number): PowerPoint.TableCell; /** @@ -128208,7 +128209,7 @@ declare namespace PowerPoint { When a table is being added, for columns whose width is undefined, the column width will be calculated by evenly dividing the remaining width - of the table amongst those columns. If the table does not have a defined width, + of the table amongst those columns. If the table doesn't have a defined width, a default column width will be used. * * @remarks @@ -128266,7 +128267,7 @@ declare namespace PowerPoint { When a table is being added, for rows whose height is undefined, the row height will be calculated by evenly dividing the remaining height - of the table amongst those rows. If the table does not have a defined height, + of the table amongst those rows. If the table doesn't have a defined height, a default row height will be used. * * @remarks @@ -128292,7 +128293,7 @@ declare namespace PowerPoint { columns?: PowerPoint.TableColumnProperties[]; /** * Specifies the height, in points, of the table. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. Throws an `InvalidArgument` exception when set with a negative value. * * @remarks @@ -128301,7 +128302,7 @@ declare namespace PowerPoint { height?: number | undefined; /** * Specifies the distance, in points, from the left side of the table to the left side of the slide. - The table is centered horizontally when this parameter is not provided. + The table is centered horizontally when this parameter isn't provided. * * @remarks * [Api set: PowerPointApi 1.8] @@ -128327,7 +128328,7 @@ declare namespace PowerPoint { * If provided, specifies properties for each cell in the table. This should be an 2D array with the same number of rows and columns as the table. - If a cell does not require specific formatting, specify an empty object for that cell. + If a cell doesn't require specific formatting, specify an empty object for that cell. Only the top left cell of a merged are can have properties specified, which will be applied to the entire merged area. For the other cells in the merged area, an empty object should be provided. * @@ -128337,7 +128338,7 @@ declare namespace PowerPoint { specificCellProperties?: PowerPoint.TableCellProperties[][]; /** * Specifies the distance, in points, from the top edge of the table to the top edge of the slide. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. * * @remarks * [Api set: PowerPointApi 1.8] @@ -128353,7 +128354,7 @@ declare namespace PowerPoint { appearance as when the user adds a table through the PowerPoint UI. To provide a plain appearance for the table, set this property to an empty object - and do not specify specificCellProperties. + and don't specify specificCellProperties. * * @remarks * [Api set: PowerPointApi 1.8] @@ -128373,7 +128374,7 @@ declare namespace PowerPoint { values?: string[][]; /** * Specifies the width, in points, of the table. - A default value is used when this parameter is not provided. + A default value is used when this parameter isn't provided. Throws an `InvalidArgument` exception when set with a negative value. * * @remarks @@ -128479,13 +128480,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a shape using its unique ID. An error is thrown if the shape does not exist. + * Gets a shape using its unique ID. An error is thrown if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an error is thrown. + * @returns The shape with the unique ID. If such a shape doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Shape; /** @@ -128499,13 +128500,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Shape; /** - * Gets a shape using its unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a shape using its unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.3] * * @param id The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The shape with the unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(id: string): PowerPoint.Shape; /** @@ -128881,7 +128882,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.3] * * @param key The ID of the layout. - * @returns The layout with the unique ID. If such a layout does not exist, an error is thrown. + * @returns The layout with the unique ID. If such a layout doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.SlideLayout; /** @@ -128895,7 +128896,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.SlideLayout; /** - * Gets a layout using its unique ID. If such a layout does not exist, an object with an `isNullObject` property set to true is returned. For further information, + * Gets a layout using its unique ID. If such a layout doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -129067,12 +129068,12 @@ declare namespace PowerPoint { * @remarks * [Api set: PowerPointApi 1.3] * - * @param key The unique ID of a tag, which is unique within this `TagCollection`. 'key' parameter is case-insensitive, but it is always capitalized when saved in the document. + * @param key The unique ID of a tag, which is unique within this `TagCollection`. 'key' parameter is case-insensitive, but it's always capitalized when saved in the document. * @param value The value of the tag. */ add(key: string, value: string): void; /** - * Deletes the tag with the given `key` in this collection. Does nothing if the `key` does not exist. + * Deletes the tag with the given `key` in this collection. Does nothing if the `key` doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] @@ -129089,13 +129090,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a tag using its unique ID. An error is thrown if the tag does not exist. + * Gets a tag using its unique ID. An error is thrown if the tag doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the tag. - * @returns The tag with the unique ID. If such a tag does not exist, an error is thrown. + * @returns The tag with the unique ID. If such a tag doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Tag; /** @@ -129109,13 +129110,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Tag; /** - * Gets a tag using its unique ID. If such a tag does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a tag using its unique ID. If such a tag doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.3] * * @param key The ID of the tag. - * @returns The tag with the unique ID. If such a tag does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The tag with the unique ID. If such a tag doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(key: string): PowerPoint.Tag; /** @@ -129217,7 +129218,7 @@ declare namespace PowerPoint { */ applyLayout(slideLayout: PowerPoint.SlideLayout): void; /** - * Deletes the slide from the presentation. Does nothing if the slide does not exist. + * Deletes the slide from the presentation. Does nothing if the slide doesn't exist. * * @remarks * [Api set: PowerPointApi 1.2] @@ -129307,13 +129308,13 @@ declare namespace PowerPoint { */ getCount(): OfficeExtension.ClientResult; /** - * Gets a shape using its unique ID. An error is thrown if the shape does not exist. + * Gets a shape using its unique ID. An error is thrown if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.5] * * @param key The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an error is thrown. + * @returns The shape with the unique ID. If such a shape doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Shape; /** @@ -129327,13 +129328,13 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Shape; /** - * Gets a shape using its unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a shape using its unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] * * @param id The ID of the shape. - * @returns The shape with the unique ID. If such a shape does not exist, an object with an `isNullObject` property set to true is returned. + * @returns The shape with the unique ID. If such a shape doesn't exist, an object with an `isNullObject` property set to true is returned. */ getItemOrNullObject(id: string): PowerPoint.Shape; /** @@ -129488,14 +129489,14 @@ declare namespace PowerPoint { */ color: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@linkPowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -129516,7 +129517,7 @@ declare namespace PowerPoint { */ visible: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -130055,49 +130056,49 @@ declare namespace PowerPoint { */ readonly zOrderPosition: number; /** - * Deletes the shape from the shape collection. Does nothing if the shape does not exist. + * Deletes the shape from the shape collection. Does nothing if the shape doesn't exist. * * @remarks * [Api set: PowerPointApi 1.3] */ delete(): void; /** - * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. Throws an exception if this shape does not belong to a `Slide`. + * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `Slide`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlide(): PowerPoint.Slide; /** - * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. Throws an exception if this shape does not belong to a `SlideLayout`. + * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `SlideLayout`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideLayout(): PowerPoint.SlideLayout; /** - * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. If this shape does not belong to a `SlideLayout`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.SlideLayout} object that holds this `Shape`. If this shape doesn't belong to a `SlideLayout`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideLayoutOrNullObject(): PowerPoint.SlideLayout; /** - * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. Throws an exception if this shape does not belong to a `SlideMaster`. + * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. Throws an exception if this shape doesn't belong to a `SlideMaster`. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideMaster(): PowerPoint.SlideMaster; /** - * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. If this shape does not belong to a `SlideMaster`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.SlideMaster} object that holds this `Shape`. If this shape doesn't belong to a `SlideMaster`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] */ getParentSlideMasterOrNullObject(): PowerPoint.SlideMaster; /** - * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. If this shape does not belong to a `Slide`, an object with an `isNullObject` property set to `true` is returned. + * Returns the parent {@link PowerPoint.Slide} object that holds this `Shape`. If this shape doesn't belong to a `Slide`, an object with an `isNullObject` property set to `true` is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks * [Api set: PowerPointApi 1.5] @@ -130186,7 +130187,7 @@ declare namespace PowerPoint { */ delete(): void; /** - * Returns the shape represented by the binding. Will throw an error if the binding is not of the correct type. + * Returns the shape represented by the binding. Will throw an error if the binding isn't of the correct type. * * @remarks * [Api set: PowerPointApi 1.8] @@ -130672,8 +130673,8 @@ declare namespace PowerPoint { /** * Specifies the slides from the source presentation that will be inserted into the current presentation. These slides are represented by their IDs which can be retrieved from a `Slide` object. The order of these slides is preserved during the insertion. - If any of the source slides are not found, or if the IDs are invalid, the operation throws a `SlideNotFound` exception and no slides will be inserted. - All of the source slides will be inserted when `sourceSlideIds` is not provided (this is the default behavior). + If any of the source slides aren't found, or if the IDs are invalid, the operation throws a `SlideNotFound` exception and no slides will be inserted. + All of the source slides will be inserted when `sourceSlideIds` isn't provided (this is the default behavior). * * @remarks * [Api set: PowerPointApi 1.2] @@ -130681,8 +130682,8 @@ declare namespace PowerPoint { sourceSlideIds?: string[]; /** * Specifies where in the presentation the new slides will be inserted. The new slides will be inserted after the slide with the given slide ID. - If `targetSlideId` is not provided, the slides will be inserted at the beginning of the presentation. - If `targetSlideId` is invalid or if it is pointing to a non-existing slide, the operation throws a `SlideNotFound` exception and no slides will be inserted. + If `targetSlideId` isn't provided, the slides will be inserted at the beginning of the presentation. + If `targetSlideId` is invalid or if it's pointing to a non-existing slide, the operation throws a `SlideNotFound` exception and no slides will be inserted. * * @remarks * [Api set: PowerPointApi 1.2] @@ -130724,7 +130725,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.2] * * @param key The ID of the slide. - * @returns The slide with the unique ID. If such a slide does not exist, an error is thrown. + * @returns The slide with the unique ID. If such a slide doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Slide; /** @@ -130739,7 +130740,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Slide; /** - * Gets a slide using its unique ID. If such a slide does not exist, an object with an `isNullObject` property set to true is returned. For further information, see + * Gets a slide using its unique ID. If such a slide doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -130799,7 +130800,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.5] * * @param key The ID of the slide. - * @returns The slide with the unique ID. If such a slide does not exist, an error is thrown. + * @returns The slide with the unique ID. If such a slide doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.Slide; /** @@ -130813,7 +130814,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.Slide; /** - * Gets a slide using its unique ID. If such a slide does not exist, an object with an `isNullObject` property set to true is returned. For further information, see + * Gets a slide using its unique ID. If such a slide doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -130873,7 +130874,7 @@ declare namespace PowerPoint { * [Api set: PowerPointApi 1.3] * * @param key The ID of the Slide Master. - * @returns The Slide Master with the unique ID. If such a Slide Master does not exist, an error is thrown. + * @returns The Slide Master with the unique ID. If such a Slide Master doesn't exist, an error is thrown. */ getItem(key: string): PowerPoint.SlideMaster; /** @@ -130887,7 +130888,7 @@ declare namespace PowerPoint { */ getItemAt(index: number): PowerPoint.SlideMaster; /** - * Gets a Slide Master using its unique ID. If such a Slide Master does not exist, an object with an `isNullObject` property set to true is returned. + * Gets a Slide Master using its unique ID. If such a Slide Master doesn't exist, an object with an `isNullObject` property set to true is returned. For further information, see {@link https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties | *OrNullObject methods and properties}. * * @remarks @@ -130977,7 +130978,7 @@ declare namespace PowerPoint { */ foregroundColor?: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131046,7 +131047,7 @@ declare namespace PowerPoint { */ italic?: boolean | null; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131169,14 +131170,14 @@ declare namespace PowerPoint { */ color?: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131197,7 +131198,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131522,7 +131523,7 @@ declare namespace PowerPoint { */ foregroundColor?: string; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131598,7 +131599,7 @@ declare namespace PowerPoint { */ italic?: boolean | null; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131850,14 +131851,14 @@ declare namespace PowerPoint { */ color?: string; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -131878,7 +131879,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] @@ -132408,7 +132409,7 @@ declare namespace PowerPoint { */ foregroundColor?: boolean; /** - * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. + * Specifies the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns `null` if the shape type doesn't support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * @remarks * [Api set: PowerPointApi 1.4] @@ -132493,7 +132494,7 @@ declare namespace PowerPoint { */ italic?: boolean; /** - * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. + * Specifies the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. Returns `null` if the `TextRange` contains text fragments with different font names. * * @remarks * [Api set: PowerPointApi 1.4] @@ -133180,14 +133181,14 @@ declare namespace PowerPoint { */ color?: boolean; /** - * Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details. + * Represents the dash style of the line. Returns null when the line isn't visible or there are inconsistent dash styles. See {@link PowerPoint.ShapeLineDashStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] */ dashStyle?: boolean; /** - * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line isn't visible or there are inconsistent styles. See {@link PowerPoint.ShapeLineStyle} for details. * * @remarks * [Api set: PowerPointApi 1.4] @@ -133208,7 +133209,7 @@ declare namespace PowerPoint { */ visible?: boolean; /** - * Represents the weight of the line, in points. Returns `null` when the line is not visible or there are inconsistent line weights. + * Represents the weight of the line, in points. Returns `null` when the line isn't visible or there are inconsistent line weights. * * @remarks * [Api set: PowerPointApi 1.4] diff --git a/types/oidc-provider/index.d.ts b/types/oidc-provider/index.d.ts index 83c4d63f0a248b..3bdd634682569d 100644 --- a/types/oidc-provider/index.d.ts +++ b/types/oidc-provider/index.d.ts @@ -1,13 +1,11 @@ import * as crypto from "node:crypto"; import * as dns from "node:dns"; -import * as events from "node:events"; import * as http from "node:http"; import * as http2 from "node:http2"; import * as https from "node:https"; -import * as url from "node:url"; import KeyGrip = require("keygrip"); -import * as Koa from "koa"; +import Koa = require("koa"); export {}; @@ -18,7 +16,7 @@ export type FindAccount = ( token?: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest, ) => CanBePromise; export type TokenFormat = "opaque" | "jwt"; -export type FapiProfile = "1.0 ID2" | "1.0 Final" | "2.0"; +export type FapiProfile = "1.0 Final" | "2.0"; export type TTLFunction = (ctx: KoaContextWithOIDC, token: T, client: Client) => number; @@ -49,7 +47,7 @@ export interface JWK { } export interface JWKS { - keys: JWK[]; + keys: Array; } export interface AllClientMetadata { @@ -97,7 +95,6 @@ export interface AllClientMetadata { request_object_signing_alg?: SigningAlgorithmWithNone | undefined; request_object_encryption_alg?: EncryptionAlgValues | undefined; request_object_encryption_enc?: EncryptionEncValues | undefined; - request_uris?: string[] | undefined; id_token_encrypted_response_alg?: EncryptionAlgValues | undefined; id_token_encrypted_response_enc?: EncryptionEncValues | undefined; userinfo_encrypted_response_alg?: EncryptionAlgValues | undefined; @@ -106,6 +103,7 @@ export interface AllClientMetadata { authorization_encrypted_response_alg?: EncryptionAlgValues | undefined; authorization_encrypted_response_enc?: EncryptionEncValues | undefined; tls_client_certificate_bound_access_tokens?: boolean | undefined; + use_mtls_endpoint_aliases?: boolean | undefined; require_signed_request_object?: boolean | undefined; require_pushed_authorization_requests?: boolean | undefined; @@ -130,7 +128,6 @@ export type ResponseType = | "code token" | "code id_token token" | "none"; -export type PKCEMethods = "S256" | "plain"; export type CIBADeliveryMode = "poll" | "ping"; export type SubjectTypes = "public" | "pairwise"; export type ClientAuthMethod = @@ -608,7 +605,6 @@ declare class Client { responseModeAllowed(type: string, responseType: ResponseType, fapiProfile: FapiProfile | undefined): boolean; grantTypeAllowed(type: string): boolean; redirectUriAllowed(redirectUri: string): boolean; - requestUriAllowed(requestUri: string): boolean; postLogoutRedirectUriAllowed(postLogoutRedirectUri: string): boolean; includeSid(): boolean; compareClientSecret(actual: string): CanBePromise; @@ -664,7 +660,6 @@ declare class Client { readonly requestObjectSigningAlg?: string | undefined; readonly requestObjectEncryptionAlg?: string | undefined; readonly requestObjectEncryptionEnc?: string | undefined; - readonly requestUris?: string[] | undefined; readonly idTokenEncryptedResponseAlg?: string | undefined; readonly idTokenEncryptedResponseEnc?: string | undefined; readonly userinfoEncryptedResponseAlg?: string | undefined; @@ -991,6 +986,8 @@ export interface Configuration { discovery?: UnknownObject | undefined; + enableHttpPostMethods?: boolean | undefined; + extraParams?: string[] | { [param: string]: | null @@ -1122,11 +1119,14 @@ export interface Configuration { requestObjects?: | { - request?: boolean | undefined; - requestUri?: boolean | undefined; - requireUriRegistration?: boolean | undefined; + enabled?: boolean | undefined; requireSignedRequestObject?: boolean | undefined; - mode?: "lax" | "strict" | undefined; + assertJwtClaimsAndHeader?: ( + ctx: KoaContextWithOIDC, + claims: Record, + header: Record, + client: Client, + ) => CanBePromise; } | undefined; @@ -1266,6 +1266,27 @@ export interface Configuration { | undefined; } | undefined; + + richAuthorizationRequests?: { + enabled?: boolean | undefined; + ack?: string | undefined; + /* experimental features are mostly explicit any */ + [key: string]: any; + } | undefined; + + rpMetadataChoices?: { + enabled?: boolean | undefined; + ack?: string | undefined; + /* experimental features are mostly explicit any */ + [key: string]: any; + } | undefined; + + externalSigningSupport?: { + enabled?: boolean | undefined; + ack?: string | undefined; + /* experimental features are mostly explicit any */ + [key: string]: any; + } | undefined; } | undefined; @@ -1273,7 +1294,7 @@ export interface Configuration { | ((ctx: KoaContextWithOIDC, token: AccessToken | ClientCredentials) => CanBePromise) | undefined; - httpOptions?: ((url: url.URL) => HttpOptions) | undefined; + fetch?: typeof fetch; expiresWithSession?: | ((ctx: KoaContextWithOIDC, token: AccessToken | AuthorizationCode | DeviceCode) => CanBePromise) @@ -1295,7 +1316,6 @@ export interface Configuration { pkce?: | { - methods?: PKCEMethods[] | undefined; required?: ((ctx: KoaContextWithOIDC, client: Client) => boolean) | undefined; } | undefined; @@ -1418,14 +1438,14 @@ export type AsymmetricSigningAlgorithm = | "PS256" | "PS384" | "PS512" + | "Ed25519" | "ES256" - | "ES256K" | "ES384" | "ES512" - | "EdDSA" | "RS256" | "RS384" - | "RS512"; + | "RS512" + | "EdDSA"; export type SymmetricSigningAlgorithm = "HS256" | "HS384" | "HS512"; export type SigningAlgorithm = AsymmetricSigningAlgorithm | SymmetricSigningAlgorithm; export type SigningAlgorithmWithNone = AsymmetricSigningAlgorithm | SymmetricSigningAlgorithm; @@ -1475,15 +1495,17 @@ export interface InteractionResults { [key: string]: unknown; } -export default class Provider extends events.EventEmitter { +export default class Provider extends Koa { constructor(issuer: string, configuration?: Configuration); readonly issuer: string; + + /** + * @deprecated + */ readonly app: Koa; - proxy?: Koa["proxy"] | undefined; - listen: Koa["listen"]; - callback: Koa["callback"]; + get ctx(): KoaContextWithOIDC | undefined; backchannelResult( request: BackchannelAuthenticationRequest | string, @@ -1516,10 +1538,8 @@ export default class Provider extends events.EventEmitter { params?: string | string[] | Set, duplicates?: string | string[] | Set, ): void; - use: Koa["use"]; // tslint:disable:unified-signatures - addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "access_token.destroyed", listener: (accessToken: AccessToken) => void): this; addListener(event: "access_token.saved", listener: (accessToken: AccessToken) => void): this; addListener(event: "access_token.issued", listener: (accessToken: AccessToken) => void): this; @@ -1644,7 +1664,6 @@ export default class Provider extends events.EventEmitter { ): this; addListener(event: "server_error", listener: (ctx: KoaContextWithOIDC, err: Error) => void): this; - on(event: string, listener: (...args: any[]) => void): this; on(event: "access_token.destroyed", listener: (accessToken: AccessToken) => void): this; on(event: "access_token.saved", listener: (accessToken: AccessToken) => void): this; on(event: "access_token.issued", listener: (accessToken: AccessToken) => void): this; @@ -1736,7 +1755,6 @@ export default class Provider extends events.EventEmitter { on(event: "revocation.error", listener: (ctx: KoaContextWithOIDC, err: errors.OIDCProviderError) => void): this; on(event: "server_error", listener: (ctx: KoaContextWithOIDC, err: Error) => void): this; - once(event: string, listener: (...args: any[]) => void): this; once(event: "access_token.destroyed", listener: (accessToken: AccessToken) => void): this; once(event: "access_token.saved", listener: (accessToken: AccessToken) => void): this; once(event: "access_token.issued", listener: (accessToken: AccessToken) => void): this; @@ -1834,7 +1852,6 @@ export default class Provider extends events.EventEmitter { once(event: "revocation.error", listener: (ctx: KoaContextWithOIDC, err: errors.OIDCProviderError) => void): this; once(event: "server_error", listener: (ctx: KoaContextWithOIDC, err: Error) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "access_token.destroyed", listener: (accessToken: AccessToken) => void): this; prependListener(event: "access_token.saved", listener: (accessToken: AccessToken) => void): this; prependListener(event: "access_token.issued", listener: (accessToken: AccessToken) => void): this; @@ -1980,7 +1997,6 @@ export default class Provider extends events.EventEmitter { ): this; prependListener(event: "server_error", listener: (ctx: KoaContextWithOIDC, err: Error) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "access_token.destroyed", listener: (accessToken: AccessToken) => void): this; prependOnceListener(event: "access_token.saved", listener: (accessToken: AccessToken) => void): this; prependOnceListener(event: "access_token.issued", listener: (accessToken: AccessToken) => void): this; @@ -2154,7 +2170,6 @@ export default class Provider extends events.EventEmitter { readonly DeviceCode: typeof DeviceCode; readonly BackchannelAuthenticationRequest: typeof BackchannelAuthenticationRequest; readonly BaseToken: typeof BaseToken; - readonly Account: { findAccount: FindAccount }; readonly IdToken: typeof IdToken; readonly ReplayDetection: typeof ReplayDetection; readonly OIDCContext: typeof OIDCContext; @@ -2347,4 +2362,23 @@ export namespace errors { } } +/* experimental features are mostly explicit any */ +export class ExternalSigningKey { + get alg(): string | undefined; + get crv(): string | undefined; + get e(): string | undefined; + get key_ops(): string[] | undefined; + get kid(): string | undefined; + get kty(): string; + get n(): string | undefined; + get use(): "sig"; + get x(): string | undefined; + get x5c(): string[] | undefined; + get y(): string | undefined; + + keyObject(): Promise | crypto.KeyObject; + + sign(data: Uint8Array): Promise | Uint8Array; +} + export { Provider }; diff --git a/types/oidc-provider/oidc-provider-tests.ts b/types/oidc-provider/oidc-provider-tests.ts index 270143a87c05c4..63a2364531e1bc 100644 --- a/types/oidc-provider/oidc-provider-tests.ts +++ b/types/oidc-provider/oidc-provider-tests.ts @@ -245,10 +245,8 @@ const provider = new oidc.Provider("https://op.example.com", { }, }, }, - httpOptions(url) { - url.searchParams.keys(); - const c = new AbortController(); - return { signal: c.signal, "user-agent": "foo" }; + fetch(...args) { + return globalThis.fetch(...args); }, async expiresWithSession( ctx: oidc.KoaContextWithOIDC, @@ -286,7 +284,6 @@ const provider = new oidc.Provider("https://op.example.com", { }, responseTypes: ["code", "code id_token", "none"], pkce: { - methods: ["plain", "S256"], required(ctx: oidc.KoaContextWithOIDC, client: oidc.Client) { ctx.oidc.issuer.substring(0); client.clientId.substring(0); @@ -484,10 +481,7 @@ const provider = new oidc.Provider("https://op.example.com", { }, }, requestObjects: { - request: false, - requestUri: false, - requireUriRegistration: false, - mode: "lax", + enabled: false, }, encryption: { enabled: false }, fapi: { enabled: false, profile: "1.0 Final" }, @@ -678,3 +672,31 @@ provider.OIDCContext.prototype.clientJwtAuthExpectedAudience = function clientJw ]); } catch (e) {} })(); + +{ + const kp = crypto.generateKeyPairSync("ed25519"); + class MyKey extends oidc.ExternalSigningKey implements oidc.ExternalSigningKey { + get alg() { + return "Ed25519"; + } + + sign(data: Uint8Array) { + return crypto.sign(undefined, data, kp.privateKey); + } + keyObject() { + return kp.publicKey; + } + } + + new Provider("", { + features: { + externalSigningSupport: { enabled: true, ack: "" }, + }, + jwks: { + keys: [ + {} as oidc.JWK, + new MyKey(), + ], + }, + }); +} diff --git a/types/oidc-provider/package.json b/types/oidc-provider/package.json index eba0f382b3bac4..af375b16cd24d7 100644 --- a/types/oidc-provider/package.json +++ b/types/oidc-provider/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/oidc-provider", - "version": "8.8.9999", + "version": "9.1.9999", "projects": [ "https://github.com/panva/node-oidc-provider" ], diff --git a/types/open-graph/package.json b/types/open-graph/package.json index 7c24b60fe1ff9e..24f3615bad71d6 100644 --- a/types/open-graph/package.json +++ b/types/open-graph/package.json @@ -6,7 +6,7 @@ "https://github.com/samholmes/node-open-graph" ], "dependencies": { - "@types/cheerio": "*" + "@types/cheerio": "<1" }, "devDependencies": { "@types/open-graph": "workspace:." diff --git a/types/parse-path/.npmignore b/types/parse-path/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/parse-path/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/parse-path/index.d.ts b/types/parse-path/index.d.ts deleted file mode 100644 index 900220f0723cd8..00000000000000 --- a/types/parse-path/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -declare namespace parsePath { - type Protocol = "http" | "https" | "ssh" | "file" | "git"; - - interface ParsedPath { - /** The url hash. */ - hash: string; - /** The url domain (including subdomain and port). */ - host: string; - /** The input url. */ - href: string; - /** - * @default '' - */ - password: string; - /** - * Whether the parsing failed or not. - */ - parse_failed: boolean; - /** The url pathname. */ - pathname: string; - /** - * The domain port. - * @default '' - */ - port: string; - /** The first protocol, `"ssh"` (if the url is a ssh url) or `"file"`. */ - protocol: Protocol; - /** An array with the url protocols (usually it has one element). */ - protocols: Protocol[]; - /** The url querystring, parsed as object. */ - query: Record; - /** The url domain (including subdomains). */ - resource: string; - /** The url querystring value. */ - search: string; - /** The authentication user (usually for ssh urls). */ - user: string; - } -} - -declare function parsePath(url: string): parsePath.ParsedPath; -export = parsePath; diff --git a/types/parse-path/package.json b/types/parse-path/package.json deleted file mode 100644 index 49ba76ec31ee60..00000000000000 --- a/types/parse-path/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/parse-path", - "version": "7.0.9999", - "projects": [ - "https://github.com/IonicaBizau/parse-path" - ], - "devDependencies": { - "@types/parse-path": "workspace:." - }, - "owners": [ - { - "name": "Florian Keller", - "githubUsername": "ffflorian" - } - ] -} diff --git a/types/parse-path/parse-path-tests.ts b/types/parse-path/parse-path-tests.ts deleted file mode 100644 index 6224990d790b2a..00000000000000 --- a/types/parse-path/parse-path-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import parsePath = require("parse-path"); - -const parsed = parsePath("http://domain.com/path/name?foo=bar&bar=42#some-hash"); -parsed.hash; // $ExpectType string -parsed.host; // $ExpectType string -parsed.href; // $ExpectType string -parsed.pathname; // $ExpectType string -parsed.password; // $ExpectType string -parsed.parse_failed; // $ExpectType boolean -parsed.port; // $ExpectType string -parsed.protocol; // $ExpectType Protocol -parsed.protocols; // $ExpectType Protocol[] -parsed.resource; // $ExpectType string -parsed.search; // $ExpectType string -parsed.user; // $ExpectType string -parsed.query; // $ExpectType Record -parsed.query.bar; // $ExpectType string diff --git a/types/parse-path/tsconfig.json b/types/parse-path/tsconfig.json deleted file mode 100644 index dd5e397efa4d5c..00000000000000 --- a/types/parse-path/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "parse-path-tests.ts" - ] -} diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 86aea0668e1fa8..5ff8086aadd445 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -25,9 +25,11 @@ export interface ClientConfig { keepAliveInitialDelayMillis?: number | undefined; idle_in_transaction_session_timeout?: number | undefined; application_name?: string | undefined; + fallback_application_name?: string | undefined; connectionTimeoutMillis?: number | undefined; types?: CustomTypesConfig | undefined; options?: string | undefined; + client_encoding?: string | undefined; } export type ConnectionConfig = ClientConfig; @@ -289,6 +291,7 @@ export class Client extends ClientBase { host: string; password?: string | undefined; ssl: boolean; + readonly connection: Connection; constructor(config?: string | ClientConfig); diff --git a/types/pg/package.json b/types/pg/package.json index c46b58ff3e7adb..23ecfc596b0667 100644 --- a/types/pg/package.json +++ b/types/pg/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/pg", - "version": "8.11.9999", + "version": "8.12.9999", "projects": [ "https://github.com/brianc/node-postgres" ], diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 4c3b0c9ef026a9..76a05da80c6f55 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -208,6 +208,12 @@ customTypeOverrides.setTypeParser(types.builtins.INT8, BigInt); const customCustomTypeOverrides = new TypeOverrides(customTypes); customTypeOverrides.setTypeParser(types.builtins.INT8, BigInt); +client.connection.once("rowDescription", () => { + console.log("client connection rowDescription event"); +}); +// @ts-expect-error – connection is readonly +client.connection = new Connection(); + // pg.Pool // https://node-postgres.com/apis/pool diff --git a/types/react-plotly.js/react-plotly.js-tests.tsx b/types/react-plotly.js/react-plotly.js-tests.tsx index b905ce843fb2c7..9283bbd43b2573 100644 --- a/types/react-plotly.js/react-plotly.js-tests.tsx +++ b/types/react-plotly.js/react-plotly.js-tests.tsx @@ -19,7 +19,7 @@ export class SimpleChartComponent extends React.PureComponent { }, { type: "bar", x: [1, 2, 3], y: [2, 5, 3] }, ]} - layout={{ width: 320, height: 240, title: "A Fancy Plot" }} + layout={{ width: 320, height: 240, title: { text: "A Fancy Plot" } }} /> ); } @@ -72,7 +72,7 @@ export class MinChartComponent extends React.PureComponent { }, { type: "bar", x: [1, 2, 3], y: [2, 5, 3] }, ]} - layout={{ width: 320, height: 240, title: "A Fancy Plot" }} + layout={{ width: 320, height: 240, title: { text: "A Fancy Plot" } }} /> ); } @@ -88,7 +88,7 @@ export const HoverPlot = () => { type: "scatter", }, ]} - layout={{ width: 320, height: 240, title: "A Fancy Plot" }} + layout={{ width: 320, height: 240, title: { text: "A Fancy Plot" } }} onHover={e => console.log(e)} onBeforeHover={e => Boolean(e.points[0].x === 1)} /> @@ -105,7 +105,7 @@ export const WebGLPlot = () => { type: "scattergl", }, ]} - layout={{ width: 320, height: 240, title: "A Fancy Plot" }} + layout={{ width: 320, height: 240, title: { text: "A Fancy Plot" } }} onHover={e => console.log(e)} onWebGlContextLost={() => console.log("WebGL context lost")} /> diff --git a/types/react-wait/package.json b/types/react-wait/package.json index 323eb0a85f97c9..36facdd747ea5d 100644 --- a/types/react-wait/package.json +++ b/types/react-wait/package.json @@ -15,10 +15,6 @@ { "name": "Ifiok Jr.", "githubUsername": "ifiokjr" - }, - { - "name": "Paweł Maciejewski", - "githubUsername": "pwlmaciejewski" } ] } diff --git a/types/readme-filename/package.json b/types/readme-filename/package.json index b37762d27b98d9..44de94b4196fde 100644 --- a/types/readme-filename/package.json +++ b/types/readme-filename/package.json @@ -8,10 +8,5 @@ "devDependencies": { "@types/readme-filename": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/safe-flat/.npmignore b/types/safe-flat/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/safe-flat/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/safe-flat/index.d.ts b/types/safe-flat/index.d.ts deleted file mode 100644 index beacdd44032477..00000000000000 --- a/types/safe-flat/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Flattens an object to one level deep. - * Optionally takes a custom delimiter, otherwise uses `.` by default. - * Circular references within the object will be replaced with `[Circular]`. - * - * @param object Object to flatten - * @param delimiter (Optional) Delimiter. - */ -export function flatten(a: Record, delimiter?: string): Record; - -/** - * Unflattens an object back to its original nested form. - * Optionally takes a custom delimiter, otherwise uses `.` by default. - * Circular references denoted by `[Circular]` are treated as strings. - * - * @param object Object to flatten - * @param delimiter (Optional) Delimiter. - */ -export function unflatten(object: Record, delimiter?: string): Record; diff --git a/types/safe-flat/package.json b/types/safe-flat/package.json deleted file mode 100644 index b5aa021e24e19e..00000000000000 --- a/types/safe-flat/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/safe-flat", - "version": "2.0.9999", - "projects": [ - "https://github.com/jessie-codes/safe-flat" - ], - "devDependencies": { - "@types/safe-flat": "workspace:." - }, - "owners": [ - { - "name": "GP", - "githubUsername": "paambaati" - } - ] -} diff --git a/types/safe-flat/safe-flat-tests.ts b/types/safe-flat/safe-flat-tests.ts deleted file mode 100644 index c5e678ba4eb680..00000000000000 --- a/types/safe-flat/safe-flat-tests.ts +++ /dev/null @@ -1,28 +0,0 @@ -import safeFlat = require("safe-flat"); - -const testObject = { - 0: true, - lol: null, - phew: 0, - yeah: ["ok", undefined, "yep", { - something: "something", - }], - zzz: { - ok: { - watch: "nay-nay", - }, - }, -}; - -const testFlattenedObject = { - 0: true, - lol: null, - phew: 0, - "yeah.0": "ok", - "yeah.2": "yep", - "yeah.3.something": "something", - "zzz.ok.watch": "nay-nay", -}; - -safeFlat.flatten(testObject); // $ExpectType Record -safeFlat.unflatten(testFlattenedObject); // $ExpectType Record diff --git a/types/sanitize-html/index.d.ts b/types/sanitize-html/index.d.ts index 93e07413445d7b..68066d27c82ea0 100644 --- a/types/sanitize-html/index.d.ts +++ b/types/sanitize-html/index.d.ts @@ -78,6 +78,8 @@ declare namespace sanitize { */ enforceHtmlBoundary?: boolean | undefined; nonBooleanAttributes?: string[]; + onOpenTag?: ((name: string, attribs: Attributes) => void) | undefined; + onCloseTag?: ((name: string, isImplied: boolean) => void) | undefined; } const defaults: IDefaults; diff --git a/types/sanitize-html/package.json b/types/sanitize-html/package.json index 7d071a7cbe85e9..6bfcd300afcbd3 100644 --- a/types/sanitize-html/package.json +++ b/types/sanitize-html/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/sanitize-html", - "version": "2.15.9999", + "version": "2.16.9999", "projects": [ "https://github.com/punkave/sanitize-html" ], diff --git a/types/sanitize-html/sanitize-html-tests.ts b/types/sanitize-html/sanitize-html-tests.ts index 50a761683cae88..d0e62cf7d4981d 100644 --- a/types/sanitize-html/sanitize-html-tests.ts +++ b/types/sanitize-html/sanitize-html-tests.ts @@ -45,6 +45,8 @@ const options: IOptions = { allowedScriptDomains: ["test.com"], allowedScriptHostnames: ["test.com"], nonBooleanAttributes: ["href"], + onOpenTag: (name: string, attribs: Attributes) => {}, + onCloseTag: (name: string, isImplied: boolean) => {}, }; sanitize.defaults.allowedAttributes; // $ExpectType Record diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index 9a3dc6c0def253..ea07c40b010266 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -50,7 +50,7 @@ declare namespace SinonChrome { } declare namespace SinonChrome.events { - interface Event extends chrome.events.Event { + interface Event extends chrome.events.Event<(...args: any) => void> { dispatch(...args: any[]): void; trigger(...args: any[]): void; triggerAsync(...args: any[]): void; diff --git a/types/stats.js/index.d.ts b/types/stats.js/index.d.ts index 8a9752f245528d..79b5cec4a8ac3d 100644 --- a/types/stats.js/index.d.ts +++ b/types/stats.js/index.d.ts @@ -1,17 +1,31 @@ declare class Stats { constructor(); + REVISION: number; dom: HTMLDivElement; + addPanel(panel: Stats.Panel): Stats.Panel; + /** * @param value 0:fps, 1: ms, 2: mb, 3+: custom */ showPanel(value: number): void; + begin(): void; end(): number; update(): void; - addPanel(panel: Stats.Panel): Stats.Panel; + // Backwards Compatibility + + /** + * @deprecated Use `dom` instead. + */ + domElement: HTMLDivElement; + + /** + * @deprecated Use `showPanel` instead. + */ + setMode(value: number): void; } declare namespace Stats { diff --git a/types/stringify-author/package.json b/types/stringify-author/package.json index 3449c82c77d440..9716db82708214 100644 --- a/types/stringify-author/package.json +++ b/types/stringify-author/package.json @@ -11,10 +11,5 @@ "devDependencies": { "@types/stringify-author": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/tablesorter/package.json b/types/tablesorter/package.json index bcc61d81b86c2a..e95d8eb0e2a51b 100644 --- a/types/tablesorter/package.json +++ b/types/tablesorter/package.json @@ -14,10 +14,5 @@ "devDependencies": { "@types/tablesorter": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/tdweb/package.json b/types/tdweb/package.json index bd93842354b03b..c36e078e37c3ab 100644 --- a/types/tdweb/package.json +++ b/types/tdweb/package.json @@ -8,10 +8,5 @@ "devDependencies": { "@types/tdweb": "workspace:." }, - "owners": [ - { - "name": "Alexander Krisko", - "githubUsername": "esindger" - } - ] + "owners": [] } diff --git a/types/express-slow-down/.npmignore b/types/thread-loader/.npmignore similarity index 100% rename from types/express-slow-down/.npmignore rename to types/thread-loader/.npmignore diff --git a/types/thread-loader/index.d.ts b/types/thread-loader/index.d.ts new file mode 100644 index 00000000000000..419dd610aeb491 --- /dev/null +++ b/types/thread-loader/index.d.ts @@ -0,0 +1,31 @@ +declare namespace ThreadLoader { + interface Options { + /** @default '' */ + name?: string | undefined; + + numberOfWorkers?: number | undefined; + + workerNodeArgs?: any[] | undefined; + + /** @default 20 */ + workerParallelJobs?: number | undefined; + + /** @default 500 */ + poolTimeout?: number | undefined; + + /** @default 200 */ + poolParallelJobs?: number | undefined; + + /** @default false */ + poolRespawn?: boolean | undefined; + } +} + +interface ThreadLoader { + pitch(): void; + warmup(options: ThreadLoader.Options, requires: string[]): void; +} + +declare const ThreadLoader: ThreadLoader; + +export = ThreadLoader; diff --git a/types/thread-loader/package.json b/types/thread-loader/package.json new file mode 100644 index 00000000000000..bc540163e410e9 --- /dev/null +++ b/types/thread-loader/package.json @@ -0,0 +1,17 @@ +{ + "private": true, + "name": "@types/thread-loader", + "version": "4.0.9999", + "projects": [ + "https://github.com/webpack-contrib/thread-loader" + ], + "devDependencies": { + "@types/thread-loader": "workspace:." + }, + "owners": [ + { + "name": "Jimmy Leung", + "githubUsername": "hkleungai" + } + ] +} diff --git a/types/thread-loader/thread-loader-tests.ts b/types/thread-loader/thread-loader-tests.ts new file mode 100644 index 00000000000000..da8594d6ba40a2 --- /dev/null +++ b/types/thread-loader/thread-loader-tests.ts @@ -0,0 +1,21 @@ +import { pitch, warmup } from "thread-loader"; + +// $ExpectType void +pitch(); + +// $ExpectType void +warmup({}, ["babel-loader", "babel-preset-env"]); + +// $ExpectType void +warmup( + { + name: "name", + numberOfWorkers: 1, + workerNodeArgs: ["--max-old-space-size=1024", "", null], + workerParallelJobs: 20, + poolTimeout: 500, + poolParallelJobs: 200, + poolRespawn: true, + }, + ["babel-loader", "babel-preset-env"], +); diff --git a/types/node-zendesk/tsconfig.json b/types/thread-loader/tsconfig.json similarity index 92% rename from types/node-zendesk/tsconfig.json rename to types/thread-loader/tsconfig.json index 6faa61e98d3581..eec8b4d0d9e4b7 100644 --- a/types/node-zendesk/tsconfig.json +++ b/types/thread-loader/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "node-zendesk-tests.ts" + "thread-loader-tests.ts" ] } diff --git a/types/v8-callsites/package.json b/types/v8-callsites/package.json index 07b71d963b4915..ed04da3fb2d618 100644 --- a/types/v8-callsites/package.json +++ b/types/v8-callsites/package.json @@ -11,10 +11,5 @@ "devDependencies": { "@types/v8-callsites": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/vinyl-fs/package.json b/types/vinyl-fs/package.json index 451cd283078625..e348e261904003 100644 --- a/types/vinyl-fs/package.json +++ b/types/vinyl-fs/package.json @@ -27,10 +27,6 @@ { "name": "TeamworkGuy2", "githubUsername": "TeamworkGuy2" - }, - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" } ] } diff --git a/types/webicon/package.json b/types/webicon/package.json index 276d1c16458758..5bebfa37c4bd58 100644 --- a/types/webicon/package.json +++ b/types/webicon/package.json @@ -9,10 +9,5 @@ "@types/jquery": "*", "@types/webicon": "workspace:." }, - "owners": [ - { - "name": "Manuel Thalmann", - "githubUsername": "manuth" - } - ] + "owners": [] } diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index f33d6bc8e080cb..de255ef0e36046 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1150,16 +1150,11 @@ declare namespace Xrm { * Gets an attribute matching attributeName. * @param T An Attribute type. * @param attributeNameOrIndex Name of the attribute. - * @returns The attribute. - */ - getAttribute(attributeNameOrIndex: string | number): T | null; - - /** - * Gets an attribute by name or index. - * @param attributeNameOrIndex Name of the attribute or the attribute index. * @returns The attribute or null if attribute does not exist. */ - getAttribute(attributeNameOrIndex: string | number): Attributes.Attribute | null; + getAttribute( + attributeNameOrIndex: string | number, + ): T | null; /** * Gets a collection of attributes using a delegate function or gets all attributes if delegateFunction is not provided. @@ -2610,10 +2605,15 @@ declare namespace Xrm { | OptionSetAttributeFormat | StringAttributeFormat; + /** + * Possible attribute values that can be set or retrieved from an attribute. + */ + type AttributeValues = string | number | number[] | boolean | Date | LookupValue[] | OptionSetValue; + /** * Interface for an Entity attribute. */ - interface Attribute { + interface Attribute { /** * Adds a handler to be called when the attribute's value is changed. * @param handler The function reference. diff --git a/types/xrm/xrm-tests.ts b/types/xrm/xrm-tests.ts index f45e734e20e46b..073651944d3670 100644 --- a/types/xrm/xrm-tests.ts +++ b/types/xrm/xrm-tests.ts @@ -759,6 +759,14 @@ function GetAll(context: Xrm.FormContext) { } } +function getPossibleAttributeValues(formContext: Xrm.FormContext) { + const attribute = formContext.getAttribute("statuscode"); + if (attribute === null) { + throw new Error("Attribute does not exist!"); + } + // $ExpectType AttributeValues | null + const values = attribute.getValue(); +} function testAttributeType(formContext: Xrm.FormContext) { const attribute = formContext.getAttribute("myattribute"); if (attribute === null) { diff --git a/types/yoga-layout/.npmignore b/types/yoga-layout/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/yoga-layout/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/yoga-layout/index.d.ts b/types/yoga-layout/index.d.ts deleted file mode 100644 index 7cc5e0c8dfb2ee..00000000000000 --- a/types/yoga-layout/index.d.ts +++ /dev/null @@ -1,419 +0,0 @@ -declare const ALIGN_AUTO: 0; -declare const ALIGN_COUNT: 8; -declare const ALIGN_FLEX_START: 1; -declare const ALIGN_CENTER: 2; -declare const ALIGN_FLEX_END: 3; -declare const ALIGN_STRETCH: 4; -declare const ALIGN_BASELINE: 5; -declare const ALIGN_SPACE_BETWEEN: 6; -declare const ALIGN_SPACE_AROUND: 7; -declare const DIMENSION_COUNT: 2; -declare const DIMENSION_WIDTH: 0; -declare const DIMENSION_HEIGHT: 1; -declare const DIRECTION_COUNT: 3; -declare const DIRECTION_INHERIT: 0; -declare const DIRECTION_LTR: 1; -declare const DIRECTION_RTL: 2; -declare const DISPLAY_COUNT: 2; -declare const DISPLAY_FLEX: 0; -declare const DISPLAY_NONE: 1; -declare const EDGE_COUNT: 9; -declare const EDGE_LEFT: 0; -declare const EDGE_TOP: 1; -declare const EDGE_RIGHT: 2; -declare const EDGE_BOTTOM: 3; -declare const EDGE_START: 4; -declare const EDGE_END: 5; -declare const EDGE_HORIZONTAL: 6; -declare const EDGE_VERTICAL: 7; -declare const EDGE_ALL: 8; -declare const EXPERIMENTAL_FEATURE_COUNT: 1; -declare const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0; -declare const FLEX_DIRECTION_COUNT: 4; -declare const FLEX_DIRECTION_COLUMN: 0; -declare const FLEX_DIRECTION_COLUMN_REVERSE: 1; -declare const FLEX_DIRECTION_ROW: 2; -declare const FLEX_DIRECTION_ROW_REVERSE: 3; -declare const JUSTIFY_COUNT: 6; -declare const JUSTIFY_FLEX_START: 0; -declare const JUSTIFY_CENTER: 1; -declare const JUSTIFY_FLEX_END: 2; -declare const JUSTIFY_SPACE_BETWEEN: 3; -declare const JUSTIFY_SPACE_AROUND: 4; -declare const JUSTIFY_SPACE_EVENLY: 5; -declare const LOG_LEVEL_COUNT: 6; -declare const LOG_LEVEL_ERROR: 0; -declare const LOG_LEVEL_WARN: 1; -declare const LOG_LEVEL_INFO: 2; -declare const LOG_LEVEL_DEBUG: 3; -declare const LOG_LEVEL_VERBOSE: 4; -declare const LOG_LEVEL_FATAL: 5; -declare const MEASURE_MODE_COUNT: 3; -declare const MEASURE_MODE_UNDEFINED: 0; -declare const MEASURE_MODE_EXACTLY: 1; -declare const MEASURE_MODE_AT_MOST: 2; -declare const NODE_TYPE_COUNT: 2; -declare const NODE_TYPE_DEFAULT: 0; -declare const NODE_TYPE_TEXT: 1; -declare const OVERFLOW_COUNT: 3; -declare const OVERFLOW_VISIBLE: 0; -declare const OVERFLOW_HIDDEN: 1; -declare const OVERFLOW_SCROLL: 2; -declare const POSITION_TYPE_COUNT: 2; -declare const POSITION_TYPE_RELATIVE: 0; -declare const POSITION_TYPE_ABSOLUTE: 1; -declare const PRINT_OPTIONS_COUNT: 3; -declare const PRINT_OPTIONS_LAYOUT: 1; -declare const PRINT_OPTIONS_STYLE: 2; -declare const PRINT_OPTIONS_CHILDREN: 4; -declare const UNIT_COUNT: 4; -declare const UNIT_UNDEFINED: 0; -declare const UNIT_POINT: 1; -declare const UNIT_PERCENT: 2; -declare const UNIT_AUTO: 3; -declare const WRAP_COUNT: 3; -declare const WRAP_NO_WRAP: 0; -declare const WRAP_WRAP: 1; -declare const WRAP_WRAP_REVERSE: 2; - -interface ConstantsStatic { - readonly ALIGN_AUTO: typeof ALIGN_AUTO; - readonly ALIGN_COUNT: typeof ALIGN_COUNT; - readonly ALIGN_FLEX_START: typeof ALIGN_FLEX_START; - readonly ALIGN_CENTER: typeof ALIGN_CENTER; - readonly ALIGN_FLEX_END: typeof ALIGN_FLEX_END; - readonly ALIGN_STRETCH: typeof ALIGN_STRETCH; - readonly ALIGN_BASELINE: typeof ALIGN_BASELINE; - readonly ALIGN_SPACE_BETWEEN: typeof ALIGN_SPACE_BETWEEN; - readonly ALIGN_SPACE_AROUND: typeof ALIGN_SPACE_AROUND; - readonly DIMENSION_COUNT: typeof DIMENSION_COUNT; - readonly DIMENSION_WIDTH: typeof DIMENSION_WIDTH; - readonly DIMENSION_HEIGHT: typeof DIMENSION_HEIGHT; - readonly DIRECTION_COUNT: typeof DIRECTION_COUNT; - readonly DIRECTION_INHERIT: typeof DIRECTION_INHERIT; - readonly DIRECTION_LTR: typeof DIRECTION_LTR; - readonly DIRECTION_RTL: typeof DIRECTION_RTL; - readonly DISPLAY_COUNT: typeof DISPLAY_COUNT; - readonly DISPLAY_FLEX: typeof DISPLAY_FLEX; - readonly DISPLAY_NONE: typeof DISPLAY_NONE; - readonly EDGE_COUNT: typeof EDGE_COUNT; - readonly EDGE_LEFT: typeof EDGE_LEFT; - readonly EDGE_TOP: typeof EDGE_TOP; - readonly EDGE_RIGHT: typeof EDGE_RIGHT; - readonly EDGE_BOTTOM: typeof EDGE_BOTTOM; - readonly EDGE_START: typeof EDGE_START; - readonly EDGE_END: typeof EDGE_END; - readonly EDGE_HORIZONTAL: typeof EDGE_HORIZONTAL; - readonly EDGE_VERTICAL: typeof EDGE_VERTICAL; - readonly EDGE_ALL: typeof EDGE_ALL; - readonly EXPERIMENTAL_FEATURE_COUNT: typeof EXPERIMENTAL_FEATURE_COUNT; - readonly EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; - readonly FLEX_DIRECTION_COUNT: typeof FLEX_DIRECTION_COUNT; - readonly FLEX_DIRECTION_COLUMN: typeof FLEX_DIRECTION_COLUMN; - readonly FLEX_DIRECTION_COLUMN_REVERSE: typeof FLEX_DIRECTION_COLUMN_REVERSE; - readonly FLEX_DIRECTION_ROW: typeof FLEX_DIRECTION_ROW; - readonly FLEX_DIRECTION_ROW_REVERSE: typeof FLEX_DIRECTION_ROW_REVERSE; - readonly JUSTIFY_COUNT: typeof JUSTIFY_COUNT; - readonly JUSTIFY_FLEX_START: typeof JUSTIFY_FLEX_START; - readonly JUSTIFY_CENTER: typeof JUSTIFY_CENTER; - readonly JUSTIFY_FLEX_END: typeof JUSTIFY_FLEX_END; - readonly JUSTIFY_SPACE_BETWEEN: typeof JUSTIFY_SPACE_BETWEEN; - readonly JUSTIFY_SPACE_AROUND: typeof JUSTIFY_SPACE_AROUND; - readonly JUSTIFY_SPACE_EVENLY: typeof JUSTIFY_SPACE_EVENLY; - readonly LOG_LEVEL_COUNT: typeof LOG_LEVEL_COUNT; - readonly LOG_LEVEL_ERROR: typeof LOG_LEVEL_ERROR; - readonly LOG_LEVEL_WARN: typeof LOG_LEVEL_WARN; - readonly LOG_LEVEL_INFO: typeof LOG_LEVEL_INFO; - readonly LOG_LEVEL_DEBUG: typeof LOG_LEVEL_DEBUG; - readonly LOG_LEVEL_VERBOSE: typeof LOG_LEVEL_VERBOSE; - readonly LOG_LEVEL_FATAL: typeof LOG_LEVEL_FATAL; - readonly MEASURE_MODE_COUNT: typeof MEASURE_MODE_COUNT; - readonly MEASURE_MODE_UNDEFINED: typeof MEASURE_MODE_UNDEFINED; - readonly MEASURE_MODE_EXACTLY: typeof MEASURE_MODE_EXACTLY; - readonly MEASURE_MODE_AT_MOST: typeof MEASURE_MODE_AT_MOST; - readonly NODE_TYPE_COUNT: typeof NODE_TYPE_COUNT; - readonly NODE_TYPE_DEFAULT: typeof NODE_TYPE_DEFAULT; - readonly NODE_TYPE_TEXT: typeof NODE_TYPE_TEXT; - readonly OVERFLOW_COUNT: typeof OVERFLOW_COUNT; - readonly OVERFLOW_VISIBLE: typeof OVERFLOW_VISIBLE; - readonly OVERFLOW_HIDDEN: typeof OVERFLOW_HIDDEN; - readonly OVERFLOW_SCROLL: typeof OVERFLOW_SCROLL; - readonly POSITION_TYPE_COUNT: typeof POSITION_TYPE_COUNT; - readonly POSITION_TYPE_RELATIVE: typeof POSITION_TYPE_RELATIVE; - readonly POSITION_TYPE_ABSOLUTE: typeof POSITION_TYPE_ABSOLUTE; - readonly PRINT_OPTIONS_COUNT: typeof PRINT_OPTIONS_COUNT; - readonly PRINT_OPTIONS_LAYOUT: typeof PRINT_OPTIONS_LAYOUT; - readonly PRINT_OPTIONS_STYLE: typeof PRINT_OPTIONS_STYLE; - readonly PRINT_OPTIONS_CHILDREN: typeof PRINT_OPTIONS_CHILDREN; - readonly UNIT_COUNT: typeof UNIT_COUNT; - readonly UNIT_UNDEFINED: typeof UNIT_UNDEFINED; - readonly UNIT_POINT: typeof UNIT_POINT; - readonly UNIT_PERCENT: typeof UNIT_PERCENT; - readonly UNIT_AUTO: typeof UNIT_AUTO; - readonly WRAP_COUNT: typeof WRAP_COUNT; - readonly WRAP_NO_WRAP: typeof WRAP_NO_WRAP; - readonly WRAP_WRAP: typeof WRAP_WRAP; - readonly WRAP_WRAP_REVERSE: typeof WRAP_WRAP_REVERSE; -} - -declare namespace Yoga { - type YogaJustifyContent = - | typeof JUSTIFY_CENTER - | typeof JUSTIFY_FLEX_END - | typeof JUSTIFY_FLEX_START - | typeof JUSTIFY_SPACE_AROUND - | typeof JUSTIFY_SPACE_BETWEEN - | typeof JUSTIFY_SPACE_EVENLY; - - type YogaAlign = - | typeof ALIGN_AUTO - | typeof ALIGN_BASELINE - | typeof ALIGN_CENTER - | typeof ALIGN_FLEX_END - | typeof ALIGN_FLEX_START - | typeof ALIGN_SPACE_AROUND - | typeof ALIGN_SPACE_BETWEEN - | typeof ALIGN_STRETCH; - - type YogaFlexDirection = - | typeof FLEX_DIRECTION_COLUMN - | typeof FLEX_DIRECTION_COLUMN_REVERSE - | typeof FLEX_DIRECTION_COUNT - | typeof FLEX_DIRECTION_ROW - | typeof FLEX_DIRECTION_ROW_REVERSE; - - type YogaDirection = - | typeof DIRECTION_INHERIT - | typeof DIRECTION_LTR - | typeof DIRECTION_RTL; - - type YogaFlexWrap = - | typeof WRAP_NO_WRAP - | typeof WRAP_WRAP - | typeof WRAP_WRAP_REVERSE; - - type YogaEdge = - | typeof EDGE_LEFT - | typeof EDGE_TOP - | typeof EDGE_RIGHT - | typeof EDGE_BOTTOM - | typeof EDGE_START - | typeof EDGE_END - | typeof EDGE_HORIZONTAL - | typeof EDGE_VERTICAL - | typeof EDGE_ALL; - - type YogaDisplay = - | typeof DISPLAY_FLEX - | typeof DISPLAY_NONE; - - type YogaUnit = - | typeof UNIT_AUTO - | typeof UNIT_PERCENT - | typeof UNIT_POINT - | typeof UNIT_UNDEFINED; - - type YogaOverflow = - | typeof OVERFLOW_HIDDEN - | typeof OVERFLOW_SCROLL - | typeof OVERFLOW_VISIBLE; - - type YogaPositionType = - | typeof POSITION_TYPE_ABSOLUTE - | typeof POSITION_TYPE_RELATIVE; - - type YogaExperimentalFeature = typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; - - type YogaMeasureMode = - | typeof MEASURE_MODE_COUNT - | typeof MEASURE_MODE_UNDEFINED - | typeof MEASURE_MODE_EXACTLY - | typeof MEASURE_MODE_AT_MOST; - - interface YogaNode { - calculateLayout( - width?: number, - height?: number, - direction?: YogaDirection, - ): void; - copyStyle(node: YogaNode): void; - free(): void; - freeRecursive(): void; - getAlignContent(): YogaAlign; - getAlignItems(): YogaAlign; - getAlignSelf(): YogaAlign; - getAspectRatio(): number; - getBorder(edge: YogaEdge): number; - getChild(index: number): YogaNode; - getChildCount(): number; - getComputedBorder(edge: YogaEdge): number; - getComputedBottom(): number; - getComputedHeight(): number; - getComputedLayout(): Layout; - getComputedLeft(): number; - getComputedMargin(edge: YogaEdge): number; - getComputedPadding(edge: YogaEdge): number; - getComputedRight(): number; - getComputedTop(): number; - getComputedWidth(): number; - getDisplay(): YogaDisplay; - getFlexBasis(): number; - getFlexDirection(): YogaFlexDirection; - getFlexGrow(): number; - getFlexShrink(): number; - getFlexWrap(): YogaFlexWrap; - getHeight(): Value; - getJustifyContent(): YogaJustifyContent; - getMargin(edge: YogaEdge): Value; - getMaxHeight(): Value; - getMaxWidth(): Value; - getMinHeight(): Value; - getMinWidth(): Value; - getOverflow(): YogaOverflow; - getPadding(edge: YogaEdge): Value; - getParent(): YogaNode | null; - getPosition(edge: YogaEdge): Value; - getPositionType(): YogaPositionType; - getWidth(): Value; - insertChild(child: YogaNode, index: number): void; - isDirty(): boolean; - markDirty(): void; - removeChild(child: YogaNode): void; - reset(): void; - setAlignContent(alignContent: YogaAlign): void; - setAlignItems(alignItems: YogaAlign): void; - setAlignSelf(alignSelf: YogaAlign): void; - setAspectRatio(aspectRatio: number): void; - setBorder(edge: YogaEdge, borderWidth: number): void; - setDisplay(display: YogaDisplay): void; - setFlex(flex: number): void; - setFlexBasis(flexBasis: number | string): void; - setFlexBasisPercent(flexBasis: number): void; - setFlexDirection(flexDirection: YogaFlexDirection): void; - setFlexGrow(flexGrow: number): void; - setFlexShrink(flexShrink: number): void; - setFlexWrap(flexWrap: YogaFlexWrap): void; - setHeight(height: number | string): void; - setHeightAuto(): void; - setHeightPercent(height: number): void; - setJustifyContent(justifyContent: YogaJustifyContent): void; - setMargin(edge: YogaEdge, margin: number | string): void; - setMarginAuto(edge: YogaEdge): void; - setMarginPercent(edge: YogaEdge, margin: number): void; - setMaxHeight(maxHeight: number | string): void; - setMaxHeightPercent(maxHeight: number): void; - setMaxWidth(maxWidth: number | string): void; - setMaxWidthPercent(maxWidth: number): void; - setMeasureFunc( - measureFunc: ( - width: number, - widthMeasureMode: YogaMeasureMode, - height: number, - heightMeasureMode: YogaMeasureMode, - ) => { - width?: number | undefined; - height?: number | undefined; - } | null, - ): void; - setMinHeight(minHeight: number | string): void; - setMinHeightPercent(minHeight: number): void; - setMinWidth(minWidth: number | string): void; - setMinWidthPercent(minWidth: number): void; - setOverflow(overflow: YogaOverflow): void; - setPadding(edge: YogaEdge, padding: number | string): void; - setPaddingPercent(edge: YogaEdge, padding: number): void; - setPosition(edge: YogaEdge, position: number | string): void; - setPositionPercent(edge: YogaEdge, position: number): void; - setPositionType(positionType: YogaPositionType): void; - setWidth(width: number | string): void; - setWidthAuto(): void; - setWidthPercent(width: number): void; - unsetMeasureFunc(): void; - } - - interface YogaConfig { - isExperimentalFeatureEnabled(feature: YogaExperimentalFeature): boolean; - setExperimentalFeatureEnabled( - feature: YogaExperimentalFeature, - enabled: boolean, - ): void; - setPointScaleFactor(factor: number): void; - } -} - -declare class Layout { - readonly left: number; - readonly right: number; - readonly top: number; - readonly bottom: number; - readonly width: number; - readonly height: number; - constructor( - left: number, - right: number, - top: number, - bottom: number, - width: number, - height: number, - ); - - fromJs( - expose: ( - left: number, - right: number, - top: number, - bottom: number, - width: number, - height: number, - ) => any, - ): void; - - toString(): string; -} - -declare class Size { - static fromJS(dim: { width: number; height: number }): Size; - - readonly width: number; - readonly height: number; - - constructor(width: number, height: number); - - fromJS(expose: (width: number, height: number) => any): void; - - toString(): string; -} - -declare class Value { - readonly unit: Yoga.YogaUnit | number; - readonly value: number; - - constructor(unit: Yoga.YogaUnit | number, value: number); - - fromJS(expose: (unit: Yoga.YogaUnit | number, value: number) => any): void; - - toString(): string; - valueOf(): number; -} - -interface NodeStatic { - create(): Yoga.YogaNode; - createDefault(): Yoga.YogaNode; - createWithConfig(config: Yoga.YogaConfig): Yoga.YogaNode; - destroy(node: Yoga.YogaNode): any; -} - -interface ConfigStatic { - create(): Yoga.YogaConfig; - destroy(config: Yoga.YogaConfig): any; -} - -interface YogaStatic extends ConstantsStatic { - Node: NodeStatic; - Config: ConfigStatic; - getInstanceCount(): number; -} - -declare const Yoga: YogaStatic; - -export = Yoga; diff --git a/types/yoga-layout/package.json b/types/yoga-layout/package.json deleted file mode 100644 index dc870d4fa40ec3..00000000000000 --- a/types/yoga-layout/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/yoga-layout", - "version": "1.9.9999", - "projects": [ - "https://github.com/facebook/yoga#readme" - ], - "devDependencies": { - "@types/yoga-layout": "workspace:." - }, - "owners": [ - { - "name": "tnobody", - "githubUsername": "tnobody" - } - ] -} diff --git a/types/yoga-layout/tsconfig.json b/types/yoga-layout/tsconfig.json deleted file mode 100644 index 8051a8a2e148fe..00000000000000 --- a/types/yoga-layout/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "strictFunctionTypes": true, - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "yoga-layout-tests.ts" - ] -} diff --git a/types/yoga-layout/yoga-layout-tests.ts b/types/yoga-layout/yoga-layout-tests.ts deleted file mode 100644 index 26cf897547d918..00000000000000 --- a/types/yoga-layout/yoga-layout-tests.ts +++ /dev/null @@ -1,35 +0,0 @@ -import yoga = require("yoga-layout"); -const { Node, Config, DISPLAY_FLEX } = yoga; - -const cfg = Config.create(); - -cfg.isExperimentalFeatureEnabled(yoga.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS); - -const root = Node.createWithConfig(cfg); -root.setWidth(500); -root.setHeight(300); -root.setJustifyContent(yoga.JUSTIFY_CENTER); - -const node1 = yoga.Node.create(); -node1.setWidth(100); -node1.setHeight(100); -node1.setDisplay(DISPLAY_FLEX); - -const node2 = Node.create(); -node2.setMeasureFunc(( - _width: number, - _widthMeasureMode: yoga.YogaMeasureMode, - _height: number, - _heightMeasureMode: yoga.YogaMeasureMode, -) => ({ - width: 100, - height: 100, -})); -node2.unsetMeasureFunc(); -node2.setWidth(100); -node2.setHeight(100); - -root.insertChild(node1, 0); -root.insertChild(node2, 1); - -root.calculateLayout(500, 300, yoga.DIRECTION_LTR);