Skip to content

fix(40320): Better errors when using properties/methods from newer versions of ECMAScript #40650

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 17 commits into from
Oct 2, 2020

Conversation

Vboivin
Copy link
Contributor

@Vboivin Vboivin commented Sep 19, 2020

Fixes #40320 and #40319

New Error Messages

Error message when properties/methods are missing due to lib configuration

  • Added a new error message when properties/methods from newer versions cannot be found because of the current lib configuration
  • New message template:
"Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the `lib` compiler option to '{2}' or later."

Error message when the name cannot be found due to lib configuration

  • Added new identifiers to the already existing function getCannotFindNameDiagnosticForName for es2017, es2018 and es2020:
    • SharedArrayBuffer, Atomics, AsyncIterable, AsyncIterableIterator, AsyncGenerator, AsyncGeneratorFunction, BigInt, BigInt64Array and BigUint64Array
  • Modified the message template to be able to pass the suggested lib configuration
  • New message template:
"Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to '{1}' or later."

Preview

new_error_messages

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 19, 2020
@Vboivin
Copy link
Contributor Author

Vboivin commented Sep 23, 2020

I think the PR is ready, do you see any major flaws in my solution @DanielRosenwasser

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.

I think this is very close to being ready! Let's keep iterating here.

@Vboivin
Copy link
Contributor Author

Vboivin commented Sep 24, 2020

I think this is very close to being ready! Let's keep iterating here.

I added your suggested changes, this might be the one, or it might need one more iteration. @DanielRosenwasser

@Vboivin
Copy link
Contributor Author

Vboivin commented Sep 28, 2020

Ready for review @DanielRosenwasser

@DanielRosenwasser
Copy link
Member

Looks like you'll need to update baselines.

@Vboivin
Copy link
Contributor Author

Vboivin commented Sep 29, 2020

Looks like you'll need to update baselines.

@DanielRosenwasser Thanks for all the extensive reviews!

I added the early bail-outs and updated the baselines to reflect the changes to the main upstream branch.

Is there some documentation for all the utility functions such as contains? It would be helpful for novice contributors like myself. If there isn't, I will take a deeper look at the utility files.

@sandersn sandersn added the For Backlog Bug PRs that fix a backlog bug label Sep 30, 2020
@typescript-bot typescript-bot removed the For Backlog Bug PRs that fix a backlog bug label Sep 30, 2020
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.

@sandersn @rbuckton can I get a second reviewer on this?

@RyanCavanaugh
Copy link
Member

These tests 😍

@DanielRosenwasser DanielRosenwasser merged commit 61aadc4 into microsoft:master Oct 2, 2020
@Vboivin Vboivin deleted the 40320 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 Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Better errors when using properties/methods from newer versions of ECMAScript
6 participants