Skip to content

@kubb/plugin-ts: Empty responses should not use unknown #1764

@stijnvanhulle

Description

@stijnvanhulle

Discussed in #1758

Originally posted by phenax June 19, 2025
I was expecting empty responses to use the type void instead of unknown. But since it doesn't I tried to use unknownType: 'void' to get around it but that introduces a bug when we use additionalProperties: true in schema. This generates the following invalid type that doesn't make much sense since [key: string]: void with prop won't compile and won't allow any additional properties:

export type Stuff = {
  prop?: string;
  [key: string]: void;
};

I think if we could have another similar emptyResponseType option (or something along those lines) that can be controlled separately, it would solve this problem. I would love to work on it if the approach makes sense!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions