Commit Graph

11337 Commits

Author SHA1 Message Date
Anders Hejlsberg
b11be80349 Don't widen unique symbol types during type inference 2018-04-17 16:29:42 -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
cc6bc763bc Simplify getConvertibleFieldAtPosition (#23315) 2018-04-16 09:30:10 -07:00
Anders Hejlsberg
8cb515ab13 Add members for numeric and symbol named properties in mapped types 2018-04-16 07:16:26 -07:00
Anders Hejlsberg
c344e6d0ba Fixes and improvements to indexed access type relationships 2018-04-14 17:10:05 -10:00
Ryan Cavanaugh
ff60520460 Merge branch 'master' into referencesDogfood_1 2018-04-12 12:26:10 -07:00
Andy
afcced6839 Simplify tryGetImportOrExportClauseCompletionSymbols (#22961)
* Simplify tryGetImportOrExportClauseCompletionSymbols

* Handle undefined key in arrayToSet
2018-04-12 11:55:21 -07:00
Ryan Cavanaugh
df95de3231 Merge branch 'master' into referencesDogfood_1 2018-04-11 16:17:38 -07:00
Ryan Cavanaugh
5b3254957c Explicitly list compiler source files in their current emitted order 2018-04-11 15:38:26 -07:00
Ryan Cavanaugh
8294259ec2 Remove all reference comments from compiler/ 2018-04-11 15:38:26 -07:00
Andy
28455c65b3 patternMatcher: Return single best match instead of list (#23166) 2018-04-11 15:35:22 -07:00
Andy
fef28665f7 generateGetAccessorAndSetAccessor: Fix typos and use type predicate (#23310) 2018-04-11 13:21:47 -07:00
Andy
a004571d3e Update outdated comments (#23320) 2018-04-11 07:56:42 -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
Brandon Slade
82e8bcf3b2 Fix typeo: rename udpateReportDiagnostic to updateReportDiagnostic 2018-04-10 21:58:18 -06:00
Wesley Wigham
8a2b4646f0 Include guards on comment kind in pragma extraction (#23313) 2018-04-10 20:50:31 -07:00
Anders Hejlsberg
b40592c34e String index signatures do not apply to symbols 2018-04-10 17:35:11 -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
Andy
dcc4b8854b In getWidenedTypeFromJSSpecialPropertyDeclarations, parent of PropertyAccessExpression must be a BinaryExpression (#22727) 2018-04-10 14:46:26 -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
Andy
4b706fc479 Add 'disableSuggestions' to UserPreferences (#23283)
* Add 'disableSuggestions' to UserPreferences

* Make mergeMapLikes return a new object

* Avoid additional clone

* mergeMapLikes -> object spread
2018-04-10 11:53:24 -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
556a8010b9 Fix bug: ensure 'reportsUnnecessary' is actually sent by tsserver (#23293) 2018-04-10 10:15:15 -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
71b39014eb Fix bug: Include comment for @param tag with nested tag (#23276)
* Fix bug: Include comment for @param tag with nested tag

* Add another comment to test
2018-04-09 14:09:59 -07:00
Anders Hejlsberg
6d93f30839 Enable 'keyof T' for full string | number | symbol 2018-04-09 08:51:26 -10:00
Anders Hejlsberg
ff20f38405 Add support for numbers and symbols in keyof (but keep it disabled) 2018-04-09 07:45:13 -10:00
Sheetal Nandi
4170f35abc Merge pull request #23239 from Microsoft/skipWatchingTypeCacheInfos
Skip watching script infos in the global type cache location
2018-04-06 17:06:37 -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
Andy
e0dbdad22a IndexInfo#declaration is always an IndexSignatureDeclaration (#23232) 2018-04-06 16:20:45 -07:00
Sheetal Nandi
7a0a1f6a28 Do not watch script infos that are part of global typings location 2018-04-06 15:52:39 -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
Mohamed Hegazy
724b74615b Merge pull request #23218 from TravCav/master
Bit more code cleanup
2018-04-06 11:23:33 -07:00
TravCav
9861569ae9 found another place to fall through in the checker 2018-04-06 13:40:58 -04:00
Anders Hejlsberg
fc85ba9e6a Limit getLiteralTypeFromPropertyName to only return string-like types 2018-04-06 09:52:00 -07:00
Mohamed Hegazy
da312398f5 Merge pull request #23050 from gagoman/fix/22923
Fix issue #22923
2018-04-06 09:31:43 -07:00
TravCav
60bd7e861c removed always true condition 2018-04-06 12:23:41 -04:00
Anders Hejlsberg
39bb93fb1a Move nameType to base Symbol, generate nameType properties where missing 2018-04-05 16:00:06 -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
TravCav
77164e1eb9 redundant code 2018-04-05 12:58:42 -04: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
Mohamed Hegazy
9cb473e102 Merge pull request #23170 from TravCav/master
isDefaultExport is always false here.
2018-04-05 09:49:46 -07:00
Mohamed Hegazy
521f2dc869 Merge pull request #23165 from TravCav/master
removed unused code
2018-04-05 08:58:51 -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
TravCav
42d226ca42 isDefaultExport is always false here. 2018-04-05 10:38:51 -04:00
TravCav
3ce25593cd removed unused code 2018-04-05 10:29:35 -04:00