Skip to content

Commit 11f5470

Browse files
authored
Merge pull request #3454 from hey-api/copilot/fix-redundant-index-signature
fix: index signature for `additionalProperties: {}` / `true` should be `unknown`, not a union of all property types
2 parents d11b8e8 + 96d87df commit 11f5470

138 files changed

Lines changed: 171 additions & 171 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
**plugin(@hey-api/typescript)**: simplify union types if a member is `unknown`

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-true/types.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type ClientOptions = {
66

77
export type Foo = {
88
foo: string;
9-
[key: string]: unknown | string;
9+
[key: string]: unknown;
1010
};
1111

1212
export type Bar = Foo & {
@@ -15,7 +15,7 @@ export type Bar = Foo & {
1515

1616
export type Baz = Foo & {
1717
bar: string;
18-
[key: string]: unknown | string;
18+
[key: string]: unknown;
1919
};
2020

2121
export type Qux = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/additional-properties-true/types.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type ClientOptions = {
66

77
export type Foo = {
88
foo: string;
9-
[key: string]: unknown | string;
9+
[key: string]: unknown;
1010
};
1111

1212
export type Bar = Foo & {
@@ -15,7 +15,7 @@ export type Bar = Foo & {
1515

1616
export type Baz = Foo & {
1717
bar: string;
18-
[key: string]: unknown | string;
18+
[key: string]: unknown;
1919
};
2020

2121
export type Qux = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@angular/common/default-class/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@angular/common/default/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type ModelWithAdditionalPropertiesEqTrue = {
703703
* This is a simple string property
704704
*/
705705
prop?: string;
706-
[key: string]: unknown | string | undefined;
706+
[key: string]: unknown;
707707
};
708708

709709
export type NestedAnyOfArraysNullable = {

0 commit comments

Comments
 (0)