Commit graph

32411 commits

Author SHA1 Message Date
TypeScript Bot a10409ccaa Bump version to 4.4.2 and LKG 2021-08-24 00:07:38 +00:00
Daniel Rosenwasser 5719423aad Only provide hints for simple literals when 'literals' is specified. (#45557)
* Only provide hints for simple literals when 'literals' is specified.

* Update fourslash tests.
2021-08-23 23:40:12 +00:00
TypeScript Bot d2a46a07b3
Cherry-pick PR #45554 into release-4.4 (#45555)
Component commits:
c9846f8b83 Restore HTMLDocument constructable value in DOM
Don't touch anything else in the DOM.

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2021-08-23 16:24:22 -07:00
Daniel Rosenwasser a417917f62 Some cleanup around inlay hints types to get more-precise checking. (#45391)
* Some cleanup around inlay hints types to get more-precise checking.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-08-23 23:20:36 +00:00
TypeScript Bot 7b0e66518d
Cherry-pick PR #45426 into release-4.4 (#45445)
Component commits:
01077c1299 fix(45417): show inlay hints for null and literal-like identifiers

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2021-08-16 14:11:35 -07:00
Daniel Rosenwasser 55dd850009 Update LKG. 2021-08-11 21:50:36 +00:00
Ron Buckton e9b1ff5f16 Fix __spreadArray for non-concat-spreadables (#45386) 2021-08-11 21:47:24 +00:00
TypeScript Bot 11339d945f Update LKG 2021-08-11 06:41:16 +00:00
TypeScript Bot c82ccf1391
Cherry-pick PR #45399 into release-4.4 (#45404)
Component commits:
f7af8f4a4a fix(45393): show parameter name hints for unary literal expressions

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2021-08-10 23:20:29 -07:00
TypeScript Bot 0648de87a0
Cherry-pick PR #45352 into release-4.4 (#45384)
Component commits:
58a924d968 fix(45345): throw an error on overridden member that is defined in multiple interfaces

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2021-08-10 11:50:33 -07:00
TypeScript Bot c8b1e454ac
Cherry-pick PR #45394 into release-4.4 (#45396)
Component commits:
61dd78f65d Use getFileAndProject in session provideInlayHints to ensure language service updates are applied

Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
2021-08-10 11:48:39 -07:00
TypeScript Bot e7fd303cd1 Bump version to 4.4.1-rc and LKG 2021-08-06 22:43:19 +00:00
Daniel Rosenwasser eb1e566444 Merge branch 'main' into release-4.4 2021-08-06 22:26:45 +00:00
Andrew Casey 792e6d652a
Fix symbol display exception when handling incomplete class (#44936)
When a class declaration lacks a name, don't throw an exception when
producing the display parts (e.g. for QuickInfo).

Remaining issues:
 1. The name shows as "__missing", the name of the underlying symbol,
    rather than "(Missing)", as it is for the corresponding function
    declaration case (because the parse constructs a missing identifier
    node for the function declaration).
 2. "(Missing)" is hard-coded, rather than being a localizable resource
    string.
 3. When an anonymous class declaration is a default export, the
    corresponding symbol is named "default", resulting in the confusing
    display string "class default".

Since display parts are built using existing `symbolToString`
functionality, it wasn't clear whether detecting special symbol names
and replacing them with user-friendly strings could be done without
breaking other functionality.

Similarly, changing the shape of the parse tree seemed riskier than the
problem justified (the user experience is just not getting QuickInfo for
the incomplete declaration, which seems acceptable).
2021-08-06 15:05:54 -07:00
Henrique Inonhe 7753efae79
Improve error message TS1210 (#44892) 2021-08-06 15:00:26 -07:00
Oleksandr T cce2e926de
feat(45163): add QF to declare missing jsx attributes (#45179) 2021-08-06 12:38:22 -07:00
csigs abfe5f0be7
LEGO: Merge pull request 45346
LEGO: Merge pull request 45346
2021-08-06 10:13:49 -07:00
Anders Hejlsberg 409be37bf5
Fix index signature assignability from optional properties in --exactOptionalPropertyTypes mode (#45185)
* Explicit undefined not assignable to non-undefined index signature in exactOptionalPropertyTypes mode

* Add tests
2021-08-06 08:54:00 +02:00
Anders Hejlsberg 3bd5079f1c
Fix check for generic types in control flow analysis (#45148)
* Fix check in hasNonBindingPatternContextualTypeWithNoGenericTypes

* Add regression tests

* Accept new baselines

* Compute both ObjectFlags.IsGenericXXXType flags in one go
2021-08-06 08:53:30 +02:00
TypeScript Bot 54898de39e Update package-lock.json 2021-08-06 06:06:10 +00:00
Ron Buckton 4fc4c18299
Fix completions in return when in function with contextual 'this' (#45340) 2021-08-05 22:40:20 -07:00
Matt Bierner c0796c1dfb
Enable events on web server (#45313)
Fixes #45293
2021-08-05 16:10:01 -07:00
Orta Therox 1f85123821
Revisions for the new --help (#44800)
* WIP on refining the new --help

* Fix types in the boolean trivial lint rule

* Update baselines

* More work

* Updates the color logic

* Simplifies the CLI color code

* Use cyan instead of blue for win powershell/command prompt

* Use bright white when blue is probably going to look off

* Fix NO_COLOR

* Adds a test to cover NO_COLOR

* Update src/compiler/diagnosticMessages.json

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

* Update compiler diagnostic text

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-08-05 16:41:01 +01:00
Eli Barzilay 635f5bdf8c Some tweaks for backtick strings
1. `getRawLiteral()`: barf if `currentSourceFile` is missing, since if
   it is, then the following `getSourceTextOfNodeFromSourceFile` will
   return a bogus `""`.

2. One `||` -> `??` change.

3. `backtickQuoteEscapedCharsRegExp`: escape the usual control
   characters except for a simple LF.  This code does get used to
   generate backtick strings when `rawText` is not given, and not
   escaping things like TAB characters can get mangled by editor
   settings.  Worse, not escaping a CRLF and putting it verbatim in sthe
   string source will interpret it as LF, so add a special case for
   escaping these as `\r\n`.
   Added test.

Related to #44313 and #40625.
2021-08-05 05:45:34 -04:00
TypeScript Bot 3266ffbb59 Update package-lock.json 2021-08-05 06:05:50 +00:00
Orta Therox b9e952be1d
Migrate over 4.4 lib dom and webworker (#45324)
* Brings across 4.4 DOM + Web Worker changes

* Adds tests

* Incorporate #1092 and #1093 from TypeScript-DOM-lib-generator

* update baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-08-04 17:14:24 -07:00
Andrew Branch f80bc3f5f0
Store symbol table map key in CachedSymbolExportInfo (#45289)
* Store symbol table map key in CachedSymbolExportInfo

* Remove debug assertion

* Filter out known symbols (again) and private identifiers
2021-08-04 16:31:47 -07:00
Eli Barzilay 2bae169306 convertStringOrTemplateLiteral.ts: Re-fix escapeStringForTemplate
Make it backslash-escape backticks too.  While I was there, remove the
use of this function for the text (which was the earlier confused
version that used only `text`), and rename it as
`escapeRawStringForTemplate` to clarify.

Added a test to the preivious pile of tests.

Fixes #45278.
2021-08-04 18:37:31 -04:00
David Sherret 03dff41c9f
Fix getting completion details for meta properties (#45031)
* Fix getting completion details for meta properties.

* Move inside the worker.

* Move ImportMeta handling to completions.ts

* Fix property type name for new.target.

* Use symbols for ImportMeta completions.

* Accept baselines.

* Revert lib change.

* Revert needless parser change.

* Missed these reverts.

* Remove now unused `isMetaPropertyExpression`

* Move up meta property keyword check to be done in `getSymbolAtLocation` and `getTypeOfNode`

* Call `checkNewTargetMetaProperty` directly and handle when it's an error type.

* Make meta property expression types synthetic.

* Make event.target and import.meta properties readonly

* Add a test for go to definition (I think?)

* Copy built-in types/values test for go to definition.

* Add tests for go to definition when not a module.

* Fix "go to definition" for new.target
2021-08-04 09:41:04 -07:00
Oleksandr T 318930b9e3
fix(45221): suggest unknown symbols in type positions (#45323) 2021-08-04 09:37:06 -07:00
Nathan Shively-Sanders f1ce0f5528
Visit children of jsdoc type aliases in the binder (#45312)
* Visit children of jsdoc type aliases in the binder

This sets up parent pointers.

Fixes #45254 and almost certainly #45248, though I haven't figured out
to repro the second case.

* move incorrect parenthesis

* manually set comment parent instead

* Bind children of typedef where possible

* add explanatory comment to binding
2021-08-04 07:05:11 -07:00
Jean Pierre 1cbb0bd4d3
Do not classify Infinity and NaN (#44778)
* Do not classify Infinity and NaN. Fixes #42022

* Internally expose so that the classifier can use it

* Increase the test complexity, and revert the type-checker

* Drop the -Infinity

Co-authored-by: Orta <git@orta.io>
2021-08-04 10:00:39 +01:00
TypeScript Bot 4646640e6f Update package-lock.json 2021-08-04 06:06:05 +00:00
Oleksandr T 5971b68231
fix(45224): show inlay hints for setter parameter (#45229) 2021-08-03 11:33:26 -07:00
Oleksandr T c4080437b2
fix(45102): do not suggest refactoring for functions contains arguments reference (#45116) 2021-08-03 11:31:56 -07:00
Martin Johns 5a2153a729
Fix position of keyword in "Add 'override' modifier" code fix (#45274)
fixes #45270
2021-08-03 11:01:30 -07:00
Orta Therox ceef6f7cfd
Dev: Have a clickable link for a new baseline created (#44552)
* Have a clickable link for a new baseline created

* Use joinPath instead:
2021-08-03 16:18:39 +01:00
TypeScript Bot 5a19533d1b Update package-lock.json 2021-08-03 06:05:56 +00:00
Oleksandr T 39c653cd83
fix: omit inlay hints for setters (#45228) 2021-08-02 16:27:22 -07:00
Daniel Rosenwasser 975aabe788
Ensure all SortText entries have the same length (#45292)
* Ensure all `SortText` entries have the same length.

* Update Baselines and/or Applied Lint Fixes

* Update the exact same enum to the exact same values in fourslash. 🙄

* Make `SortTextId` a const enum, switch to use an explicit offset in `SortTextId`.

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-08-02 16:27:01 -07:00
csigs f30ba36a2b
LEGO: Merge pull request 45299
LEGO: Merge pull request 45299
2021-08-02 16:13:44 -07:00
Andrew Branch d2f324b389
Add test for intersection narrowing bug (#45296) 2021-08-02 16:12:09 -07:00
Kubilay Kahveci 9cc3070938
expose getImmediateAliasedSymbol() publicly (#44644)
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
2021-08-02 15:57:54 -07:00
Armando Aguirre 642060db6f
Replace non-null assertion with optional chain on assert nodes (#43788) 2021-08-02 15:26:48 -07:00
Oleksandr T c23abc8957
fix(45192): show implement interface QF for re-exported types (#45245) 2021-08-02 15:19:19 -07:00
Andrew Branch bfd5b2f7f0
Fix decorator metadata references to type-only-imported namespaces (#44915)
* Add test

* Fix metadata references to type-only-imported namespaces

* Use `!!` instead of `|| false`
2021-08-02 14:18:15 -07:00
Wesley Wigham 7669bfba15
Actually instantiate the type of the annotation used for contextual types (#45285) 2021-08-02 12:44:56 -07:00
TypeScript Bot afe9cf5307 Update package-lock.json 2021-08-02 06:06:07 +00:00
TypeScript Bot 52af8bf70f Update package-lock.json 2021-08-01 06:06:09 +00:00
TypeScript Bot 582e404a10 Update package-lock.json 2021-07-31 06:05:54 +00:00