Commit graph

11315 commits

Author SHA1 Message Date
Mohamed Hegazy 2152683325 Simplify logic 2016-11-29 16:55:50 -08:00
Mohamed Hegazy 2178d5526f extract filterNullableTypes 2016-11-29 16:30:27 -08:00
Anders Hejlsberg aaf0c89ed3 Merge pull request #12563 from Microsoft/mappedTypeModifiers
Preserve modifiers in homomorphic mapped types
2016-11-29 16:06:20 -08:00
Arthur Ozga 3cd1731628 abstract accessors can't have implementations 2016-11-29 15:59:28 -06:00
Nathan Shively-Sanders fe55edc38e Rest in an untyped binding pattern should be any 2016-11-29 13:46:00 -08:00
Mohamed Hegazy 17b6645a70 add missing semicolons 2016-11-29 13:37:02 -08:00
Anders Hejlsberg f55b3ef87a Preserve modifiers in isomorphic mapped types 2016-11-29 12:48:41 -08:00
Arthur Ozga ba80ce63ad stubbing extra completions 2016-11-29 14:33:20 -06:00
Mohamed Hegazy 86b48e3f89 Handel null and undefined in __rest 2016-11-29 12:26:57 -08:00
Mohamed Hegazy 216f286133 Handel null and undefined in object spread and rest 2016-11-29 12:25:10 -08:00
Arthur Ozga bf48564cc8 FIx typo in method stub. 2016-11-29 13:36:09 -06:00
Mohamed Hegazy 5c4f145d6a Change name of the function 2016-11-29 10:36:55 -08:00
Vladimir Matveev 1418fd170d send begin/end notifications when installing types packages (#12551) 2016-11-29 10:14:22 -08:00
Mohamed Hegazy 5c10764d9b Fix function name 2016-11-29 00:13:04 -08:00
Mohamed Hegazy f2e30f6693 Allow union and intersection as targets for object spread and rest, and distribute spread&rest over unions 2016-11-29 00:04:20 -08:00
Iwata Hidetaka aaf87735cc tsserver: get candidates from <K extends keyof Foo> (fix #12536) 2016-11-29 10:34:14 +09:00
Iwata Hidetaka 5f073a6316 expose getApparentType on TypeChecker interface 2016-11-29 10:34:09 +09:00
Mohamed Hegazy 82e84e272e Make sure all overloads have comments 2016-11-28 17:30:37 -08:00
Mohamed Hegazy 143fc9164f Revert https://github.com/Microsoft/TypeScript/pull/12207 2016-11-28 17:30:26 -08:00
Anders Hejlsberg c89b1eb9e9 Merge pull request #12386 from mariusschulz/union-and-intersection-types-with-leading-operator
Union and intersection types with leading operator
2016-11-28 15:57:24 -08:00
Arthur Ozga 5d6a714a04 move helpers under codefix dir 2016-11-28 17:40:59 -06:00
Arthur Ozga f37640a43e Add args to diagnostic message 2016-11-28 16:47:26 -06:00
Anders Hejlsberg 5dd4c9ef54 Merge pull request #12528 from Microsoft/mappedTypeInference
Type inference for isomorphic mapped types
2016-11-28 13:30:45 -08:00
Arthur Ozga 16b146f882 Use array instead of map 2016-11-28 15:26:55 -06:00
Arthur Ozga 680af0f782 use getStart() 2016-11-28 14:42:55 -06:00
Arthur Ozga 4af0e2ab5b Merge branch 'master' into interfaceFixes 2016-11-28 14:13:10 -06:00
Anders Hejlsberg 9065b50172 getRegularTypeOfLiteralType before exhaustive switch check 2016-11-28 10:53:25 -08:00
Anders Hejlsberg 3e1b443d77 Deduplicate intersection types before distributing over union types 2016-11-28 09:34:50 -08:00
Anders Hejlsberg 9970606f35 Remove unused code in resolveMappedTypeMembers 2016-11-27 19:58:05 -08:00
Anders Hejlsberg 8ee5f7d64f Remove unused case in type inference 2016-11-27 19:49:57 -08:00
Anders Hejlsberg ecd10be177 Reorder type inference cases 2016-11-27 12:48:59 -08:00
Anders Hejlsberg 0a1a3eced4 Merge branch 'master' into mappedTypeInference
# Conflicts:
#	src/compiler/checker.ts
2016-11-26 18:39:27 -08:00
Anders Hejlsberg 88b7d53978 Merge pull request #12515 from Microsoft/fixMappedTypeInference
Include mapped types in type inference infinite recursion check
2016-11-26 18:14:18 -08:00
Anders Hejlsberg 283c50c183 Merge pull request #12514 from Microsoft/keyofAndForIn
Fix issues related to 'keyof' with 'for-in' and 'in' operator
2016-11-26 18:14:00 -08:00
Mohamed Hegazy 5ab2fec6e5 Merge pull request #12482 from wittydeveloper/fix-generateClassElementDecorationExpression-documentation
doc(compiler/ts): fix documentation typo in generateClassElementDecorationExpression()
2016-11-26 14:45:12 -08:00
Anders Hejlsberg f2c32d251f Include mapped types in type inference infinite recursion check 2016-11-26 12:17:19 -08:00
Anders Hejlsberg 46ca0ba41e Fix multiple 'keyof' issues with 'for-in' and 'in' operator 2016-11-26 09:58:44 -08:00
Yuichi Nukiyama 13f52c9148 fix linting error 2016-11-25 00:40:50 +09:00
Charly POLY 7b37918a11 doc(compiler/ts): fix documentation typo about __decorator code generation
When __decorator applied to method, the last parameter (descriptor)
is null, not undefined
2016-11-24 10:16:21 +01:00
Anders Hejlsberg 36ad772c55 Type inference for isomorphic mapped types 2016-11-23 20:07:53 -08:00
Anders Hejlsberg cdda5dfd61 keyof T is a literal contextual type 2016-11-23 18:22:57 -08:00
Anders Hejlsberg e128add54e Merge pull request #12447 from Microsoft/mappedTypesAndUnions
Isomorphic mapped types and unions
2016-11-23 17:36:44 -08:00
Mohamed Hegazy 72cee3e045 Merge pull request #12434 from Microsoft/Fix12377
Add special handeling for function and array in Object.freeze
2016-11-23 13:26:36 -08:00
Sheetal Nandi c2bef6d0bd Merge pull request #12475 from Microsoft/jsxFactoryLeaf
Instead of creating clone of the jsxFactory's leaf node, create synthesized node
2016-11-23 13:23:20 -08:00
Vladimir Matveev c05bf3b0a2 respect casing when comparing names of config files (#12474) 2016-11-23 12:34:00 -08:00
Sheetal Nandi 20a8a30b76 Instead of creating clone of the jsxFactory's leaf node, create synthesized node
Fixes #12467
This avoid setting original node which would be something from isolated parsing and hence not valid when resolving expression
2016-11-23 12:26:02 -08:00
Sheetal Nandi 79bf477b67 Revert "Instead of creating clone of the jsxFactory's leaf node, create synthesized node"
This reverts commit 4e7313b4f6.
2016-11-23 12:24:44 -08:00
Sheetal Nandi 4e7313b4f6 Instead of creating clone of the jsxFactory's leaf node, create synthesized node
Fixes #12467
This avoid setting original node which would be something from isolated parsing and hence not valid when resolving expression
2016-11-23 12:22:28 -08:00
Mohamed Hegazy 15d870bdcf Use Function instead of call and construct signatures 2016-11-23 10:56:42 -08:00
Mohamed Hegazy 60395565e6 Handel call and construct signatures 2016-11-23 09:48:25 -08:00
Daniel Rosenwasser 4701eb70e2 Merge pull request #12357 from mylesmegyesi/12075-incorrectErrorMessageForUseOfTypeAsNamespace
Fixes error message when Type is used as a Namespace
2016-11-23 11:08:38 -05:00
Yuichi Nukiyama 4c9ab41e3d Merge branch 'master' into defult_export_error_message 2016-11-23 11:40:10 +09:00
Yuichi Nukiyama 31d0a5f225 Merge remote-tracking branch 'tsupstream/master' 2016-11-23 11:39:44 +09:00
jramsay 855431a943 Merge pull request #12373 from Microsoft/RenameTypingOptions
Rename typingOptions.enableAutoDiscovery to typeAcquisition.enable
2016-11-22 17:22:30 -08:00
Jason Ramsay 2b89d919a0 Addressing CR feedback 2016-11-22 17:08:43 -08:00
Anders Hejlsberg 864e1797d9 Merge pull request #12396 from Microsoft/getTypeOfExpression
Introduce 'getTypeOfExpression' function
2016-11-22 15:33:37 -08:00
Vladimir Matveev 680fb2ea1b add typings installer user agent for npm requests (#12446)
* add typings installer user agent for npm requests

* address PR feedback: change name of user agent
2016-11-22 14:56:18 -08:00
Anders Hejlsberg d7dd0289d5 Distribute isomorphic mapped types over union types 2016-11-22 14:27:39 -08:00
Tim Lancina 61204cc05d Re-add sourceFiles to program emit callback
Addresses https://github.com/Microsoft/TypeScript/issues/12444.
2016-11-22 14:20:47 -06:00
Mohamed Hegazy 75a9435d43 Merge pull request #12433 from Microsoft/updatelibreducesymbols
Port lib changes
2016-11-22 11:26:04 -08:00
Ryan Cavanaugh 86583d495c Merge pull request #12441 from RyanCavanaugh/jsDocAugments
Support JSDoc @augments tag
2016-11-22 11:23:45 -08:00
Zhengbo Li 103090b60e report config errors when config file changed (#12372) 2016-11-22 10:56:46 -08:00
Ryan Cavanaugh 6a5682c4a3 Support JSDoc @augments tag
Fixes #12428
2016-11-22 10:52:47 -08:00
Mohamed Hegazy 72df02cbbd Add function 2016-11-21 23:27:18 -08:00
Mohamed Hegazy 8a334ac00d Add special handeling for function and array in Object.freeze 2016-11-21 23:13:22 -08:00
Mohamed Hegazy ab8d6c0dab Port lib changes 2016-11-21 22:45:36 -08:00
Jason Ramsay 70e130b08c Maintain support for deprecated API typingOptions.enableAutoDiscovery 2016-11-21 18:17:27 -08:00
Mohamed Hegazy b8b6e61491 handel missing files gracefully 2016-11-21 17:26:18 -08:00
Mohamed Hegazy 5403ce62ed normalize path in harness 2016-11-21 17:26:10 -08:00
Anders Hejlsberg 77c0540433 Merge pull request #12425 from Microsoft/keyofOnlyStrings
Change 'keyof T' to always be string-like
2016-11-21 15:51:00 -08:00
Anders Hejlsberg 1710df5f28 Type of for-in variable is keyof T when object type is a type parameter 2016-11-21 12:56:32 -08:00
Vladimir Matveev 4c6b94f16f wrap subexpressions of conditional expressions in parens if necessary (#12420) 2016-11-21 12:52:13 -08:00
Andy 90ee161391 Merge pull request #12350 from Microsoft/default_excludes
Make "exclude" default to empty if "include" is present.
2016-11-21 12:23:53 -08:00
Anders Hejlsberg 854a20f1fe Update Record<K, T> type 2016-11-21 11:42:21 -08:00
Anders Hejlsberg 76ceab97dd Make keyof T a string-like type 2016-11-21 11:41:51 -08:00
Vladimir Matveev b060107b51 recompute character to column when comparing indentations (#12375)
recompute character to column when comparing indentations
2016-11-21 11:34:09 -08:00
Nathan Shively-Sanders 409253145e Merge pull request #12335 from Microsoft/getJSDoc-cleanup
getJSDocs cleanup
2016-11-21 11:30:27 -08:00
Andy baa228bbe8 Merge pull request #12415 from Microsoft/fix_lint
Fix lint errors
2016-11-21 10:53:16 -08:00
Andy Hanson 7c1f33f913 Fix lint errors 2016-11-21 10:42:54 -08:00
Zhengbo Li 110c3ac6ac Add locale options to tsserver (#12369)
* add locale options to tsserver

* make sys an argument

* fix mistakes and address code review
2016-11-21 10:30:38 -08:00
Anders Hejlsberg 998246af9c Merge pull request #12389 from Microsoft/keyofRelations
Minor fixes for 'keyof T' and indexed acces types
2016-11-20 15:54:41 -08:00
Mohamed Hegazy f8b8465a4c Merge pull request #12378 from andraaspar/master
Fix issue #12260.
2016-11-20 15:07:31 -08:00
Anders Hejlsberg 4ed3225c06 Add optimized getTypeOfExpression function 2016-11-20 08:13:39 -08:00
Marius Schulz cd70f22b88 Add “|” and “&” to list of tokens that start a type 2016-11-20 10:48:03 +01:00
Marius Schulz 443abe5373 Allow one leading ignored “|” or “&” in a type position 2016-11-19 22:30:18 +01:00
Anders Hejlsberg dcd225a892 Fix comparable relation for keyof T
Treat keyof T as string | number for purposes of indexing
Allow indexed access types with for-in and in operator
2016-11-19 09:03:23 -08:00
András Parditka c96bc89982 Fix issue #12260.
Fixed tsserver crashing on Android (Termux).
2016-11-19 11:28:11 +01:00
Yuichi Nukiyama 94c78961ef modify error message 2016-11-19 16:18:20 +09:00
Jason Ramsay 5a9451ae23 Rename typingOptions.enableAutoDiscovery to typeAcquisition.enable 2016-11-18 18:14:32 -08:00
Yuichi Nukiyama 725dbc2add Merge branch 'master' into defult_export_error_message 2016-11-19 10:51:42 +09:00
Yuichi Nukiyama 4edf1b714a Merge remote-tracking branch 'tsupstream/master' 2016-11-19 10:49:52 +09:00
Jason Ramsay 464bc0e9e0 Merge branch 'master' into tsconfigMixedContentSupportRedux 2016-11-18 16:15:15 -08:00
Nathan Shively-Sanders 71b28a024a Merge pull request #12310 from Microsoft/check-object-rest-destructuring-assignment
Check object rest destructuring assignment
2016-11-18 16:01:25 -08:00
Jason Ramsay 7dd30dbfd4 tsconfig.json mixed content support 2016-11-18 15:51:28 -08:00
Nathan Shively-Sanders 0c5429d3b7 Add missed jsDoc rename in services' Node implementation
Why would you implement an interface using a *class*?
2016-11-18 15:48:31 -08:00
Nathan Shively-Sanders 91e6bce34c Address PR comments 2016-11-18 15:44:15 -08:00
Nathan Shively-Sanders b514d7c91c Merge pull request #12362 from Microsoft/disable-evolving-types-with-implicit-any
Disable evolving types with implicit any
2016-11-18 15:39:02 -08:00
Nathan Shively-Sanders 7caee79ce7 Rename getJSDocComments -> getCommentsFromJSDoc 2016-11-18 15:10:19 -08:00
Nathan Shively-Sanders ab84cd0647 Improve readability of types and names 2016-11-18 15:03:40 -08:00
Sheetal Nandi f626ff777f Merge pull request #12363 from Microsoft/declarationsInFilesWithErrors
Fixes for #12291 and  #12326: Declaration emit when there are errors in the source file
2016-11-18 14:57:09 -08:00
Nathan Shively-Sanders 7750fe1a7c Always enable evolving types in Javascript files 2016-11-18 14:13:56 -08:00
Anders Hejlsberg e81da9cd8a Merge pull request #12351 from Microsoft/mappedTypeRelations
Higher order type relations for mapped types
2016-11-18 14:10:09 -08:00
Sheetal Nandi aa556502f3 Handle when type alias's type parameter extends type that wont get emitted in .d.ts
Fixes #12326
2016-11-18 14:02:57 -08:00
Nathan Shively-Sanders 8674d92bdb Disable evolving types with implicit any
That is, without --noImplicitAny
2016-11-18 13:51:44 -08:00
Vladimir Matveev 9945529875 use location of config file as initial location for automatic type reference inclusion if possible (#12341) 2016-11-18 13:39:11 -08:00
Anders Hejlsberg 2376e30410 Support apparent types for T[K] indexed access types 2016-11-18 13:30:56 -08:00
Sheetal Nandi cbde25f229 Handle the scenario when heritage clause of interface is not entity name expression
Fixes #12291
2016-11-18 13:11:33 -08:00
Myles Megyesi d8b0f239f1
Fixes error message when Type is used as a Namespace
Fixes #12075
2016-11-18 11:38:24 -06:00
Andy Hanson aa0d2ce2ee Make "exclude" default to empty if "include" is present. 2016-11-18 06:55:03 -08:00
Anders Hejlsberg 63387bb5e0 Error on circular constraints in mapped types 2016-11-18 06:13:04 -08:00
Anders Hejlsberg 2646828198 Type relations for generic mapped types 2016-11-17 20:18:00 -08:00
Mohamed Hegazy 9fec77551c Merge pull request #12217 from subzey/feature/rest-loop-index
Codegen: Do not subtract 0 in arguments to rest array loop
2016-11-17 17:31:57 -08:00
Nathan Shively-Sanders e81cfa10d6 Clean cache code and streamline other code
Cache only uses one property now. getJSDocs isn't generic and doesn't
take a function parameter any more. The code is overall easier to read.
2016-11-17 15:32:16 -08:00
Vladimir Matveev a2b13d05f2 pass project name as a constructor parameter (#12333) 2016-11-17 15:12:32 -08:00
Nathan Shively-Sanders ddffe209f9 Clean up getJSDocParameterTag
And delete its near-duplicate which was much less correct. The callers
that had to switch are slightly more complex and more correct now.
2016-11-17 14:26:38 -08:00
Nathan Shively-Sanders 5a05b94fb5 Clean up getJSDocs
1. Get rid of parent check.
2. Use a couple of nested functions, one of them a recursive worker.
2016-11-17 13:27:57 -08:00
Nathan Shively-Sanders ad9ad8f948 Clean up getJSDocTypeForVariableLikeDeclarationFromJSDocComment
Yeah, that name is way too long.
2016-11-17 11:08:11 -08:00
Anton Khlynovskiy 3e52f3dfe9 Codegen: Do not subtract 0 in arguments to rest array loop 2016-11-17 22:06:45 +03:00
Arthur Ozga 69118cd3e4 Merge branch 'master' into interfaceFixes
* resolved conflicts with 4/ interface for codefixes
2016-11-16 17:13:31 -08:00
Ryan Cavanaugh 29481f67f4 Revert "fix #11670, support type guards in NumberConstructor (#11722)"
This reverts commit 4fbbbed321.
2016-11-16 16:25:23 -08:00
Paul van Brenk 52ec508e27 Code fix for missing imports (#11768)
* Add codefix for missing imports + tests

* Re-order and cleanup

* refactor

* make tests pass

* Make import specifier for new imports more comprehensive

* Fix existing import cases

* refactor

* Fix multiple import statement case

* add multiple code fixes and code action filtering and polishing

* not using the generic verify method for import fixes.

* Correct insert position for new imports

* improve the code action filtering logic

* Fix line ending issue

* cache where we can
2016-11-16 16:01:16 -08:00
Nathan Shively-Sanders eaf2f6ce69 Merge branch 'master' into getJSDoc-cleanup 2016-11-16 15:52:01 -08:00
Nathan Shively-Sanders 0b0b68e79a Merge pull request #12312 from Microsoft/widen-literal-types-of-parameter-properties
Widen literal types of parameter properties
2016-11-16 15:51:42 -08:00
Nathan Shively-Sanders 5dbe5f4fbd Widen literal types of parameter properties 2016-11-16 15:24:42 -08:00
Zhengbo Li 6f409b580e Fix grammar issue (#12096)
* Fix grammar issue

* Improve the error message

* cr feedback
2016-11-16 14:13:29 -08:00
Anubha Mathur c970c78985 Add parameter type in function support comments for JS files 2016-11-16 13:59:06 -08:00
Nathan Shively-Sanders 074014e039 Check assignability: rest destructuring assignment 2016-11-16 13:41:25 -08:00
Ron Buckton d775f0f569 Improve diagnostic messages for imported helpers 2016-11-16 11:54:02 -08:00
Nathan Shively-Sanders d566c3be43 Merge branch 'master' into improve-spread-helper-emit 2016-11-16 10:53:05 -08:00
Ron Buckton 3a95f9244b Merge pull request #11874 from Microsoft/emitHelper
Move emit helpers into related transformers
2016-11-16 10:37:35 -08:00
Anders Hejlsberg a5d9e9624d Merge pull request #12301 from Microsoft/recursiveMappedTypes
Fix recursive mapped types
2016-11-16 10:23:14 -08:00
Ron Buckton 9a1a605f7c Merge branch 'master' into emitHelper 2016-11-16 10:14:20 -08:00
Nathan Shively-Sanders 8d24712d85 Improve __assign emit:remove getOwnPropertySymbols
Since __assign defaults to Object.assign if present, our own helper will
never be used in ES6 and higher, and `getOwnPropertySymbols` is not
needed in ES5 and below because symbols don't exist there.
2016-11-16 10:14:16 -08:00
Ron Buckton cd023b2715 PR Feedback 2016-11-16 10:06:16 -08:00
Anders Hejlsberg c5ab4735ac Resolve upfront so recursive mapped types appear empty 2016-11-16 06:48:51 -08:00
Ron Buckton 63b154056e Merge branch 'streamlineDestructuring' into emitHelper 2016-11-15 18:28:19 -08:00
Ron Buckton ec95f4f0f7 Merge branch 'streamlineDestructuring' into emitHelper 2016-11-15 18:13:52 -08:00
Ron Buckton 3a67174314 Merge branch 'master' into streamlineDestructuring 2016-11-15 18:10:02 -08:00
Ron Buckton a0da47fc89 Added missing places for visitParameterList 2016-11-15 18:09:47 -08:00
Ron Buckton 346d488c62 Merge branch 'master' into emitHelper 2016-11-15 17:13:57 -08:00
Ron Buckton ba4f52c055 Merge remote-tracking branch 'origin/object-rest-emit-for-method-and-accessor-parameters' into streamlineDestructuring 2016-11-15 17:09:49 -08:00
Ron Buckton 8733973d1f Merge branch 'streamlineDestructuring' into isolateObjectSpread 2016-11-15 14:50:42 -08:00
Arthur Ozga 389959a5b5 Merge branch 'master' into interfaceFixes
* additionally consolidated codeFix testing
2016-11-15 14:43:14 -08:00
Ron Buckton e389e08f71 Fix argument list for new containing yield 2016-11-15 14:04:07 -08:00
Arthur Ozga 6ed8d1803b unexpose resolveStructuredTypeMembers 2016-11-15 13:56:42 -08:00
Ron Buckton 0dd96f52e8 Merge branch 'master' into streamlineDestructuring 2016-11-15 13:38:56 -08:00
Anders Hejlsberg 73ada7a78d Merge pull request #12251 from Microsoft/fixTypePredicateStructuralMatch
Fix type predicates with structurally identical types
2016-11-15 13:20:35 -08:00
Anders Hejlsberg 0ba23483e8 Merge pull request #12276 from Microsoft/libMappedTypes
Predefined mapped types in lib.d.ts
2016-11-15 13:19:58 -08:00
Vladimir Matveev 4c2474463c ports #12237, #12258 and #12259 into master (#12274)
* treat failures to resolve module name as missing packages (#12237)

* added extra check to prevent multiple installation of the same typing, added version field to telemetry event (#12258)

* added extra check to prevent multiple installation of the same typing, added version field to telemetry event

* use ts.version

* switch to execSync to ensure that no install orders are interleaved (#12259)

* Make sure version is public

* Update file with version string for nightly release
2016-11-15 12:53:46 -08:00
Arthur Ozga 43afb806de remove fix
* fixRemoveAbstractModifierInNonAbstractClass.ts
2016-11-15 12:49:38 -08:00
Arthur Ozga a94d955d9d Aggregate changes before building result 2016-11-15 12:40:46 -08:00
Ron Buckton 98e192f357 Move transformFunctionBody back into es2015 2016-11-15 12:32:43 -08:00
Anders Hejlsberg d32196ff36 Add predefined mapped types and revise Object.freeze 2016-11-15 12:14:46 -08:00
Anders Hejlsberg fe3f88cd08 Properly handle identity relation for mapped types 2016-11-15 12:14:02 -08:00
Arthur Ozga d7d4bf6b04 Handle class expressions 2016-11-15 11:41:23 -08:00
Nathan Shively-Sanders bb46e789d5 Fix spread/rest emit for symbols.
It used the index of the symbol property as the name, not the symbol
itself.
2016-11-15 11:31:21 -08:00
Arthur Ozga 395d736843 Remove getSymbolOfNode from TypeChecker interface 2016-11-15 11:24:37 -08:00
Nathan Shively-Sanders 2496756aed Merge branch 'master' into object-spread-rest-fixes 2016-11-15 11:19:01 -08:00
Nathan Shively-Sanders 47f331926e Improve rest/spread emit for symbols
Previously, symbols were not handled.
2016-11-15 10:58:33 -08:00
Arthur Ozga c010a0e974 Use getTypeOfSymbolAtLocation 2016-11-15 10:57:48 -08:00
Paul van Brenk 1924298d87 Merge branch 'master' into unusedidentifier 2016-11-15 10:17:37 -08:00
Nathan Shively-Sanders b4d3bca32b Object rest emit for method and accessor parameters
I missed these before, so emit was incorrect for object rest in a method
or accessor parameter.
2016-11-15 09:50:29 -08:00
Nathan Shively-Sanders b9fa06f90b Address PR commennts
Update baselines with smaller emit as part of that.
2016-11-15 09:10:55 -08:00
Nathan Shively-Sanders a74e9d8ccf Merge pull request #12158 from Microsoft/fix-literal-comparability-in-relational-comparison-operators
Fix literal comparability in relational comparison operators
2016-11-15 08:24:06 -08:00
Ron Buckton dff9849ac9 Make multiLine optional in convertToFunctionBody 2016-11-14 18:33:21 -08:00
Ron Buckton ddcd22e4de Removed esnext dependency on convertForOf/transformFunctionBody in factory 2016-11-14 18:30:42 -08:00
Anders Hejlsberg d2c0952801 Revert type predicates to not have instanceof special casing 2016-11-14 17:13:49 -08:00
Mohamed Hegazy ddf2ad4ba1 Merge pull request #12247 from Microsoft/fix10840
Fix missing alias for decorated classes in es5
2016-11-14 17:09:33 -08:00
Ron Buckton cbdde421e6 Moved the parenthesizing functions to make the diff easier to read 2016-11-14 17:06:10 -08:00
Ron Buckton 60d5195112 Update baselines, fix assignment check for object rest. 2016-11-14 16:56:59 -08:00
Nathan Shively-Sanders 6f274eaabe Spread+rest fixes
1. Rename finds identifiers in spread assignment expressions.
2. Spreads with computed properties of type number or any no longer
crash the compiler.
3. Rest emit uses indexOf === -1 instead of !indexOf to filter properties.
4. Rest emit correctly refers to computed properties' generated temps.
2016-11-14 16:20:43 -08:00
Nathan Shively-Sanders e50adc0904 Merge pull request #12223 from Microsoft/fix-object-spread-rest-async-emit
Fix object spread+async emit
2016-11-14 16:15:15 -08:00
Mohamed Hegazy 1164df2c6d Merge pull request #12197 from Microsoft/commentsSuperCallReturns
Fix up comments for super calls rewritten as returns
2016-11-14 16:10:03 -08:00
Ron Buckton bb218107a9 Fix missing alias for decorated classes in es5 2016-11-14 15:50:47 -08:00
Arthur Ozga 6400d53394 Fix handling of default class 2016-11-14 15:43:24 -08:00
Ron Buckton 45772270a4 Merge branch 'master' into isolateObjectSpread 2016-11-14 15:33:45 -08:00
Ron Buckton 6e3bbcc6fc Merge pull request #12245 from Microsoft/fix12244
Fix string constituent check in checkElementTypeOfArrayOrString
2016-11-14 15:27:45 -08:00
Ron Buckton cb1bb19358 Update comment 2016-11-14 15:26:33 -08:00
Arthur Ozga d8b359f67b Fix typo and capitalization 2016-11-14 15:22:52 -08:00
Ron Buckton 06a13b9d10 Fix string constituent check in checkElementTypeOfArrayOrString 2016-11-14 15:22:04 -08:00
Arthur Ozga cfe50d1b92 Fix extends -> implements for decorators/modifiers 2016-11-14 15:13:46 -08:00
Vladimir Matveev f13e6d4ca6 enable syntactic features if project size exceeded the limit, send events when state of language service changes (#12190)
* enable syntactic features if project size exceeded the limit, send events when state of language service changes

* allow getting compiler options diagnostics when language service is disabled
2016-11-14 15:10:32 -08:00
Vladimir Matveev 04aaa32367 add 'installSuccess' flag to telemetry, cache misses if npm install fails (#12163) (#12240)
* add 'installSuccess' flag to telemetry, cache misses if npm install fails

* fix typo
2016-11-14 14:56:49 -08:00
Arthur Ozga bba96da128 remove multiple implements TODO 2016-11-14 14:33:29 -08:00
Arthur Ozga efd16c780b Spell out names fully 2016-11-14 14:32:40 -08:00
Arthur Ozga f6fc320c1f Get Ancestor instead of manual walk 2016-11-14 14:24:03 -08:00
Arthur Ozga 357ed7ed7d Remove Inner Loop 2016-11-14 14:23:08 -08:00
Ron Buckton 08f467bd4c Clean up destructuring 2016-11-14 14:20:25 -08:00
Mohamed Hegazy 6a67f8085a Merge pull request #12232 from Microsoft/removeJSFromVSResolutions
Remove js from vs resolutions
2016-11-14 14:13:32 -08:00
Vladimir Matveev f11e8a3c69 add 'installSuccess' flag to telemetry, cache misses if npm install fails (#12163)
* add 'installSuccess' flag to telemetry, cache misses if npm install fails

* fix typo
2016-11-14 14:10:22 -08:00
Arthur Ozga 4b202abf2e Initialize result to empy array 2016-11-14 13:59:06 -08:00
Mohamed Hegazy 2827b370cc Merge pull request #12207 from ethanresnick/precise-object-entry-types
More precise Object.entries type declarations
2016-11-14 13:55:27 -08:00
Mohamed Hegazy 964f9c5fe2 Make failedLookupLocations an array 2016-11-14 13:24:03 -08:00
Mohamed Hegazy 57a602b924 Include no types in services 2016-11-14 12:47:04 -08:00
Mohamed Hegazy 4782563ee3 Filter JS files from resolutions sent to VS through shims 2016-11-14 12:46:56 -08:00
Daniel Rosenwasser f6a570cc79 && -> || 2016-11-14 11:01:05 -08:00
Mohamed Hegazy a0338d15e1 Ignore optionality in the comparable relationship (#12202)
* Added tests.

* Accepted baselines.

* Avoid checking for optionality in comparability checks.

* Accepted baselines.
2016-11-14 10:47:48 -08:00
Vladimir Matveev 36511838a4 allow getting compiler options diagnostics when language service is disabled 2016-11-14 10:41:48 -08:00
Ron Buckton d5b9263433 Consolidate destructuring code paths 2016-11-14 10:40:26 -08:00
Nathan Shively-Sanders fab1416dd2 Fixes for object spread emit
1. Retain function modifiers. They were previously dropped.
2. Do not emit __assign for object literals with no spreads, just visit
children.
3. call aggregateTransformFlags after creating an __assign call.
2016-11-14 08:58:29 -08:00
Nathan Shively-Sanders 0cda239e1c Merge pull request #12156 from Microsoft/fix-jsdoc-missing-space-from-bad-indent
Fix jsdoc missing space from bad indent
2016-11-14 08:21:40 -08:00
Anders Hejlsberg f437c8f318 Merge pull request #12114 from Microsoft/mappedTypes
Mapped types
2016-11-13 15:39:32 -08:00
(´・ω・`) 4166eeb284 fix #12137, correct ProxyHandler signatures (#12172)
* fix #12137, correct ProxyHandler signatures

* address PR review
2016-11-13 15:27:07 -08:00
Anders Hejlsberg cd05c079ce Add comment explaining type alias instantiation strategy 2016-11-13 15:25:16 -08:00
Anders Hejlsberg db813d5171 Merge pull request #12210 from Microsoft/typePredicateCheck
Fix type predicate check circularity
2016-11-13 14:48:48 -08:00
Vladimir Matveev b15d144955 switch to tslint@next (#12201) 2016-11-13 13:34:18 -08:00
Anders Hejlsberg 24567445d6 Add early bail out for call expressions that are never type predicates 2016-11-13 08:29:21 -08:00
Ethan Resnick ea33d6e501 More precise Object.entries type declarations
We can leverage the new index type queries and indexed access types
from #11929 to get better type inference for Object.entries.
2016-11-13 02:59:50 -05:00
Daniel Rosenwasser 375437ef3c Avoid checking for optionality in comparability checks. 2016-11-12 12:59:43 -08:00
Anders Hejlsberg 9ac7667d5c Address CR feedback 2016-11-12 08:55:23 -08:00
Daniel Rosenwasser 2f6ba0876c Move comments from super calls to their generated return statements. 2016-11-12 02:56:25 -08:00
Vladimir Matveev 3b09010c7c enable syntactic features if project size exceeded the limit, send events when state of language service changes 2016-11-11 17:35:11 -08:00
Ron Buckton 8babde0b98 WIP Clean up destructuring 2016-11-11 17:23:42 -08:00
Nathan Shively-Sanders b8082caa8e Clean up jsdoc in utilities
Fix functions that were unused (getJsDocComments), redundant (append) or badly named
(getJSDocCommentsFromText)
2016-11-11 15:58:52 -08:00
Andy Hanson 1e92a9803b Merge branch 'master' into path_mapping_exact_extension 2016-11-11 14:11:40 -08:00
Andy Hanson a0e4ab94f1 Allow JS files 2016-11-11 13:59:13 -08:00
Andy Hanson 240b474ba3 Merge branch 'master' into path_mapping_exact_extension 2016-11-11 13:52:10 -08:00
Andy Hanson 6c7e1b6913 Merge branch 'master' into symlink3 2016-11-11 13:35:47 -08:00
Andy 9a3dd3e81c Merge pull request #11993 from Microsoft/common_source_directory
Leave files from `node_modules` out when calculating `getCommonSourceDirectory`
2016-11-11 13:18:42 -08:00
Andy Hanson b65729e5b2 Merge branch 'master' into common_source_directory 2016-11-11 13:10:29 -08:00
Andy Hanson ce9e5f5227 Fix test 2016-11-11 13:00:40 -08:00
Andy Hanson 823d385322 Add Push interface 2016-11-11 12:49:53 -08:00
Andy Hanson 8308ab34d8 When looking up modules in @types, only look for index.d.ts and package.json. 2016-11-11 12:49:53 -08:00
Nathan Shively-Sanders 9b2b2ca19b Error on non-identifier rest in destructuring assignment 2016-11-11 08:56:35 -08:00
Anders Hejlsberg 364142c062 Improve type inference for types with same generic type alias 2016-11-11 07:39:51 -08:00
Anders Hejlsberg 1c7ec6b8ce Add missing node visits in forEachChild 2016-11-11 07:38:44 -08:00
Mohamed Hegazy ea309fe504 Update version (#12162) 2016-11-10 16:30:01 -08:00
Anders Hejlsberg cd185f2cf6 Add declaration emit support 2016-11-10 15:20:29 -08:00
Nathan Shively-Sanders e301cfe58c Raise literal type to its base in a comparison
Similar to ===, except that it always applies, even when comparing two
literals.
2016-11-10 14:29:48 -08:00
Mohamed Hegazy d537b79c61 Merge release-2.1 into master (#12157)
* Update LKG

* Update version

* Update LKG

* Skip overloads with too-short function parameters

If the parameter of an overload is a function and the argument is also a
function, skip the overload if the parameter has fewer arguments than
the argument does. That overload cannot possibly apply, and should not
participate in, for example, contextual typing.

Example:

```ts
interface I {
  (a: number): void;
  (b: string, c): void;
}
declare function f(i: I): void;
f((x, y) => {});
```

This code now skips the first overload instead of considering.

This was a longstanding bug but was only uncovered now that more
functions expressions are context sensitive.

* Test skip overloads w/too-short function params

1. Update changed baseline.
2. Add a new test with baseline.

* Minor style improvements

* Ignore optionality when skipping overloads

* Do not use contextual signatures with too few parameters

* isAritySmaller runs later: getNonGenericSignature

* rewrite void-returning statements in constructors that capture result of super call (#11868)

* rewrite void-returning statements in constructors that capture result of super call

* linter

* Update LKG

* Fix emit inferred type which is a generic type-alias both fully and partially fill type parameters

* Add tests and baselines

* Skip trying to use alias if there is target type

* Update baselines

* Add diagnostics to remind adding tsconfig file for certain external project (#11932)

* Add diagnostics for certain external project

* Show tsconfig suggestion

* fix lint error

* Address pr

* fix comment

* Update error message

* Flag for not overwrite js files by default without generating errors (#11980)

* WIP

* Properly naming things

* refactor

* apply the option to all files and check out options

* Fix typo

* Update LKG

* lockLinter

* use local registry to check if typings package exist (#12014) (#12032)

use local registry to check if typings package exist

* Add test for https://github.com/Microsoft/TypeScript/pull/11980 (#12027)

* add test for the fix for overwrite emitting error

* cr feedback

* enable sending telemetry events to tsserver client (#12034) (#12051)

enable sending telemetry events

* Update LKG

* Reuse subtree transform flags for incrementally parsed nodes (#12088)

* Update LKG

* Update version

* Update LKG

* Do not emit "use strict" when targeting es6 or higher or module kind is es2015 and the file is external module

* Add tests and baselines

* [Release 2.1] fix11754 global augmentation (#12133)

* Exclude global augmentation from module resolution logic

* Address PR: check using string literal instead of NodeFlags.globalAugmentation

* Remove comment
2016-11-10 14:28:34 -08:00
Zhengbo Li 4dc58dde38 Exclude js files in non-configured projects compile-on-save emitting (#12118)
* Exclude js files in non-configured projects CoS emitting

* remove unnecessary method
2016-11-10 14:12:24 -08:00
Nathan Shively-Sanders 6e1aac1c42 Merge pull request #12147 from mylesmegyesi/12050-IncompatableAssignementOfIdenticallyNamedTypes
Adds error message for incompatible assignment of identically named type
2016-11-10 13:17:31 -08:00
Nathan Shively-Sanders 973d83ce93 Merge branch 'master' into fix-jsdoc-missing-space-from-bad-indent 2016-11-10 13:12:32 -08:00
Nathan Shively-Sanders 8bd0a47c82 Retain space after first word in multiline jsdoc
For words that were shorter than the jsdoc indent level, the space was
omitted previously.
2016-11-10 13:11:32 -08:00
Cotton Hou 9a8e1bf8a6 Add ES2017 string padding (#12152)
* add es2017.string.d.ts for String.prototype.{padStart,padEnd}

* append es2017.string.d.ts into es2017.d.ts

* add es2017.string into commandLineParser

* append es2017.string into error message for unit tests of commandLineParser

* append es2017.string into Gulpfile

* append es2017.string into Jakefile
2016-11-10 12:43:51 -08:00
Nathan Shively-Sanders 205ce3247f Merge pull request #12154 from Microsoft/import-helpers-reports-errors-for-__rest
Import helpers reports errors for __rest
2016-11-10 12:29:39 -08:00
Vladimir Matveev 3ecb60146b synthesize complete import declaration for tslib (#12151) 2016-11-10 11:57:37 -08:00
Nathan Shively-Sanders d6bf27d6b6 Correctly check spread assignments in strict mode
Previously it crashed in the binder.
2016-11-10 11:46:10 -08:00
Nathan Shively-Sanders 0d4ac01574 Report errors for import helpers missing __rest 2016-11-10 11:45:56 -08:00
Anders Hejlsberg 64d269885c Merge branch 'master' into mappedTypes
# Conflicts:
#	src/compiler/checker.ts
2016-11-10 11:17:53 -08:00
Anders Hejlsberg aca1ab3bfe Check mapped type constraint is assignable to string | number 2016-11-10 10:41:17 -08:00
Sheetal Nandi c87bce1119 Merge pull request #11978 from Microsoft/errorReportingInJsFile
Report all the js file errors and skip only the nodes that are not allowed in JS file
2016-11-10 10:37:16 -08:00
Anders Hejlsberg b81c226639 Use pull model to obtain type alias information for type nodes 2016-11-10 10:31:24 -08:00
Sheetal Nandi c458576553 Merge pull request #12135 from Microsoft/jsxFactory
Support for --jsxFactory option
2016-11-10 09:49:57 -08:00
Sheetal Nandi 2eba10a25b Updated condition for more readability 2016-11-10 09:40:50 -08:00
Myles Megyesi c05e226c4b
Adds error message for incompatible assignment of identically named type
Fixes issue #12050
2016-11-10 11:32:03 -06:00
Nathan Shively-Sanders be5e5fb872 Merge pull request #11150 from Microsoft/object-spread
Object spread/rest
2016-11-10 09:28:58 -08:00
Nathan Shively-Sanders 6398e0d6dd Merge pull request #11633 from Microsoft/fix-comparable-in-switch
Fix comparable in switch
2016-11-10 09:20:46 -08:00
Nathan Shively-Sanders 25462c9571 Merge pull request #12028 from Microsoft/object-rest
Object rest
2016-11-10 09:18:13 -08:00
Anders Hejlsberg 2170ff6f16 Defer resolution of mapped types to enable recursive definitions 2016-11-10 09:11:21 -08:00
Sheetal Nandi dd7f00f20b Parse the jsxFactory again in the checker instead of using cached value in the program 2016-11-10 08:54:13 -08:00
Herrington Darkholme 4c82e2de4f Merge branch 'master' of github.com:Microsoft/TypeScript into delete-readonly 2016-11-10 11:17:06 +08:00
Arthur Ozga 0591e1bd20 Simplify Testing 2016-11-09 17:47:52 -08:00
Sheetal Nandi 35e4c459f5 Transpile unit test case 2016-11-09 16:50:40 -08:00
Sheetal Nandi 3d6950d023 When emitting use jsx factory entity expression if provided 2016-11-09 16:40:11 -08:00
Arthur Ozga b1e97b370f Get one fix per interface 2016-11-09 16:37:26 -08:00
Sheetal Nandi 06affa6672 Resolve first identifier of the jsxFactory as part of type check 2016-11-09 15:35:54 -08:00
Sheetal Nandi f7bac98948 Verify that jsxFactory is either identifier or qualified name 2016-11-09 14:32:42 -08:00
Nathan Shively-Sanders fcf32c444f Treat | undefined like optionality in spread type 2016-11-09 13:39:42 -08:00
Sheetal Nandi 4b8a55793a Add support for taking in jsxFactory option and report errors for invalid combinations 2016-11-09 12:23:59 -08:00
Sheetal Nandi 78bb276216 Merge branch 'master' into errorReportingInJsFile 2016-11-09 11:38:11 -08:00
Nathan Shively-Sanders 214ce38a6a Downlevel array destructuring to ES6 in object rest
Previously array destructuring inside an object destructuring with an
object rest would downlevel the array destructuring to ES5. This breaks
if the code that targets ES2015 is using iterators instead of arrays
since iterators don't support [0] or .slice that the ES5 emit uses.
2016-11-09 10:47:54 -08:00
Sheetal Nandi 6456325973 Handle abstract and const modifiers 2016-11-09 10:39:46 -08:00
Anders Hejlsberg 3dd11e48a9 Properly implement type relationship for '[P in S]: X' and '[P in T]: Y' 2016-11-09 09:59:15 -08:00
Andy Hanson 7079d0450e Fix duplicate function error 2016-11-09 09:12:43 -08:00
Andy Hanson d559f7f17d Merge branch 'master' into symlink3 2016-11-09 09:11:25 -08:00
Andy Hanson 9c80909a90 Resolve symlinks for type reference directives too. 2016-11-09 08:08:10 -08:00
Arthur Ozga d842a6f665 Merge branch 'master' into interfaceFixes 2016-11-08 16:49:49 -08:00
Arthur Ozga 1d6ef6aedd cleanup 2016-11-08 16:48:54 -08:00
Ron Buckton bac9350847 Merge branch 'master' into emitHelper 2016-11-08 16:36:31 -08:00
Ron Buckton 12cd0bfb69 Remove EmitHelperState, general helper cleanup. 2016-11-08 16:32:41 -08:00
Vladimir Matveev 28cc938503 (signature help) type parameter lists are never variadic (#12112) 2016-11-08 16:10:34 -08:00
Vladimir Matveev 9a9f45f0fb use createHash from ServerHost instead of explicit require (#12043)
* use createHash from ServerHost instead of explicit require

* added missing method in ServerHost stub
2016-11-08 15:32:53 -08:00
Arthur Ozga 4973852722 fix linter errors 2016-11-08 14:37:46 -08:00
Anders Hejlsberg aca7e2fa3b Don't include private/protected properties in keyof T 2016-11-08 13:38:52 -08:00
Arthur Ozga 55bf3e3ff0 Use new engine for interface fixes 2016-11-08 13:15:58 -08:00
Arthur Ozga 7141a2a714 Better error message in fourslash 2016-11-08 13:15:09 -08:00
Arthur Ozga 11cea6a771 Use TypeChecker to Get Types, Print 2016-11-08 13:14:54 -08:00
Arthur Ozga b26ba83db3 Expose signatureToString, addSupressAnyReturn Flag 2016-11-08 13:14:30 -08:00
Anders Hejlsberg cf2953bc44 Add relations for keyof S / keyof T and [P in S]: X / [P in T]: X 2016-11-08 12:21:44 -08:00
Anders Hejlsberg a562d6e63f Make keyof T assignable to and subtype of string | number 2016-11-08 10:14:44 -08:00
Andy Hanson 1c64615e32 Allow a path mapping to provide a file extension 2016-11-08 07:19:17 -08:00
Anders Hejlsberg 7ca5923214 Merge branch 'master' into mappedTypes
# Conflicts:
#	src/compiler/checker.ts
2016-11-08 07:12:35 -08:00
Anders Hejlsberg 8aef1e6bb1 Type inference for mapped types 2016-11-08 06:55:35 -08:00
Anders Hejlsberg 2282477012 Merge pull request #12068 from Microsoft/fixTypeAliasDisplay
Fix type alias display
2016-11-08 06:43:38 -08:00
Vladimir Matveev 9e3d6efb19 reduce set of files being watched, increase polling interval (#12054) (#12092) 2016-11-07 21:13:11 -08:00
Mohamed Hegazy 2bf38ab6cd Port fix for https://github.com/Microsoft/TypeScript/issues/12069 (#12095) 2016-11-07 21:09:17 -08:00
Arthur Ozga bc1bb0e7f1 Make test failure more readable 2016-11-07 19:03:25 -08:00
Arthur Ozga 8c35185b37 Expose More TypeChecker
* getUnionType
* getIntersectionType
* getTypeFromTypeReference
2016-11-07 19:03:05 -08:00
Anders Hejlsberg 8f568d4740 Merge pull request #12064 from Microsoft/cacheSignatureInstantiations
Cache generic signature instantiations
2016-11-07 17:16:05 -08:00
Ron Buckton ddc4ae7eac Reuse subtree transform flags for incrementally parsed nodes (#12088) 2016-11-07 16:03:04 -08:00
Vladimir Matveev be2e8e85d6 property handle missing config files in external projects (#12094) 2016-11-07 15:49:19 -08:00
Vladimir Matveev 0173a3fa79 return empty file watcher in case if target directory does not exist (#12091)
* return empty file watcher in case if target directory does not exist

* linter
2016-11-07 15:48:46 -08:00
Nathan Shively-Sanders e1c50e1c40 Address more PR comments 2016-11-07 13:57:26 -08:00
Vladimir Matveev 4ffdea838a Ports #12051 and #12032 into master (#12090)
* use local registry to check if typings package exist (#12014)

use local registry to check if typings package exist

* enable sending telemetry events to tsserver client (#12035)

enable sending telemetry events
2016-11-07 13:36:08 -08:00
Nathan Shively-Sanders bd5ce284c9 Set spread type symbols in checkObjectLiteral
Instead of getSpreadType.

Also clean up special-case handling inside getSpreadType to be more
readable.
2016-11-07 13:35:36 -08:00
Andy d16aa3075c Merge pull request #12089 from Microsoft/lshost_realpath
Add `realpath` implementation for lshost
2016-11-07 13:19:50 -08:00
Nathan Shively-Sanders 567f5636e3 Create spread property types eagerly
This avoids the need for a synthetic symbol and later code called from
getTypeOfSymbol.
2016-11-07 13:02:05 -08:00
Andy Hanson d5c67312f6 Add realpath implementation for lshost 2016-11-07 12:42:12 -08:00
Nathan Shively-Sanders 9977936190 Do not emit __rest for --target esnext 2016-11-07 11:34:37 -08:00