CARVIEW |
Select Language
HTTP/2 200
date: Wed, 23 Jul 2025 16:52:04 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/microsoft/TypeScript.git
etag: W/"7be90ce1eb0fe747fd013046e0be203a"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=kwx6GZvWQkq73olJ254B6dQCKbgYKHKpua%2B1WVJHN2FhHMRPXADp8kzCpaOKfgs3f3swClhv06v0QYAwZeYph%2F%2BWUOI4AGf%2B%2FIs5QiBXtcx3WrfAnqrJUSsAfeyT3E57ePpM%2FvCxfx4XtrhB95QOGsT7eK%2FHdvEMEHG2WvWmkqoxputr%2FbBSjPAanUGTOuaGvUQN8oxz6GTONdrY3RGXxWLcWqC%2B3yo1MHg1mucSTd6foJomsx%2BoFL%2BYhOhHA2WeZ3DRKoIMDnRg%2B6V%2F8nYaRA%3D%3D--ufdlwD2S4zpiHbjL--pRbjWsvZoZE%2BlyXBsf5HRg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.950271525.1753289522; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 16:52:02 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 16:52:02 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: D79C:35EBF4:EDD2A7:1191724:68811332
Issue "Cannot find name did-you-mean" errors as suggestions in plain … · microsoft/TypeScript@e53f19f · GitHub
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
Copy file name to clipboardExpand all lines: src/services/codefixes/fixSpelling.ts
Copy file name to clipboardExpand all lines: tests/baselines/reference/argumentsReferenceInConstructor3_Js.types
Copy file name to clipboardExpand all lines: tests/baselines/reference/jsObjectsMarkedAsOpenEnded.types
Copy file name to clipboard
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit e53f19f
authored
Issue "Cannot find name did-you-mean" errors as suggestions in plain JS (#44271)
* Always issue cannot find name did-you-mean error
This PR issues "cannot find ${name}, did you mean ${name}" errors for
identifiers and propery access expressions in JS files *without*
`// @ts-check` and without `// @ts-nocheck`. This brings some benefits of
Typescript's binder to all Javascript users, even those who haven't
opted into Typescript checking.
```js
export var inModule = 1
inmodule.toFixed() // errors on exports
function f() {
var locals = 2
locale.toFixed() // errors on locals
}
var object = {
spaaace: 3
}
object.spaaaace // error on read
object.spaace = 2 // error on write
object.fresh = 12 // OK, no spelling correction to offer
```
To disable the errors, add `// @ts-nocheck` to the file. To get the
normal checkJs experience, add `// @ts-check`.
== Why This Works ==
In a word: precision. This change has low recall — it misses lots
of correct errors that would be nice to show — but it has high
precision: almost all the errors it shows are correct. And they come
with a suggested correction.
Here are the ingredients:
1. For unchecked JS files, the compiler suppresses all errors except
two did-you-mean name resolution errors.
2. Did-you-mean spelling correction is already tuned for high
precision/low recall, and doesn't show many bogus errors even in JS.
3. For identifiers, the error is suppressed for suggestions from global files.
These are often DOM feature detection, for example.
4. For property accesses, the error is suppressed for suggestions from
other files, for the same reason.
5. For property accesses, the error is suppressed for `this` property
accesses because the compiler doesn't understand JS constructor
functions well enough.
In particular, it doesn't understand any inheritance patterns.
== Work Remaining ==
1. Code cleanup.
2. Fix a couple of failures in existing tests.
3. Suppress errors on property access suggestions from large objects.
4. Combine (3) and (4) above to suppress errors on suggestions from other, global files.
5. A little more testing on random files to make sure that precision
is good there too.
6. Have people from the regular Code editor meeting test the code and
suggest ideas.
* all (most?) tests pass
* NOW they all pass
* add tonnes of semi-colons
* restore this.x check+add a test case
* make ts-ignore/no-check codefix work in unchecked js
* Issues errors only in the language service
* add a few more tests
* fix incorrect parentheses
* More cleanup in program.ts
* Improve readability of isExcludedJSError
* make diff in program.ts smaller via closure
* Switch unchecked JS did-you-mean to suggestion
Instead of selectively letting errors through.
* undo more missed changes
* disallow ignoring suggestions
* Issue different messages for plain JS than others
Straw text for the messages, I just changed the modals to avoid name
collisions.1 parent 5be0d71 commit e53f19fCopy full SHA for e53f19f
File tree
Expand file treeCollapse file tree
21 files changed
+603
-27
lines changedFilter options
- src
- compiler
- services/codefixes
- tests
- baselines/reference
- cases
- conformance/salsa
- fourslash
Expand file treeCollapse file tree
21 files changed
+603
-27
lines changed+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
683 | 683 |
| |
684 | 684 |
| |
685 | 685 |
| |
686 |
| - | |
| 686 | + | |
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
| |||
692 | 692 |
| |
693 | 693 |
| |
694 | 694 |
| |
695 |
| - | |
| 695 | + | |
696 | 696 |
| |
697 | 697 |
| |
698 | 698 |
| |
|
+46-17Lines changed: 46 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1072 | 1072 |
| |
1073 | 1073 |
| |
1074 | 1074 |
| |
1075 |
| - | |
1076 |
| - | |
| 1075 | + | |
| 1076 | + | |
1077 | 1077 |
| |
1078 | 1078 |
| |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1079 | 1083 |
| |
1080 | 1084 |
| |
1081 | 1085 |
| |
1082 | 1086 |
| |
1083 |
| - | |
| 1087 | + | |
1084 | 1088 |
| |
1085 | 1089 |
| |
1086 | 1090 |
| |
| |||
1704 | 1708 |
| |
1705 | 1709 |
| |
1706 | 1710 |
| |
1707 |
| - | |
1708 |
| - | |
| 1711 | + | |
| 1712 | + | |
1709 | 1713 |
| |
1710 | 1714 |
| |
1711 | 1715 |
| |
| |||
1716 | 1720 |
| |
1717 | 1721 |
| |
1718 | 1722 |
| |
1719 |
| - | |
1720 |
| - | |
| 1723 | + | |
1721 | 1724 |
| |
1722 | 1725 |
| |
1723 | 1726 |
| |
| |||
2054 | 2057 |
| |
2055 | 2058 |
| |
2056 | 2059 |
| |
2057 |
| - | |
| 2060 | + | |
2058 | 2061 |
| |
2059 |
| - | |
| 2062 | + | |
2060 | 2063 |
| |
2061 | 2064 |
| |
2062 | 2065 |
| |
2063 | 2066 |
| |
2064 | 2067 |
| |
2065 |
| - | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
2066 | 2073 |
| |
2067 | 2074 |
| |
2068 | 2075 |
| |
| |||
21923 | 21930 |
| |
21924 | 21931 |
| |
21925 | 21932 |
| |
21926 |
| - | |
| 21933 | + | |
21927 | 21934 |
| |
21928 | 21935 |
| |
21929 | 21936 |
| |
| |||
27437 | 27444 |
| |
27438 | 27445 |
| |
27439 | 27446 |
| |
27440 |
| - | |
| 27447 | + | |
| 27448 | + | |
27441 | 27449 |
| |
27442 | 27450 |
| |
27443 | 27451 |
| |
| |||
27450 | 27458 |
| |
27451 | 27459 |
| |
27452 | 27460 |
| |
27453 |
| - | |
| 27461 | + | |
27454 | 27462 |
| |
27455 | 27463 |
| |
27456 | 27464 |
| |
| |||
27483 | 27491 |
| |
27484 | 27492 |
| |
27485 | 27493 |
| |
| 27494 | + | |
| 27495 | + | |
| 27496 | + | |
| 27497 | + | |
| 27498 | + | |
| 27499 | + | |
| 27500 | + | |
| 27501 | + | |
| 27502 | + | |
| 27503 | + | |
| 27504 | + | |
| 27505 | + | |
| 27506 | + | |
| 27507 | + | |
| 27508 | + | |
| 27509 | + | |
| 27510 | + | |
| 27511 | + | |
| 27512 | + | |
| 27513 | + | |
27486 | 27514 |
| |
27487 | 27515 |
| |
27488 | 27516 |
| |
| |||
27614 | 27642 |
| |
27615 | 27643 |
| |
27616 | 27644 |
| |
27617 |
| - | |
| 27645 | + | |
27618 | 27646 |
| |
27619 | 27647 |
| |
27620 | 27648 |
| |
| |||
27647 | 27675 |
| |
27648 | 27676 |
| |
27649 | 27677 |
| |
27650 |
| - | |
| 27678 | + | |
| 27679 | + | |
27651 | 27680 |
| |
27652 | 27681 |
| |
27653 | 27682 |
| |
| |||
27663 | 27692 |
| |
27664 | 27693 |
| |
27665 | 27694 |
| |
27666 |
| - | |
| 27695 | + | |
27667 | 27696 |
| |
27668 | 27697 |
| |
27669 | 27698 |
| |
| |||
34582 | 34611 |
| |
34583 | 34612 |
| |
34584 | 34613 |
| |
34585 |
| - | |
| 34614 | + | |
34586 | 34615 |
| |
34587 | 34616 |
| |
34588 | 34617 |
| |
|
src/compiler/diagnosticMessages.json
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json+8Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2442 | 2442 |
| |
2443 | 2443 |
| |
2444 | 2444 |
| |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
2445 | 2449 |
| |
2446 | 2450 |
| |
2447 | 2451 |
| |
2448 | 2452 |
| |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
2449 | 2457 |
| |
2450 | 2458 |
| |
2451 | 2459 |
| |
|
+4-4Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1896 | 1896 |
| |
1897 | 1897 |
| |
1898 | 1898 |
| |
1899 |
| - | |
| 1899 | + | |
1900 | 1900 |
| |
1901 | 1901 |
| |
1902 | 1902 |
| |
| |||
1918 | 1918 |
| |
1919 | 1919 |
| |
1920 | 1920 |
| |
1921 |
| - | |
1922 |
| - | |
| 1921 | + | |
| 1922 | + | |
1923 | 1923 |
| |
1924 | 1924 |
| |
1925 | 1925 |
| |
| |||
3894 | 3894 |
| |
3895 | 3895 |
| |
3896 | 3896 |
| |
3897 |
| - | |
| 3897 | + | |
3898 | 3898 |
| |
3899 | 3899 |
| |
3900 | 3900 |
| |
|
src/services/codefixes/fixSpelling.ts
Copy file name to clipboardExpand all lines: src/services/codefixes/fixSpelling.ts+2Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
6 | 7 |
| |
| 8 | + | |
7 | 9 |
| |
8 | 10 |
| |
9 | 11 |
| |
|
tests/baselines/reference/argumentsReferenceInConstructor3_Js.types
Copy file name to clipboardExpand all lines: tests/baselines/reference/argumentsReferenceInConstructor3_Js.types+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 |
| - | |
| 50 | + | |
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
|
tests/baselines/reference/jsObjectsMarkedAsOpenEnded.types
Copy file name to clipboardExpand all lines: tests/baselines/reference/jsObjectsMarkedAsOpenEnded.types+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
| 51 | + | |
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
|
tests/baselines/reference/spellingUncheckedJS.symbols
Copy file name to clipboard+95Lines changed: 95 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + |
You can’t perform that action at this time.
0 commit comments