Skip to content

String literal rename doesn't work in switch/case statment #41923

@wclr

Description

@wclr

typescript next 4.2.0-dev20201210

There are other cases when string literal rename refactor (#39298) deosn't work

Example:

type Foo = 'donald' | 'joe' // allow to rename any of these values

// basic usage

const foo: Foo = 'joe '

// using string literal:

switch (foo) {
   case 'donald': ...
   case 'joe': ...
}

After literals rename:

Actual

type Foo = 'donald duck' | 'pizza joe' // allow me to rename any of these values

// basic usage

const foo: Foo = 'pizza joe ' // this works

// rename doesn't work

switch (foo) {
   case 'donald': ...
   case 'joe': ...
}

Expected:

// using string literal

// should rename here too

switch (foo) {
   case 'donald duck': ...
   case 'pizza joe': ...
}

Related:
#41489
#41922

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