7522 Commits

Author SHA1 Message Date
Anders Hejlsberg
5f0d88096c Update test 2018-04-18 15:43:32 -07:00
Anders Hejlsberg
16cd5580a6 Merge branch 'master' into improveIndexTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/server/utilities.ts
2018-04-16 16:18:29 -07:00
Andy
aac9ef5e51
convertToEs6Module: Avoid replacing entire function (#22507)
* convertToEs6Module: Avoid replacing entire function

* Code review

* Fix typo
2018-04-16 13:16:04 -07:00
Nathan Shively-Sanders
941777848f
Switch webpack to submodule (#23372)
* Prepare for adding webpack submodule

* Actually switch webpack to submodule

I'm sure this will work with no problems!

* Add ignore=all to webpack gitmodule entry

The other submodules do this, although I'm not sure why.

* Add newline at end of .gitmodules
2018-04-12 14:09:07 -07:00
Andy
d2dc2e6d48
Don't copy trivia when implementing an interface (#23343)
* Don't copy trivia when implementing an interface

* Use an `includeTrivia` flag instead of a separate function
2018-04-12 11:47:42 -07:00
Nathan Shively-Sanders
5d23cb49d0
Exclude generated files from user tests (#23371)
* Exclude generated files from user tests

The top 3 offenders, at least: bcryptjs, bluebird and lodash.

* Clean url-search-params too

Only need to build the commonjs original, not the browserified ones.
2018-04-12 10:25:53 -07:00
Andy
d36f83a98d
Remove TODO: GH#18795 comments (#23337) 2018-04-11 16:23:04 -07:00
Andy
b0552b089d
Don't include "/index" in import from @types even with classic resolution (#23347) 2018-04-11 16:22:10 -07:00
Nathan Shively-Sanders
79ad7df7e1
Improve user test tsconfig (#23325)
* Improve user test tsconfigs

Also incorporate updates from the packages themselves (they fixed
some of the bugs the compiler noticed).

* Fix enhanced-resolve module resolution

* Update baselines after merge w/master
2018-04-11 15:59:19 -07:00
Andy
f6b206a75a
When testing references, also test documentHighlights respects filesToSearch (#23306)
* When testing references, also test documentHighlights respects filesToSearch

* Fix handling for redirects and move assertion inside getDocumentHighlights

* Add another assert
2018-04-11 14:07:22 -07:00
Nathan Shively-Sanders
9ceb113ec5
Allow exports assignments (#23319)
1. Allow assignment to `exports`.
2. The type of the rhs is not checked against the type of `exports`
since they are aliased declarations.

To support more complex patterns like `exports = c.name = c`, we may
have to treat `c.name` as a declaration. That will be more complicated
than this PR.
2018-04-11 06:49:58 -07:00
Wesley Wigham
8a2b4646f0
Include guards on comment kind in pragma extraction (#23313) 2018-04-10 20:50:31 -07:00
Anders Hejlsberg
0a37cd3736 Update test 2018-04-10 17:35:27 -10:00
Wesley Wigham
b2e0c4bea6
Add support for destructuring well-known and late-bound names (#23297)
* Add support for destructuring well-known and late-bound names

* Add test of not present late bound prop
2018-04-10 18:21:24 -07:00
Wesley Wigham
1243d1a9ba
handle any'd method signature types (ie, from special property declarations) (#23316) 2018-04-10 18:17:57 -07:00
Nathan Shively-Sanders
22919d57fe
JSDoc:positional matching of destructured params (#23307)
* JSDoc:positional matching of destructured params

1. When looking up tags for a parameter whose name is a binding pattern, use
the index of the parameter to get the type.
2. When reporting errors for `@param` tags with no matching parameter
name, do not report the error for tags whose index in the `@param` tag list
matches the index of a parameter whose name is a binding pattern.

* Change to an assert

* Improve comment text
2018-04-10 12:48:35 -07:00
Wenlu Wang
9c0671d661 add refactor of convert private field to getter and setter (#22143)
* add refactor of convert private field to getter and setter

* fix refactor

* stash

* refactor accessor generate

* revert merge union type

* refeactor and accept baseline

* add support of PropertyAssignment and StringLiteral

* add support for js file

* allow static modifier in js file
2018-04-10 11:51:41 -07:00
Andy
ce5d22fef0
Fix bug: don't insert a semicolon when inserting a FunctionDeclaration (#23240) 2018-04-09 15:03:24 -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
Anders Hejlsberg
0379666bbf Update tests 2018-04-09 08:51:55 -10: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