Skip to content

Empty object type generates Record<string, never> #1004

@johnnymetz

Description

@johnnymetz

Description

Empty object type is incorrect.

Name Version
openapi-typescript 6.0.3
Node.js v18.11.0
OS + version macOS 12.5.1

Reproduction

I have the following field:

filters:
  type: object
  default: {}  # adding or removing this "default" field generates the same result

which currently generates the following typescript:

filters?: Record<string, never>;

Expected result

In version 5.4.1, it generated the following result:

filters?: { [key: string]: unknown };

In version 6+, I'd expect the following result:

filters?: Record<string, unknown>;

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions