#27155·oxc

linter: false positive and wrong hint msg for the new typescript/no-generated-empty-object-type

Author: Mister-HopeCreated Sep 28, 2026Updated Sep 30, 2026
LabelsA-linter

What version of Oxlint are you using?

1.86.0

What happened?

Thanks for introducing this rule in oxc-project/oxc#26958 and oxc-project/tsgolint#1229.

The concept behind this rule is great, and detecting unintended empty/generated object types is definitely valuable. However, in practice, I ran into two major issues:

1. Inaccurate Diagnostic Message

The diagnostic currently states:

⚠ typescript(no-generated-empty-object-type): This type resolves to '{}', the empty object type. This was likely not intentional.

In TypeScript, {} does not represent a strict empty object—it represents any non-nullish value (as evidenced by const a: {} = 1; passing type-checking). A truly empty object type is typically expressed as Record<string, never> or Record<never, never>. The phrasing "the empty object type" for {} is misleading.

2. Too Many False Positives / Noise on Explicit Record<never, never>

The rule should ideally exempt explicitly written empty-object constructs like Record<never, never>.

When written explicitly, it is almost certainly intentional. For instance, in a Vue functional component definition where a component emits no events:

typescript
export interface IconBaseProps {
  name?: string;
  color?: string;
  ariaLabel?: string;
}

export const IconBase: FunctionalComponent<
  IconBaseProps,
  Record<never, never>, // Explicitly stating: no emits
  { default: RequiredSlot }
> = ({ name = "", color = "currentColor", ariaLabel }, { attrs, slots }) =>
  h(
    "svg",
    {
      xmlns: "http://www.w3.org/2000/svg",
      class: ["icon", `${name}-icon`],
      viewBox: "0 0 1024 1024",
      fill: color,
      "aria-label": ariaLabel ?? `${name} icon`,
      ...attrs,
    },
    slots.default(),
  );

IconBase.displayName = "IconBase";

Here, Record<never, never> deliberately indicates that the component has no emits. Triggering a diagnostic here produces significant noise—I had to disable the rule entirely across the project to avoid adding 10+ // oxlint-disable-next-line comments.

Could we consider:

  • Allowing/ignoring explicit Record<never, never> (and potentially Record<string, never>)?
  • Refining the diagnostic message to be clearer?

cc @camc314