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

TS 3 only - 'You cannot rename this element' - while renaming discriminated unions #26210

Closed
smith-chris opened this issue Aug 4, 2018 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@smith-chris
Copy link

Appears on:

Doesn't appear on:

Exact commit to replicate it on (src/store/game.ts):
https://github.com/smith-chris/poke/tree/b77d0f78d2e3700bf45e5c7ab3a9a4055ae26cf5

I think video explains it best:
https://vimeo.com/283216196

I'm filing it in typescript repo as the bug seems to be independent of VSCode version but dependent on TS version. I looked at last 30 days issues and didn't find related one.

I hope that's enough information. Big thanks for all the work on TypeScript! 👏 I'm loving it

Cheers,
Chris

TypeScript Version: 3.1.0-dev.201xxxxx

Search Terms:

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

@smith-chris smith-chris changed the title TS 3 only - rename symbol doesn't work for discriminated unions anymore TS 3 only - 'You cannot rename this element' - while renaming discriminated unions Aug 4, 2018
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 6, 2018
@RyanCavanaugh RyanCavanaugh assigned ghost Aug 6, 2018
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.1 milestone Aug 6, 2018
@ghost
Copy link

ghost commented Aug 6, 2018

This was changed in #24477 (fixing #16275).
The problem is that find-all-references on a string literal will find all occurrences of that string regardless of context. Semantic renaming of strings would probably require a string enum (usable today) or #1579. Currently, even if we allowed renaming strings it wouldn't be much better than a textual rename of "foo" (quotes included).

@ghost ghost modified the milestones: TypeScript 3.1, Future Aug 30, 2018
@ghost ghost added feature-request A request for a new feature and removed Bug A bug in TypeScript labels Aug 30, 2018
@ghost
Copy link

ghost commented Aug 30, 2018

Think we should wait until we have better plans for how to rename string literals in a way better than ctrl-F does.

@ghost
Copy link

ghost commented Aug 30, 2018

Related: #5602, #9257

@RyanCavanaugh RyanCavanaugh unassigned ghost Mar 7, 2019
@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed feature-request A request for a new feature labels Mar 7, 2019
@RyanCavanaugh RyanCavanaugh removed this from the Future milestone Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants