Commit Graph

9903 Commits

Author SHA1 Message Date
Titian Cernicova-Dragomir
f883bf3acb Adding support for @implements. (#36292)
* Adding support for @implements.

* Fixed code review issues for @implements, added some more tests.

* Fixed declaration emit for @interface

* Improved getImplementsTypes to not cache the results since it is only used once.

* Removed unnecessary checks from getImplementsTypes
2020-02-27 09:27:37 -08:00
Alexander T
baff821594 fix(36989): 'async' modifier cannot be used in an ambient context.ts (#37010)
* fix(36989): omit 'async' modifier for methods in declaration files.

* remove useless condition
2020-02-27 00:11:29 -08:00
Ryan Cavanaugh
c4e96856ac Detect circularities when removing 'undefined' from defaulted params (#37023)
Fixes #37008

Note that referencing a variable in its initializer is a TDZ error;
the OP report had OOB logic that prevented this in practice (?)
2020-02-26 14:59:04 -08:00
Nathan Shively-Sanders
af901ba911 No error on this exprs in static property inits (#36781)
No error on `this` expressions in static property declaration
initialisers when targetting ESNext and with useDefineForClassFields. In
this case the emit is correct and the types are correct, so the error
should not be issued.
2020-02-26 09:07:45 -08:00
Wesley Wigham
15dd0002ef Unwrap substitutions both before _and_ after potential simplification (#32116)
* Unwrap substitutions both before _and_ after potential simplification

* Repeatedly unwrap/simplify until no more can be performed

* Use seperate loops for source and target to reduce redundant calls

* Move loop into function

* Inline worker
2020-02-25 17:36:56 -08:00
Wesley Wigham
4d5464e1f9 Revert "Support declaration emit for late bound element accesses assigned to functions in both TS and JS (#36593)" (#37034)
This reverts commit 3e4ce4777d.
2020-02-25 16:40:38 -08:00
Anders Hejlsberg
9ed73ebbbf Properly handle control flows from returns in try/catch within IIFE (#36901)
* Properly handle control flows from returns in try/catch within IIFE

* Accept new baselines

* Add tests

* Accept new baselines

* When end of finally is unreachable, end of try statement is too

* Add additional test case
2020-02-25 16:14:00 -08:00
Sheetal Nandi
e89df5ce6f Handle getScriptVersion correctly to ensure program structure is checked correctly (#36808)
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect

* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes #36748

* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands

* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge

* Update src/server/project.ts

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Make clearSourceMapperCache required

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 16:11:21 -08:00
Wesley Wigham
e99173a6f9 Ignore data- props when excess property checking (#36952) 2020-02-25 15:52:24 -08:00
Wesley Wigham
d92aca2715 Reduce lerna loglevel (#37024)
* Reduce lerna loglevel

* Also add silent
2020-02-25 14:23:55 -08:00
Orta
8a797cad2b Adds floating block comments to the outlining spans response (#36880)
* Adds floating block comments to the outlining spans response

* Only use one route for grabbing outline nodes, which now includes special casing the EOF token
2020-02-25 17:09:16 -05:00
Ryan Cavanaugh
43863cafe2 Check for undefined source.symbol (#37021)
Fixes #37014
2020-02-25 13:46:24 -08:00
Wesley Wigham
3e4ce4777d Support declaration emit for late bound element accesses assigned to functions in both TS and JS (#36593) 2020-02-25 13:45:27 -08:00
Wesley Wigham
7d8dc730b7 Baseline arity checks for jsx sfc tags (#36643)
Finish comment

PR feedback
2020-02-25 13:44:22 -08:00
Wesley Wigham
e536c89872 Add js-equivalent test for the binary expression stress and introduce trampoline into getJSSyntacticDiagnosticsForFile (#36724)
* Add js-equivalent test for the binary expression stress and introduce trampiline into getJSSyntacticDiagnosticsForFile

* Update src/compiler/parser.ts

Comment text update

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Fix lint

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 13:29:34 -08:00
Wesley Wigham
6d1361c192 Add --force to vue-next dockerfile since latest image version errors without it 2020-02-24 17:38:16 -08:00
Nathan Shively-Sanders
3e3df8702c Fix crash on aliased,exported @enum tag in jsdoc (#36996)
THe code to bind `@enum` and `@typedef` didn't handle the case that the
`@enum` was on a property assignment to an alias of module.exports.
Specifically, `x` needs to be correctly aliased to the file's symbol in
the example below:

```
var x = module.exports = {};
/** @enum {string} */
x.E = {
  A: "A"
};
```
2020-02-24 16:13:18 -08:00
Wesley Wigham
65e7acce58 Use getters to define live export bindings refresh (#35967)
* use getters to define live export bindings

* fix scoping in export* helper

* Object.defineProperty cannot be used in ES3 target

* Accept changed baselines

* Use function expression, not arrow function

* Update importStarHelper to match export helper in binding-making

* Fix whitespace

* Adjust whitespace in edited helpers

* Use new helper for setting bindings, use unscoped __exportStar helper for exports so helpers get reused more

* Accept updated baselines

* Use __createBinding for individual reexports when target is es3

* Remove unneeded type assertion

* Singeline the helpers

* Add check for createBinding helper, accept updated baselines with shortened helper

Co-authored-by: Michael Rawlings <mirawlings@ebay.com>
2020-02-24 15:36:14 -08:00
Ryan Cavanaugh
2b69b2281a Properly handle both special export forms when renaming (#36914)
* Properly handle both special export forms when renaming

Fixes #36713

* Lint
2020-02-24 13:17:02 -08:00
Wesley Wigham
3bec9ad2c5 Set CI=true in the office-ui-fabric docker test so it doesnt use a progress indicator (#36982) 2020-02-24 12:45:14 -08:00
Ron Buckton
fd8000dd59 Fix class emit in converted loop body (#36795) 2020-02-24 10:55:13 -08:00
Wesley Wigham
ebca423a6e Add elaboration & quickfix for async-able arrow function (#36342) 2020-02-21 15:51:02 -08:00
Nathan Shively-Sanders
6b645f582b Fix find-refs crash on JSDocNamepath (#36941)
JSDocNamepaths span a lot of identifiers that we don't actually care
about, so it's incorrect for createChildren to add its children as
synthetic nodes.
2020-02-21 15:37:11 -08:00
Klaus Meinhardt
24dd93fc2b Fix access of protected members on generic this-type (#36928)
Fixes: #36926
2020-02-21 09:33:21 -08:00
Nathan Shively-Sanders
f10c9ea471 azure-sdk test: move typescript location (#36902) 2020-02-20 10:09:37 -08:00
Alexander T
bf6be75131 feat(36048): handle uncalled function checks in ternaries (#36402) 2020-02-20 09:29:41 -08:00
Alexander T
c8147cb601 fix(33377): use quoteStyle option for string literals completions (#36720) 2020-02-20 08:45:07 -08:00
Andrew Branch
1236a1006c Fix initialization error when destructuring from object literal that includes a spread assignment (#36865)
* Add test

* Fix superfluous error when destructuring from object that includes spread assignment

* Update baseline to include error case

* Remove redundant check
2020-02-19 08:28:12 -08:00
Alexander T
bab0c99584 fix(29565): Add missing super() quickFix errors for constructo… (#36601) 2020-02-18 13:00:31 -08:00
Alexander T
bc12123115 fix(29908): Declare static method/property quickfix can add st… (#36854) 2020-02-18 11:27:35 -08:00
Klaus Meinhardt
9b518c8f53 Exempt ambient private properties from noImplicitAny (#36640) 2020-02-14 15:01:18 -08:00
Alexander T
c59fcae117 fix(30003): formatter deletes comments after trailing comma (#36674) 2020-02-14 14:57:18 -08:00
Andrew Branch
b1e706d911 Set correct pos for NamespaceExport (#36794)
* Set correct pos for NamespaceExport

* Update tests
2020-02-14 12:45:26 -08:00
Andrew Branch
950b36192a Fix renaming an ExportSpecifier name when propertyName is present (#36790)
* Fix renaming exportSpecifier name when propertyName is present

* Add baseline test for name without propertyName too
2020-02-13 16:55:52 -08:00
Daniel Rosenwasser
210090b483 No template refactor on plain strings (#36785)
* Add/convert to failing tests.

* Stop offering to convert single string literals to template expressions.

* Ensure we're actually testing for single quotes.
2020-02-13 12:22:53 -08:00
Alexander T
e435054b3b fix(36416): empty import path causes server crash (#36751) 2020-02-12 14:26:51 -08:00
Jack Bates
bf370659b3 Don't npm install the parent project with no args (#35359) 2020-02-12 14:19:46 -08:00
Nathan Shively-Sanders
a772c26a71 Error when property is specified more than once via a spread (#36727)
* add tests but not baselines or fixes

* Update original change

Still probably wrong; probably doesn't even compile beacuse I'm just
typing on my laptop.

* fix error code ok

* notes to self

* Error: property is specified more than once via spread

* make jsx tests stricter

* update semicolon error message

* use ?. because it is great

* use maybeTypeOfKind in new code

* restore jsx error

* add tests
2020-02-11 10:23:15 -08:00
Brad Zacher
348c4dddc6 Throw syntax error for } and > in JSX text (#36636)
* Throw syntax error for `}` and `>` in JSX text

Fixes #36341

* Add codefix for error
2020-02-11 11:44:17 -05:00
Andrew Branch
ad8c209fc2 Use type-only imports in auto-imports when it would be an error not to, and use auto-imports in “implement interface” fix (#36615)
* Refactor fix-all-missing-imports to be reusable by other codefixes

* Migrate infer-from-usage to use ImportAdder

* Add infer from usage test importing more than one thing in a single fix

* Migrate implement interface / abstract members fixes to use ImportAdder

* Update old tests

* Use type-only imports when it would be an error not to

* Add another test

* Rename stuff
2020-02-10 17:13:35 -08:00
Wesley Wigham
aece8c06b0 Allow intersections (and substitutions) to be checks against discriminable unions (#36663) 2020-02-10 15:26:46 -08:00
Nathan Shively-Sanders
1e48cbe2c9 Fix jsdoc comment parsing initial state (#36661)
* Fix jsdoc comment parsing initial state

Jsdoc comment parsing can be invoked in two modes:

1. top-level parsing, for comments not inside a tag.
2. tag parsing, for comment that occur after the semantic parts of a
tag.

Top-level parsing skips an initial * because it assumes that it is starting
at the very beginning of a JSDoc comment. Tag parsing does not.

The two modes are distinguished by an optional second parameter named
`margin`. When `margin` is provided, it provides an initial indent used
for comment alignment.

Previously, the check for `margin` was a truthy check `if (margin)`.
This check incorrectly treats `margin=""` the same as
`margin=undefined`.

This PR changes the check to `if (margin !== undefined)`, which
correctly treats `margin=""` the same as `margin="    "`.

* Fixes for broken tests

1. Use SawAsterisk start state.
2. @template needs to skip asterisk in addition to whitespace while
parsing type parameter names.

* undo code move
2020-02-07 08:35:40 -08:00
Nathan Shively-Sanders
2cc585668d Support property declarations in jsdoc template generation (#36658)
* Support property declarations in jsdoc template generation

* fix lint and add test
2020-02-06 14:38:21 -08:00
Wesley Wigham
7ffaf2aeb0 Add vue-next to docker suite (#33865)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-05 12:48:06 -08:00
Wenlu Wang
70399e146e add support for Lift Template Literal Restriction (#23801)
* add support for Lift Template Literal Restriction

* rename file and improve comment and tests

* fix NoSubstitutionTemplateLiteral support

* extract tagged template and add more test

* avoid useless parameter

* fix incorrect return node if cannot transform

* accept baseline

* correctly baseline

* accept baseline

* fix merge break

* fix merge break

* inline rescan template head or no subsititution template

* update scan error

* add comment and fix lint

* refactor and fix lint

* avoid blank

* fix merge conflict

* fix again

* fix again

* use multiple target

* fix space lint

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-05 08:59:51 -08:00
Andrew Branch
20471182fc Fix crash when trying to import a non-exported type (#36619)
* Fix crash when trying to import a non-exported type

* Add related info on each declaration
2020-02-05 08:27:49 -08:00
Wesley Wigham
044355ba5f Add rxjs to the docker suite (#33500) 2020-02-04 16:00:08 -08:00
Orta
7726464abd De-duplicate indentations in JSX Texts (#36552)
* WIP on making the JSX text node not include whitespace

* Scans to the last newline for JSX correctly

* Handle JSX closing element wrapping

* Offload all jsx text indentation handling to indentMultilineCommentOrJsxText

* Switch from find node -> find inde in formatting

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-02-03 17:09:50 -05:00
Alexander T
1c42fd4bdf fix(33600): disallow convertFunctionToEs6Class Quick Fix for IIFE (#36580) 2020-02-03 16:52:08 -05:00
Andrew Branch
ef8eb0c876 Fix contextually typed object literal completions where the object being edited affects its own inference (#36556)
* Conditionally elide a parameter from contextual type signature calculation

* Slightly different approach to forbid inference to specific expressions

* Handle nested literals and mapped types correctly

* Delete unused cache

* Rename ContextFlags.BaseConstraint and related usage

* Add tests from my PR

* Update ContextFlags comment

Co-Authored-By: Wesley Wigham <wwigham@gmail.com>

* Update comments and fourslash triple slash refs

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-01-31 15:37:18 -08:00