Commit graph

23801 commits

Author SHA1 Message Date
Anders Hejlsberg 73fc830837 Fix variance computation logic 2021-08-29 16:00:24 -07:00
Oleksandr T 076f22b2c9
fix(45501): don't remove spaces between empty object literals with enabled insertSpaceAfterOpeningAndBeforeClosingEmptyBraces (#45514) 2021-08-24 11:28:58 -07:00
Orta Therox 41dcad056a
Adds a script for removing unused diagnostics (#44324)
* Adds a script for removing unused diagnostics

* Accidentally deleted the wrong one
2021-08-24 13:03:18 +01:00
Daniel Rosenwasser 59b8bef3e7
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 16:38:26 -07:00
Daniel Rosenwasser af54990055
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 16:15:54 -07:00
Nathan Shively-Sanders b8ace9d312
Restore HTMLDocument constructable value in DOM (#45554)
Don't touch anything else in the DOM.
2021-08-23 15:56:11 -07:00
David Rogers d18e82b380
fix for 45006 (#45020)
* fix for 45006

* treat setters like getters in preceding commit; move test accordingly

* fix test baselines

* changes per code review

in `getContainerFlags`, move cases for get/set accessors
to fallthrough into the block that currently handles MethodDeclaration;
so get/set accessors and method declarations all get the same container flags,
such that during `bindContainer`, `startFlow.node` is assigned to
getters/accessors
(this changes a public api in tsserverlibrary.d.ts and typescript.d.ts
by adding `GetAccessorDeclaration` and `SetAccessorDeclaration` to the type
of `FlowStart.node`)

consolidate predicates checking whether a node is either a get or set
accessor, into `isObjectLiteralOrClassExpressionMethodOrAccessor`
(formerly `isObjectLiteralOrClassExpressionMethod`)

annotate updated test with `@target: es2020`

* fix `isObjectLiteralOrClassExpressionMethodOrAccessor`

require that Getter/Setters are parented by an ObjectLiteralExpression or ClassExpression
2021-08-20 17:05:19 -07:00
Oleksandr T 65ed4124ee
feat(44888): omit completions in an object expression with an instantiated class type (#45044) 2021-08-20 13:51:37 -07:00
Oleksandr T 69b5b2b2f3
feat(16755): show QF to declare missing properties in a call expression with an object literal argument (#44781) 2021-08-20 13:49:46 -07:00
Gabriela Araujo Britto 84b057828e
Fix incorrect suggestion for package that bundles types (#45507)
* Fix incorrect suggestion for package that bundles types

* determine if a package ships types from its files

* update new error message
2021-08-20 11:12:34 -07:00
Oleksandr T e00722f262
feat(44720): allow renaming string literal in switch/case (#45084) 2021-08-19 17:09:35 -07:00
Zzzen 693c2d08c1
support contextual return type of iife (#45007) 2021-08-19 16:37:50 -07:00
Gabriela Araujo Britto 945179fb64
Reuse checker's property accessibility check for completions (#45388)
* add test for completions crash

* WIP: experiment

* remove comments

* add call to getParseTreeNode

* Revert "add call to getParseTreeNode"

This reverts commit 8dd1cf67cf.

* Fix comments

* minor fixes

* fix formatting

* rename type to containingType
2021-08-19 13:02:20 -07:00
Eli Barzilay 7a19c22063 getReferencesAtLocation: fix handling of destructoring imports
Fixes #45423.
2021-08-18 14:39:54 -04:00
Anders Hejlsberg 79474fdfd2
Increase type instantiation depth limit (#45025)
* Bump instantiation depth limit to 500

* Accept new baselines

* Update tests

* Accept new baselines
2021-08-17 07:00:19 -07:00
Oleksandr T dc80e6a28b
feat(18147): skip uncessary parenthesis (#44769) 2021-08-16 17:20:40 -07:00
Oleksandr T 424464d46b
feat(43963): change var to a parameter in destructured function parameters (#44767) 2021-08-16 17:19:44 -07:00
Gerrit Birkeland e263fcebf8
Expose getTypePredicateOfSignature (#44863) 2021-08-16 17:17:42 -07:00
Oleksandr T 55ed742574
fix(45294): show parameter inlay hints for template strings (#45305) 2021-08-16 14:11:02 -07:00
Ryan Cavanaugh e00b5ecd40
Enable max-statements-per-line lint rule (#45475)
* Enable the rule

* Fix all the violations
2021-08-16 13:53:51 -07:00
csigs d50c91da17
LEGO: Merge pull request 45456
LEGO: Merge pull request 45456
2021-08-14 10:13:55 -07:00
csigs 3c957efd4a
LEGO: Merge pull request 45453
LEGO: Merge pull request 45453
2021-08-14 04:24:59 -07:00
Oleksandr T 5b3072f687
fix(45233): allow type assertion in ExportAssignment with JSDoc type definition (#45342) 2021-08-13 16:32:23 -07:00
Oleksandr T dfd84ec0b2
fix(45417): show inlay hints for null and literal-like identifiers (#45426) 2021-08-13 11:31:47 -07:00
csigs fe7962af3d
LEGO: Merge pull request 45444
LEGO: Merge pull request 45444
2021-08-13 10:13:50 -07:00
csigs 6cdbf98a6f
LEGO: Merge pull request 45442
LEGO: Merge pull request 45442
2021-08-13 04:13:56 -07:00
Jm 7139f37201
fix: nodeWillIndentChild judge for BinaryExpression with JsxElement child (#44695) 2021-08-12 14:01:52 -07:00
Nathan Shively-Sanders 8d4fe5a0fb
Fix unassignable properties by adding undefined with exactOptionalPropertyTypes (#45032)
* Simple first version

Doesn't cover or test any complicated variations.

* Lots of cases work

Destructuring does not. But

- skipping node_modules and lib.* does.
- call expressions does
- property access, including with private identifiers, does

* Support variable declarations, property assignments, destructuring

As long as it's not nested

* More cleanup

* skip all d.ts, not just node_modules/lib

* Offer a codefix for a lot more cases

* remove incorrect tuple check

* Use getSymbolId instead of converting to string

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* add test + switch to tracking number symbol ids

* Address PR comments

* Exclude tuples from suggestion

* Better way to get error node

Plus add a check that errorNode is an argument to the call, not the
call's expression.

* fix semicolon lint

* fix another crash

* Simplify: add undefined to all optional propertie

whether or not somebody tried to assign undefined to them in the
erroneous assignment

* remove fix-all

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-08-10 16:57:38 -07:00
Nathan Shively-Sanders 92e7fb521f
Update tsc-instrumented for project build (#45383)
* Update tsc-instrumented for project build

loggedIO has a weird build that never got updated for the project build
system. This PR just adds a project for it in a straightforward way. It
might be less efficient than the old way, but that's not a big concern
for recording RWC test cases.

However, I may have done things wrong. If anybody knows
tsc-instrumented, please comment.

* Create a second loggedIO tsconfig for tsc-instrumented

The normal tsconfig should not have `prepend`; the standalone one for
tsc-instrumented should.

* fix semicolon lint
2021-08-10 14:53:17 -07:00
Oleksandr T 6c42d7949b
fix(45393): show parameter name hints for unary literal expressions (#45399) 2021-08-10 11:51:00 -07:00
Oleksandr T ad894f74b3
fix(45345): throw an error on overridden member that is defined in multiple interfaces (#45352) 2021-08-10 11:50:22 -07:00
Wesley Wigham 68eb1a551f
Use getFileAndProject in session provideInlayHints to ensure language service updates are applied (#45394) 2021-08-10 11:48:35 -07:00
Ron Buckton d8e830d132
Fix __spreadArray for non-concat-spreadables (#45386) 2021-08-09 17:08:07 -07:00
Ikko Ashimine 5e496d52e1
Fix typo in helpers.ts (#45365)
funtions
2021-08-09 08:40:54 -07:00
csigs 75cb8b2393
LEGO: Merge pull request 45375
LEGO: Merge pull request 45375
2021-08-08 22:13:50 -07:00
csigs 5c66c12124
LEGO: Merge pull request 45374
LEGO: Merge pull request 45374
2021-08-08 16:13:45 -07:00
csigs cf74363397
LEGO: Merge pull request 45368
LEGO: Merge pull request 45368
2021-08-08 10:13:44 -07:00
csigs 99622fc2ef
LEGO: Merge pull request 45362
LEGO: Merge pull request 45362
2021-08-08 04:14:17 -07:00
csigs c9788712a7
LEGO: Merge pull request 45359
LEGO: Merge pull request 45359
2021-08-07 22:13:31 -07:00
csigs 9960edef51
LEGO: Merge pull request 45357
LEGO: Merge pull request 45357
2021-08-07 16:13:42 -07:00
csigs ce9366d6f7
LEGO: Merge pull request 45356
LEGO: Merge pull request 45356
2021-08-07 10:13:41 -07:00
csigs bea0ee8c59
LEGO: Merge pull request 45351
LEGO: Merge pull request 45351
2021-08-06 22:14:03 -07:00
Daniel Rosenwasser 66980fc8dc Bump version to 4.5. 2021-08-06 23:28:17 +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
Ron Buckton 4fc4c18299
Fix completions in return when in function with contextual 'this' (#45340) 2021-08-05 22:40:20 -07:00