Skip to content

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

Closed
@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