Skip to content

typeof with identically named type and value causes invalid .d.ts output #58390

@ssalbdivad

Description

@ssalbdivad

🔎 Search Terms

type, value, .d.ts, circular, circularity, invalid, output, declaration

🕗 Version & Regression Information

  • This changed between versions 5.4 and 5.5

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.5.0-dev.20240501#code/KYDwDg9gTgLgBAYwgOwM7wCbFQqBLMGPFVOAXjgG8AoOOAMwggC44AiAIwEMo3qBfatVCRYcGAE8wwOFhz5CxNOXFTgEerOy4CREkA

💻 Code

export const descriptions = {
  foo: "bar"
}

export type descriptions = typeof descriptions

🙁 Actual behavior

Actual .d.ts output:

export declare const descriptions: typeof descriptions;
export type descriptions = typeof descriptions;

🙂 Expected behavior

Expected .d.ts output:

export declare const descriptions: {
    foo: string;
};
export type descriptions = typeof descriptions;

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions