Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wclr opened this issue Dec 10, 2020 · 0 comments
Open

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

wclr opened this issue Dec 10, 2020 · 0 comments
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Milestone

Comments

@wclr
Copy link

wclr commented Dec 10, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Projects
None yet
Development

No branches or pull requests

2 participants