GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — More did-you-mean errors on classes in plain JS by sandersn · Pull Request #49827 · microsoft/TypeScript

Conversation

@sandersn

@sandersn Nathan Shively-Sanders (sandersn) commented Jul 7, 2022

Copy link
Copy Markdown
Member

Classes

  • that are declared with class declarations or expressions, but not
    constructor functions
  • and which have nothing in their heritage clauses

Now provide spelling suggestions on misspelled property accesses.

Because of JS support for assignment-as-declaration, it's still easy to mistakenly declare a property with a typo and not get any suggestions.

I'm not sure this is a great idea; I'm going to run user tests and see how they look.

Fixes #45479

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mjbvz and worstpractice reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@sandersn
More did-you-mean errors on classes in plain JS
c850390
Classes
- that are declared with class declarations or expressions, but not
  constructor functions
- and which have nothing in their heritage clauses

Now provide spelling suggestions on misspelled property accesses.

Because of JS support for assignment-as-declaration, it's still easy
to mistakenly declare a property with a typo and not get any
suggestions.
@sandersn

Nathan Shively-Sanders (sandersn) commented Jul 7, 2022

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) run dt
TypeScript Bot (@typescript-bot) user test this

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 7, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@sandersn), I've started to run the diff-based user code test suite on this PR at c850390. You can monitor the build here.

Update: The results are in!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 7, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@sandersn), I've started to run the parallelized Definitely Typed test suite on this PR at c850390. You can monitor the build here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn Nathan Shively-Sanders (sandersn) self-assigned this Jul 7, 2022
@sandersn
Nathan Shively-Sanders (sandersn) requested a review from Daniel Rosenwasser (DanielRosenwasser) July 7, 2022 17:17
@typescript-bot TypeScript Bot (typescript-bot) added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 7, 2022
@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 7, 2022

Copy link
Copy Markdown
Contributor

Nathan Shively-Sanders (@sandersn)
Great news! no new errors were found between main..refs/pull/49827/merge

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn
fix semicolon lint
1b72301
@sandersn

Nathan Shively-Sanders (sandersn) commented Jul 21, 2022

Copy link
Copy Markdown
Member Author

TODO: This should probably skip decorated classes too

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) mentioned this pull request Aug 25, 2022
TypeScript 4.9 Iteration Plan #50457
Closed
Nathan Shively-Sanders (sandersn) added 3 commits July 25, 2023 13:12
@sandersn
Merge branch 'main' into more-dym-plainjs-errors-on-classes
a647657
@sandersn
Post-merge update
19e4a47
@sandersn
Also exclude class with decorators
ce47269
Since decorators can introduce arbitrary properties
@sandersn

Nathan Shively-Sanders (sandersn) commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test top100
TypeScript Bot (@typescript-bot) user test this

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 26, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@sandersn), I've started to run the diff-based top-repos suite on this PR at ce47269. You can monitor the build here.

Update: The results are in!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 26, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@sandersn), I've started to run the diff-based user code test suite on this PR at ce47269. You can monitor the build here.

Update: The results are in!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn
Nathan Shively-Sanders (sandersn) requested a review from Andrew Branch (andrewbranch) July 26, 2023 16:43
@sandersn

Nathan Shively-Sanders (sandersn) commented Jul 26, 2023

Copy link
Copy Markdown
Member Author

I think this is ready to review, but unless I can think of a better way to test it, I don't want to put it in 5.2 beta; right now my testing plan is to have real people to use and complain if the errors are too much.

Any other ideas? I guess I could artificially turn this on for more file types, but I don't know of any good source of code with typos in it. Maybe I could download random npm packages.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Nathan Shively-Sanders (@sandersn) Here are the results of running the user test suite comparing main and refs/pull/49827/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

rxjs-src

/mnt/ts_downloads/rxjs-src/build.sh

  • [NEW] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-49827/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
  • [MISSING] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

andrewbranch
Andrew Branch (andrewbranch) approved these changes Jul 26, 2023
View reviewed changes

@andrewbranch Andrew Branch (andrewbranch) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This seems fairly conservative, and I can’t think of a great way to test it on real code, since typos tend to get fixed eventually.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Nathan Shively-Sanders (@sandersn) Here are the results of running the top-repos suite comparing main and refs/pull/49827/merge:

Everything looks good!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn

Nathan Shively-Sanders (sandersn) commented Jul 28, 2023

Copy link
Copy Markdown
Member Author

Yeah, I agree. I'll merge it when 5.3 development starts.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn
Merge branch 'main' into more-dym-plainjs-errors-on-classes
516e6e6
@sandersn

Nathan Shively-Sanders (sandersn) commented Sep 22, 2023

Copy link
Copy Markdown
Member Author

Later: Or, it turns out, just before it ends.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sandersn
Nathan Shively-Sanders (sandersn) merged commit 982f8be into main Sep 22, 2023
@sandersn
Nathan Shively-Sanders (sandersn) deleted the more-dym-plainjs-errors-on-classes branch September 22, 2023 23:12
Marcus Ording (snovader) pushed a commit to EG-A-S/TypeScript that referenced this pull request Sep 23, 2023
@sandersn @snovader
More did-you-mean errors on classes in plain JS (microsoft#49827)
56eebae
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@andrewbranch Andrew Branch (andrewbranch) andrewbranch approved these changes
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Awaiting requested review from DanielRosenwasser

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@sandersn Nathan Shively-Sanders (sandersn)

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

PR Backlog
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

No suggestion diagnostic for unchecked JS files in method from class

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@sandersn @typescript-bot @andrewbranch
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.