Skip to content

String literal rename doesn't work in object unions #41489

Open
@aspirisen

Description

@aspirisen

TypeScript Version: 4.2.0-dev.20201109

Search Terms:
String literal rename

Code

type Actions = { type: 'one', payload: number } | { type: 'two', payload: boolean }
const q: Actions = { type: 'one', payload: 1 }

Expected behavior:
Renaming of values of 'type' fields should also rename the value in actual variable. For example if I rename 'one' in the type Actions TS should also rename the value of type field in q variable, and vice versa.

Actual behavior:
Looks like renaming doesn't start at all

Playground Link:
https://www.typescriptlang.org/play?ts=4.2.0-dev.20201109#code/C4TwDgpgBAggxsAlgewHYGcoF4oG8qiQBcUA5GhKQDRRgCGIANsnQCYmoCuAtgEYQAnKAF8oAHzwFwEEqWAB3ZNVoNmbEr2TJGEOqhEAoOGnTAoARxLwkJ7JMIyyFZfSYt2UAIwigA

Related Issues:
#5602
#39298

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbol

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions