Skip to content

fix(40322): bad completions for string literal type as indexed access type object #40424

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

Merged
merged 8 commits into from
Sep 9, 2020

Conversation

Vboivin
Copy link
Contributor

@Vboivin Vboivin commented Sep 8, 2020

Fixes #40322

let x: "/*foo*/"["bar"];

Added validation to prevent completion on a string literal when it is the object type.
The cursor at the marker foo will not have autocompletion.

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the master branch
  • You've successfully run gulp runtests locally
  • There are new or updated unit tests validating the change

@ghost
Copy link

ghost commented Sep 8, 2020

CLA assistant check
All CLA requirements met.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 8, 2020
@Vboivin Vboivin changed the title Issue 40322 fix(40322): bad completions for string literal type as indexed access type object Sep 8, 2020
@Vboivin
Copy link
Contributor Author

Vboivin commented Sep 8, 2020

@DanielRosenwasser here is the PR for #40322

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Use spaces after ifs
  2. You shouldn't need a type assertion to any anywhere.
  3. Just use an early bail-out to return undefined when you're in the wrong node.

@DanielRosenwasser DanielRosenwasser merged commit 96b0832 into microsoft:master Sep 9, 2020
@Vboivin Vboivin deleted the issue-40322 branch October 7, 2020 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad completions for string literal type as indexed access type object
3 participants