From bbb0a0f96e6f91e7cdb3814c435ad9017c2b3224 Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Sun, 30 Apr 2023 17:57:51 +0000 Subject: [PATCH 1/2] docs: replace extend any with unknown for no-unnecessary-type-constraint rule --- .../docs/rules/no-unnecessary-type-constraint.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md index b8672d945d50..b52477cb8aeb 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -7,8 +7,8 @@ description: 'Disallow unnecessary constraints on generic types.' > See **https://typescript-eslint.io/rules/no-unnecessary-type-constraint** for documentation. Generic type parameters (``) in TypeScript may be "constrained" with an [`extends` keyword](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints). -When no `extends` is provided, type parameters default a constraint to `any`. -It is therefore redundant to `extend` from `any`. +When no `extends` is provided, type parameters default a constraint to `unknown`. +It is therefore redundant to `extend` from `unknown`. ## Examples @@ -19,8 +19,12 @@ It is therefore redundant to `extend` from `any`. ```ts interface FooAny {} +interface FooUnknown {} + type BarAny = {}; +type BarUnknown = {}; + class BazAny { quxAny() {} } From 13f8dc8eac737a5c5fec5a7a6603e45cd615f3d1 Mon Sep 17 00:00:00 2001 From: El Hadji Malick Seck Date: Sun, 28 May 2023 17:18:04 +0000 Subject: [PATCH 2/2] Update packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josh Goldberg ✨ --- .../eslint-plugin/docs/rules/no-unnecessary-type-constraint.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md index b52477cb8aeb..5fd0e70d6532 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -8,7 +8,7 @@ description: 'Disallow unnecessary constraints on generic types.' Generic type parameters (``) in TypeScript may be "constrained" with an [`extends` keyword](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints). When no `extends` is provided, type parameters default a constraint to `unknown`. -It is therefore redundant to `extend` from `unknown`. +It is therefore redundant to `extend` from `any` or `unknown`. ## Examples