Skip to content

[ts-5.5] Private aliases expanded in index and keyof types - 5.5 regression Β #58713

Closed
@dragomirtitian

Description

@dragomirtitian

πŸ”Ž Search Terms

type alias inlined regression 5.5

πŸ•— Version & Regression Information

  • This changed between versions 5.5.0-dev.20240514 and 5.5.0-dev.20240515

⏯ Playground Link

Workbench

πŸ’» Code

// @declaration: true

// @filename: a.ts
type O = {
    prop: string
    prop2: string
}

type I = {
    prop: string
}

export const fn = (v: O['prop'], o: Omit<O, keyof I>) => {};

// @filename: b.ts

import {fn} from './a'
export const f = fn;

πŸ™ Actual behavior

O['prop'] is written in declaration file as { prop: string; prop2: string; }[prop"]. And Omit<O, keyof I> is printed as Omit<{ prop: string; prop2: string; }, keyof { prop: string; }>

This is problematic especially if the type is a bigger as it balloon the size of the printed type and it may pull in references that were not previously used (causing new errors)

πŸ™‚ Expected behavior

O['prop'] is written in declaration file as string as O and Omit<O, keyof I> is printed as Omit<O, 'prop'> as in 5.4 since O and I can't be named

Additional information about the issue

No response

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