32303 Commits

Author SHA1 Message Date
Josh Goldberg
541e553163
Specific diagnostic suggestions for unexpected keyword or identifier (#43005)
Error message improvement for unexpected tokens in the following situations:

* A word was parsed that seems to have a low edit distance from a known common keyword
* A word was parsed that seems to be a known common keyword and a name _without_ a space in-between
* Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected

___

* Specific diagnostic suggestions for unexpected keywords or identifier

* Don't reach into there, that's not allowed

* Improved error when there is already an initializer

* Specific module error message for invalid template literal strings

* Skip 'unexpected keyword or identifier' diagnostics for declare nodes

* Improve error for function calls in type positions

* Switch class properties to old diagnostic

* Corrected errors in class members and reused existing textToKeywordObj map

* Corrected more baselines from the merge

* Update src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Mostly addressed feedback

* Clarified function call type message

* Split up and clarified parsing vs error functions

* Swap interface name complaints back, and skip new errors on unknown (invalid) tokens

* Used tokenToString, not a raw semicolon

* Inline getExpressionText helper

* Remove remarks in src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-07-14 13:50:55 -07:00
Gabriela Araujo Britto
3358f137c6
Fix namespace name conflict detection in "Convert named imports to namespace import" action (#45019)
* fix namespace conflict detection
2021-07-14 11:07:12 -07:00
jjangga0214
2b8296b7ad
chore(typo): fix comment (#45016) 2021-07-14 09:28:48 -07:00
TypeScript Bot
9247ef115e Update package-lock.json 2021-07-14 06:06:00 +00:00
Jean Pierre
40ec8392a1
Fixes JSDoc @type function with variable args is interpreted incorrectly (#44864)
* Fixes #44386

* Add test

* Move test from fourslash to conformance
2021-07-13 17:17:24 -07:00
Daniel Rosenwasser
0996bff509
Support syntactic diagnostics in partial mode (#44859)
* Initial work to support syntactic diagnostics in partial mode.

* Test out 'syntacticDiagnosticsSync' requests.

* Added a 'geterr' test.

* Accepted baselines.

* Remove/clean up comments.
2021-07-13 11:22:34 -07:00
caojoshua
acdf62fa1e
Fix "Union types are not being narrowed down correctly in 4.3 #44401" (#44771)
* Fix "Union types are not being narrowed down correctly in 4.3 #44401"

* On undefined constraint, add the original type to constraints.
2021-07-13 11:02:18 -07:00
TypeScript Bot
c17fd8c479 Update package-lock.json 2021-07-13 06:06:06 +00:00
csigs
f453a28ed0
LEGO: Merge pull request 45000
LEGO: Merge pull request 45000
2021-07-12 22:13:14 -07:00
Wesley Wigham
8e855d140b
Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
csigs
0746f70fe5
LEGO: Merge pull request 44989
LEGO: Merge pull request 44989
2021-07-12 10:14:10 -07:00
csigs
3c604f1c0a
LEGO: Merge pull request 44987
LEGO: Merge pull request 44987
2021-07-12 04:13:35 -07:00
csigs
ed6007d316
LEGO: Merge pull request 44982
LEGO: Merge pull request 44982
2021-07-11 22:18:01 -07:00
csigs
bcb1911abd
LEGO: Merge pull request 44979
LEGO: Merge pull request 44979
2021-07-11 16:18:31 -07:00
csigs
db561931a7
LEGO: Merge pull request 44977
LEGO: Merge pull request 44977
2021-07-11 10:13:09 -07:00
Ron Buckton
66c3063b06
Add collision check for 'Reflect' when using super in static initializers (#44876)
* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
2021-07-10 12:48:54 -07:00
TypeScript Bot
6ee8154b2b Update package-lock.json 2021-07-10 06:05:44 +00:00
TypeScript Bot
8e795108eb Update package-lock.json 2021-07-09 06:05:48 +00:00
Oleksandr T
a15030ff6f
fix(35050): Decorator emit incorrect within try block (#41951)
* fix(35050): fix decorated block-scoped class emit

* Only use internal name when targeting ES5/3

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-07-08 10:48:02 -07:00
Andrew Branch
e881a69939
Detect circularities printing recursive conditional types (#43733) 2021-07-08 09:19:58 -07:00
TypeScript Bot
2f3cd38121 Update package-lock.json 2021-07-08 06:06:03 +00:00
Ron Buckton
8590f0db40
Fix decorator emit regression for static fields (#44933) 2021-07-07 16:58:36 -07:00
Oleksandr T
c0821aeacd
fix(44926): change noImplicitOverride description (#44929) 2021-07-07 18:43:44 +01:00
TypeScript Bot
1de29af709 Update package-lock.json 2021-07-07 06:06:13 +00:00
Andrew Casey
4d5978d1db
Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject (#44836)
* Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject

* Reuse previously computed values and refine comments

* Add baselines for test matrix
2021-07-06 15:22:48 -07:00
Eli Barzilay
bb7de99e5a Improve "Convert to template string" with template-strings
Fixes #44396
2021-07-06 18:14:58 -04:00
Anders Hejlsberg
8e01a86c01
Consistently ignore attributes with hyphenated names in JSX (#44873)
* Consistently skip attributes with hyphenated names in JSX

* Add regression test

* Accept new baselines

* Fix tests

* Accept new baselines
2021-07-06 10:29:51 -10:00
Andrew Branch
1da18c60d6
Refactor export map cache to not store transient symbols (#44816)
* Add some failing tests around transient symbols

* Working, but slower

* A class is much faster, apparently

* This is probably best?

* Back to multimap

* Go back to single symbol cache

* Revert now-unnecessary generics

* Rename and reorganize

* Fix weird compound condition

* Clean up
2021-07-06 11:04:59 -06:00
Oleksandr T
fc5c765f81
fix(44868): handle import type in shorthand assignment (#44881) 2021-07-06 09:29:09 -06:00
TypeScript Bot
f58a662950 Update package-lock.json 2021-07-05 06:05:57 +00:00
TypeScript Bot
b539c9a0c3 Update package-lock.json 2021-07-04 06:06:07 +00:00
Ron Buckton
069650f602
Change PerformanceObserver to be compatible with new Node types (#44884) 2021-07-03 21:26:56 -07:00
Ron Buckton
09406524b3
Add evaluation tests for class static initializers (#44878) 2021-07-03 18:30:42 -07:00
TypeScript Bot
be5bf3ef2d Update package-lock.json 2021-07-03 06:06:16 +00:00
Ron Buckton
8b496ed34c
Fix class name reference in class expr (#44877) 2021-07-02 18:37:23 -07:00
TypeScript Bot
62f9155a9d Update package-lock.json 2021-07-02 06:07:09 +00:00
Daniel Rosenwasser
248b2c3fc1
Further optional delete corrections (#44862)
* Add more tests.

* Accepted baselines.

* Switch to testing the symbol's flags.

* Accepted baselines.
2021-07-01 18:44:22 -07:00
Daniel Rosenwasser
e3d6189e3a
Correctly check for 'delete' on optional properties in 'exactOptionalPropertyTypes'. (#44854)
* Check for optionality in 'delete'.

* Accepted baselines.
2021-07-01 15:19:11 -07:00
Daniel Rosenwasser
9d443b76aa
Update LKG to enable improved narrowing in 4.4. (#44842)
* Update LKG.

* Remove unnecessary assertions.
2021-07-01 12:21:27 -07:00
TypeScript Bot
d308b99f38 Update package-lock.json 2021-07-01 06:06:07 +00:00
Oleksandr T
e402c1d464
feat(44799): allow auto import codefix for shorthand property assignment (#44827) 2021-06-30 16:09:42 -05:00
Zzzen
813ddf7909
ensure export modifier is used before default modifier (#44570)
* ensure export modifier is used before default modifier

* gracefully handle `default function`

* Revert "gracefully handle `default function`"

This reverts commit 1d8e2887540f5abaa8b7192fee89ef8935be8640.

* give better error message on default without leading export
2021-06-30 09:43:14 -07:00
TypeScript Bot
837ed96697 Update package-lock.json 2021-06-30 06:11:21 +00:00
Oleksandr T
5c8d76347c
fix(44448): disallow 'delete' operator for optional properties (#44612) 2021-06-29 16:56:45 -07:00
Anders Hejlsberg
4c19873b64
Validate symbol-named properties against symbol index signatures (#44815)
* Validate symbols against both symbol and string index signatures

* Add tests

* Accept new baselines
2021-06-29 11:53:07 -10:00
Oleksandr T
114f68cd3d
fix(44725): handle this parameter in tagged template call (#44734) 2021-06-29 14:11:35 -07:00
Orta Therox
fdc31baffe
Fix types in the boolean trivial lint rule (#44801) 2021-06-29 11:53:35 -07:00
Eli Barzilay
f47ddbc3b0 Fix bad line number assertion in ScriptInfo.positionToLineOffset
This is the line number side of ecddf8468f (from #21924, fixing #21818).
But the code is slightly improved for both cases: instead of testing
that `leaf` is defined, check whether `lineCount` is zero, and if it is,
return `〈1,0〉` for the one-based line and zero-based column numbers.
(The requirement of `lineCount > 0` is also seen in the fact
that `lineNumberToInfo` expects a "*One*BasedLine" argument.)

I've stared at this code way too much, since I think that there is
something more fundamentally wrong here.  E.g., `EditWalker` only
`push`es to `startPath` but never pops even a `children`-less node that
is left after deleting the whole contents.  But I can't figure out the
overall structure, which is also why the test that I added is not
great (see the comment there; also, #21924 is dealing with the same
problem and didn't add a test).

Fixes #44518.
2021-06-29 14:13:44 -04:00
TypeScript Bot
5cea46c537 Update package-lock.json 2021-06-29 06:05:59 +00:00
Anders Hejlsberg
5f8a9e5181
Fix constant reference check in CFA (#44762)
* Check entire access path is constant when narrowing by inlining

* Add tests

* Accept new baselines

* Added test cases for parameter properties.

* Accepted baselines.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-28 16:41:17 -07:00