7504 Commits

Author SHA1 Message Date
Daniel Rosenwasser
8923eec80a Added tests for 'import.meta'. 2018-04-09 15:26:30 -07:00
Wesley Wigham
83ab341531
Allow variable statements used as declaration sites to be marked visible (#22798)
* Allow variable statements used as declaration sites to be marked visible and included in declaration emit by alias marking

* Dont forget to transform statements

* Accept baselines

* Accept updated baselines for new test

* Emit scope fix markers

* Add partial private variable declaration emit test
2018-04-09 14:30:40 -07:00
Andy
98a5e5cc0d
Prioritize spelling fix over add-missing-member fix (#23268) 2018-04-09 13:23:11 -07:00
Andy
998beadba2
Support goto-definition for index signatures (#23220)
* Support goto-definition for index signatures

* Use checker.getIndexInfoOfType

* Handle undefined info.declaration
2018-04-09 12:48:41 -07:00
Andy
9762598775
findAllReferences: forEachRelatedSymbol can always include shorthand destructuring (#23223)
* findAllReferences: forEachRelatedSymbol can always include shorthand destructuring

* Update rename tests
2018-04-06 16:30:55 -07:00
Nathan Shively-Sanders
c4788f9198
Update user tests with improved lib settings (#23238) 2018-04-06 16:16:34 -07:00
Nathan Shively-Sanders
a7a01eadba
Allow both module.exports= and module.exports property assignments (#23228)
* Combining symbol and removing error done but messy

* Small fix + add new test baselines

All other tests are unchanged

* Union conflicting assignment types+better names

* Add tests and update baselines

* Check commonjs export= from resolveExternalModuleSymbol
2018-04-06 13:04:39 -07:00
Andy
70682b7799
Clean up code for nonrelative path completions (#23150)
* Clean up code for nonrelative path completions

* Remove unnecessary test and simplify based on that

* More code review

* Call getCompletionEntriesFromTypings unconditionally
2018-04-06 12:19:08 -07:00
Andy
05cd784230
Remove unnecessary test file (#23214) 2018-04-06 10:45:01 -07:00
Andy
2b59c9a0d7
Don't add import completion for re-export with different name (#23211) 2018-04-06 10:05:38 -07:00
Mohamed Hegazy
da312398f5
Merge pull request #23050 from gagoman/fix/22923
Fix issue #22923
2018-04-06 09:31:43 -07:00
Andy
aa8631de98
findAllReferences: Share code between populateSearchSymbolSet and getRelatedSymbol (#23028) 2018-04-05 15:00:14 -07:00
Alex Khomchenko
134b3411ee Fix issue #22923 2018-04-05 21:39:33 +02:00
Andy
24842b4002
When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00
Andy
f61f12613c
findAllReferences: Be consistent how we handle unions in root symobls (#23002) 2018-04-05 10:55:55 -07:00
Nathan Shively-Sanders
9dd8e296f3
Fix crash in type resolution in JS IIFEs (#23171)
* Fix crash in type resolution in JS IIFEs

We recognise IIFEs as JS special assignment initialisers, but not as
containers otherwise. That means that IIFEs will not have a symbol
unless they have an *outside* assignment.

The permanent fix will be to make IIFEs a container, based on the
containership of the value that they return. This fix does not do that;
it just makes type resolution return undefined instead of crashing.

* Comment the IIFE-fix line
2018-04-05 09:57:35 -07:00
Nathan Shively-Sanders
154ac342cb
Allow extending any, with noImplicitAny errors (#23153)
Allow extending any, without noImplicitAny errors
2018-04-05 08:52:56 -07:00
Andy
7520f9578b
Fix bug: <div a="1" b/**/ > is not a jsx initializer (#23138) 2018-04-05 08:30:02 -07:00
Wesley Wigham
de669cf827
Only include unique symbols when getting index types for access checks (#23145)
* Only include unique symbols when getting index types for access checks

* Filter all nonstrings

* Inline ternary
2018-04-04 18:03:21 -07:00
Nathan Shively-Sanders
dca3a94f88
Print js-constructor function type names (#23089)
* Print js-constructor function type names

Instead of printing them as a type literal, which is scary.

* Use assigned name for functions and classes

That otherwise have no name. This helps quick info for javascript a
*lot*. Typescript mainly benefits when printing the type of class
expressions.

* Improve names of functions in binding elements

Also fix some fourslash baselines
2018-04-04 15:43:41 -07:00
Wesley Wigham
9b987eb947
Dont bind a local symbol for a default export without a name (#23152) 2018-04-04 15:26:10 -07:00
Andy
6286c7577d
Allow rest parameter trailing commas in ambient contexts (#23139) 2018-04-04 11:33:29 -07:00
Nathan Shively-Sanders
c4a504b3ce
Prototype assignments count as method-like (#23137)
* Prototype assignments count as method-like

For the purposes of reporting prototype/instance property conflicts

* Fix lint
2018-04-04 11:03:31 -07:00
Nathan Shively-Sanders
eb3a9d05df
Fix factorial jsdoc search:chained assignments (#23115) 2018-04-04 08:57:13 -07:00
Andy
4aeb295e3a
completions: Properly handle preferences.includeCompletionsWithInsertText (#23092) 2018-04-04 08:36:48 -07:00
Mohamed Hegazy
db74229a89
Merge pull request #19317 from igelbox/fix-insert-space-after-function-generic
Fixed incorrect insertSpaceBeforeFunctionParenthesis behavior on funtions with type-arguments
2018-04-03 16:11:30 -07:00
Nathan Shively-Sanders
6b158de866
No error referring to UMD symbol in CommonJS modules (#23129) 2018-04-03 16:10:09 -07:00
Wesley Wigham
78ba32a110
Allow multiple class base types; intersect them, as with interfaces (#23123) 2018-04-03 16:08:52 -07:00
Wesley Wigham
343bb5ac70
Actuallt preserve nonblock for of statements in forofs with object rest (#23122) 2018-04-03 13:32:42 -07:00
Mohamed Hegazy
84548d5c9b
Merge pull request #22049 from Kingwl/spelling-fix
replace element access if suggession is not a valid identifier
2018-04-03 13:29:43 -07:00
Anders Hejlsberg
6646717ce7
Merge pull request #23112 from Microsoft/fixTPReferenceLookups
Fix type parameter reference lookups
2018-04-03 12:32:05 -07:00
Wesley Wigham
cbce76ed13
Consider jscontainer aliases as referencible even if they have other local meanings (#23119) 2018-04-03 12:27:16 -07:00
Wesley Wigham
a81a645128
Enable member completions for import types (#23085)
* Enable member completions for import types

* Add missing semicolon

* Compact statements

* Ye doth compacteth too much

* Handle class accesibility
2018-04-03 11:53:01 -07:00
Anders Hejlsberg
cdf155e980 Add regression test 2018-04-03 09:04:36 -07:00
Nathan Shively-Sanders
11eabc0946
Skip parens and non-null assertions when looking for this-context (#23097)
* Skip parens and ! for getting this-context of call

* Add test and improve code a bit

* Use skipOuterExpressions instead
2018-04-03 06:23:59 -07:00
王文璐
414266cc32 Merge branch 'master' into spelling-fix 2018-04-03 10:51:40 +08:00
Andy
1e04bd4168
Support completions for members with symbol names (#23091) 2018-04-02 18:08:00 -07:00
Anders Hejlsberg
751eab9eed
Merge pull request #23067 from Microsoft/fixTPReferenceInConditional
Fix type parameter reference checks in conditional types
2018-04-02 17:30:32 -07:00
Wesley Wigham
fd553df3a6
Path completions for import types (#23082)
* Path completions

* Add missing flag to test

* Minify test, fix lint
2018-04-02 16:15:50 -07:00
Andy
8e14ac7d51
Improve string literal completions from a signature (#23062) 2018-04-02 13:01:31 -07:00
Nathan Shively-Sanders
d3e0929b14
Mark js-assignment functions' symbols as methods (#23078)
This make display more accurate:
1. The functions now print as methods
2. When the type of the function references the class, the type of the
function itself is now printed correctly instead of as `any`.
2018-04-02 12:17:35 -07:00
Andy
d5142a7f45
Don't offer import completions in non-module files unless "--module" is set (#22951)
* Don't offer import completions in non-module files unless "--module" is set

* Even smarter shouldOfferImportCompletions
2018-04-02 10:21:14 -07:00
Wesley Wigham
414bc49cc4
Module or import types (#22592)
* Type side of import types

* Value side of import types

* Accept library changes

* Refined implementation, more tests

* Allow resolutions to be performed late if the resolution still results in a file already in the build

* Add another test case

* Add some jsdoc usages

* Allow nodebuilder to use import types where appropriate

* Parse & check generic instantiations

* use import types in nodebuilder for typeof module symbols

* Wire up go to definition for import types

* Accept updated type/symbol baselines now that symbols are wired in

* PR feedback

* Fix changes from merge

* Walk back late import handling

* Remove unused diagnostic

* Remove unrelated changes

* Use recursive function over loop

* Emit type arguments

* undo unrelated change

* Test for and support import type nodes in bundled declaration emit
2018-04-02 10:18:23 -07:00
Nathan Shively-Sanders
5c442419dc
Include arrow functions as javascript initializers (#23068)
This means that they are treated as valid js containers, methods, etc.
2018-04-02 10:11:39 -07:00
Nathan Shively-Sanders
6d9a8250bd
Improve binding and jsdoc of chained special js assignments (#23038)
* Search for jsdoc on chained assignments

* Fix binding of chained binary expression js-assignments

* Test:chained jsdoc+chained prototype assignment

* Improve naming
2018-04-02 09:47:01 -07:00
Anders Hejlsberg
ec02ccd575 Add regression test 2018-04-02 09:23:00 -07:00
Andy
ea65f21677
textChanges: Don't crash when inserting type annotation on function with no parens (#23034) 2018-04-02 08:41:22 -07:00
Andy
86a8e269fa
Add 'getNameFromPropertyName' helper (#23036) 2018-04-02 08:14:15 -07:00
Anders Hejlsberg
b3829523b2
Merge pull request #23039 from Microsoft/fixConditionalConstraints
Improve conditional type constraints
2018-03-31 11:56:05 -07:00
Wesley Wigham
9b558f9535
Remove _this, _super, and _newTarget name conflict errors (#22890)
* Add new generated name kind for reused transpiler variables

* Remove error on _super or _newTarget conflict

* Add test with super helper conflict

* Remove error on _this conflict

* Fix lint

* Use flags instead of generated kinds, inline some things

* Accept rename

* Remove trailing whitespace

* Move helper emit into printer, rather than emitter"

* passthru module and target

* New test, accept baselines

* Make members private
2018-03-30 17:43:37 -07:00