Skip to content

Nested immutable array schemas generate syntactically-invalid readonly readonly type #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
duncanbeevers opened this issue Aug 22, 2023 · 0 comments · Fixed by #1320
Closed
2 tasks done
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library

Comments

@duncanbeevers
Copy link
Contributor

Description

Nested immutable array schemas generate syntactically-invalid readonly readonly type.

const result = transformSchemaObject({
  type: "object",
  properties: {
    values: {
      type: "array",
      items: {
        type: "array",
        items: {
          type: "string",
        },
      },
    },
  },
})

expect(result).toBe(`{
  readonly values?: readonly (readonly string[])[];
}`, { ctx: { immutableTypes: true } })

/*
- Expected
+ Received

  {
-   readonly values?: readonly (readonly string[])[];
+   readonly values?: readonly readonly string[][];
  }
*/
Name Version
openapi-typescript 6.4.5
Node.js 18.16.1
OS + version macOS 13.5

Checklist

@duncanbeevers duncanbeevers added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant