Commit graph

11315 commits

Author SHA1 Message Date
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
Nathan Shively-Sanders 1866d0580c Rename variable in checkSwitchStatement per PR 2016-11-07 11:16:54 -08:00
Nathan Shively-Sanders 609cd0016b Merge branch 'object-spread' into object-rest 2016-11-07 11:10:29 -08:00
Nathan Shively-Sanders f03fecbd31 Merge branch 'master' into object-spread 2016-11-07 11:02:49 -08:00
Nathan Shively-Sanders 83e95d43f8 Revert unneeded change and comments per PR 2016-11-07 11:00:24 -08:00
Anders Hejlsberg 9f3aa38d17 Improve sharing by re-instantiating top level type aliases 2016-11-07 10:24:54 -08:00
Nathan Shively-Sanders d4a5b0855c Add --target esnext tests and update baselines 2016-11-07 09:56:48 -08:00
Nathan Shively-Sanders 7b9a42f995 Add --target esnext
Currently, this disables the rest and spread transforms. This will
change as proposals enter and leave stage 3.
2016-11-07 09:54:48 -08:00
Anders Hejlsberg de93876abe Correct symbol display for type parameter of mapped type 2016-11-07 09:43:20 -08:00
Anders Hejlsberg 5de63a74eb Validate constraint type in mapped type 2016-11-07 09:43:01 -08:00
Nathan Shively-Sanders 6a82ae4cbb Add SpreadAssignment to visitors
1. visitNode
2. reduceNode
3. emit

This fixes an emit bug for setters.
2016-11-07 09:04:00 -08:00
Nathan Shively-Sanders a84c7aeea4 Rename SpreadElementExpression -> SpreadAssignment
and SpreadExpression (formerly SpreadElementExpression) -> SpreadElement
2016-11-07 08:36:03 -08:00
Andy Hanson 07630e95e0 Add source maps and declarations to test 2016-11-07 07:14:47 -08:00
Anders Hejlsberg 2bf4bad0e1 Revert incorrect logic from #11392 2016-11-06 16:00:41 -08:00
Anders Hejlsberg 2564e1cd26 Handle recursion in mapped type display 2016-11-06 12:38:49 -08:00
Anders Hejlsberg da7f11fe4b Properly instantiate aliasTypeArguments 2016-11-05 17:36:00 -07:00
Anders Hejlsberg 507ab30e9c Handle readonly and optional properties + index signatures 2016-11-05 17:01:47 -07:00
Anders Hejlsberg 61b9da548a Cache generic signature instantiations 2016-11-05 08:20:02 -07:00
Anders Hejlsberg 1c7b397fbb Introduce instantiateCached function 2016-11-05 07:04:56 -07:00
Vladimir Matveev ed4fead087 add missing bind calls to properly set parent on token nodes (#12057) 2016-11-04 21:54:22 -07:00
Anders Hejlsberg 7807ac96f5 Attach symbols to mapped types 2016-11-04 16:47:43 -07:00
Arthur Ozga 1b8486df89 Still re-writing missing member grabber 2016-11-04 16:35:51 -07:00
Nathan Shively-Sanders a55ed26d2b Spread any types to any 2016-11-04 16:06:33 -07:00
Anders Hejlsberg ecdb74cee6 Merge branch 'master' into mappedTypes 2016-11-04 14:18:44 -07:00
Anders Hejlsberg fc450a2d2f Introduce MappedType in type checker 2016-11-04 14:17:51 -07:00
Nathan Shively-Sanders 4c365bd76a Move transformFunctionBody to factory
It is shared by es2015 and esNext transformers.

This commit just adds a convertObjectRest flag to be passed on to
flattenDestructuring functions, as well as adding necessary parameters
to use the code outside a transformer.
2016-11-04 13:56:28 -07:00
Nathan Shively-Sanders cc342d12e7 Move convertForOf to factory for esnext and es2015
Saves a lot of duplicated code
2016-11-04 11:06:56 -07:00
Sheetal Nandi 4a906143c6 Merge pull request #11998 from Microsoft/unusedProperty
Mark property referenced in the destructuring as referenced
2016-11-04 10:42:05 -07:00
Nathan Shively-Sanders 71f3157a35 Address PR comments
1. Remove extra line in __rest shim.
2. Improve __rest vs __assign check for destructuring assignment.
2016-11-04 09:03:03 -07:00
Ron Buckton defc0537ae Merge pull request #12039 from Microsoft/fix12010
Ensure transformFlags are correct before visiting a node.
2016-11-03 23:38:52 -07:00
Zhengbo Li 1c004bf317 Port #12027, #11980 and #11932 to master (#12037)
* add test for the fix for overwrite emitting error

* cr feedback
2016-11-03 21:13:41 -07:00
Ron Buckton cbec19afd7 Ensure transformFlags are correct before visiting a node. 2016-11-03 17:21:36 -07:00
Arthur Ozga 3b0b696517 broken 2016-11-03 16:02:32 -07:00
Anders Hejlsberg d1a8af5320 Parse '[P in K]' part of mapped type as a type parameter declaration 2016-11-03 14:35:27 -07:00
Nathan Shively-Sanders c9c5f49a24 Improve readability of ES next destructuring emit 2016-11-03 13:36:35 -07:00
Paul van Brenk 40c0cbd7b5 Clean up 2016-11-03 13:28:08 -07:00
Paul van Brenk 2f453ce674 Handle most module cases 2016-11-03 12:48:28 -07:00
Anders Hejlsberg 6a5de5d00e Fix linting errors 2016-11-03 10:55:58 -07:00
Nathan Shively-Sanders 7ff8876096 Merge branch 'object-spread' into object-rest-syntax 2016-11-03 10:12:45 -07:00
Anders Hejlsberg 83abd048b5 Correct assignability for keyof types and type parameters 2016-11-03 10:01:27 -07:00
Nathan Shively-Sanders 7a2c7ad374 Spread handles index signatures from singleton spreads
I broke it when simplifying the logic earlier.
2016-11-03 09:41:31 -07:00
Andy Hanson b6727ea582 Only resolve symlinks in node_modules 2016-11-03 07:53:10 -07:00
Andy Hanson 2eca0af91b Leave files from node_modules out when calculating getCommonSourceDirectory 2016-11-03 07:50:07 -07:00
Anders Hejlsberg 7cd39e3818 Parsing of mapped types 2016-11-03 06:09:44 -07:00
Herrington Darkholme 747f50f447 migrate checkDelete to new property checking 2016-11-03 13:27:22 +08:00
Herrington Darkholme 2e8bbf0c96 fix #11480, disallow delete operator on readonly property or index
signature
2016-11-03 13:27:21 +08:00
Nathan Shively-Sanders a6320203be Fix lint 2016-11-02 16:31:04 -07:00
Nathan Shively-Sanders 334820c357 Remove spread types, leaving spread syntax/emit
Spreads are still typed, but cannot be created from a non-object type.
Tests still need to be updated.
2016-11-02 16:26:34 -07:00
Nathan Shively-Sanders e3a08ed663 Downlevel emit of rest elements 2016-11-02 14:56:01 -07:00
Nathan Shively-Sanders a7c18367ca Parse, bind and check rest elements 2016-11-02 14:55:24 -07:00
Arthur Ozga d02eb6c1f1 fix jakefile1 2016-11-02 14:43:16 -07:00
Vladimir Matveev ab75ea75d3 module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program (#11999)
module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program
2016-11-02 14:41:26 -07:00
Arthur Ozga 04968ab7cb fix references to codefixes? 2016-11-02 13:05:27 -07:00
Arthur Ozga e5279fd828 Rename and simplify fourslash interface 2016-11-02 12:39:55 -07:00
Nathan Shively-Sanders f2d739ffcf Spread types handle nested index [access] types
Nested index [access] types are treated as assignable to themselves only,
just like type parameters.
2016-11-02 11:36:25 -07:00
Sheetal Nandi 13e8f7fada Mark property referenced in the destructuring as referenced
Fixes #11324
2016-11-02 11:08:34 -07:00
Nathan Shively-Sanders 2ae6ecc1a5 Merge branch 'master' into object-spread 2016-11-02 10:57:20 -07:00
Arthur Ozga 1b60a97bed Remove unused 2016-11-02 10:40:10 -07:00
Anders Hejlsberg 7b34b612be Merge pull request #11929 from Microsoft/keyoftypes
Static types for dynamically named properties
2016-11-02 09:36:54 -07:00
Anders Hejlsberg 70fc25a45a Minor fixes 2016-11-02 09:02:05 -07:00
Arthur Ozga 0380f3f38e Recognize modifiers 2016-11-01 17:19:06 -07:00
Mohamed Hegazy 6b94bae437 Fix #11396: Make error message referene Promise explicitly (#11982)
* Simplify the checking for async function return type

* Fix https://github.com/Microsoft/TypeScript/issues/11396: Make error message referene `Promise` explicitly
2016-11-01 17:03:56 -07:00
Anders Hejlsberg 663985eed0 Fix 'keyof any' to produce 'string | number' 2016-11-01 16:59:53 -07:00
Paul van Brenk 71960187cd Removed unused, confusing cases 2016-11-01 16:43:17 -07:00
Paul van Brenk b59714ea7e Add more testcases and simplify 2016-11-01 16:31:23 -07:00
Arthur Ozga 324000020c Merge branch 'master' into interfaceFixes 2016-11-01 15:43:54 -07:00
Arthur Ozga aa6ecd4154 Fix linting errors 2016-11-01 15:39:01 -07:00
Arthur Ozga bc2134681d Refactor fourslash testing for codeFixes 2016-11-01 15:38:07 -07:00
Sheetal Nandi 06331b57de Report all the js file errors and skip only the nodes that are not allowed in js
Fixes #11800
2016-11-01 13:00:30 -07:00
Sheetal Nandi d896d3f8a9 Add test cases to report errors for decorators in js file 2016-11-01 11:05:09 -07:00
Anders Hejlsberg 41c20545e1 Improve unification by moving more logic to getIndexedAccessType 2016-11-01 10:17:08 -07:00
Nathan Shively-Sanders d7f5fc8fcf Get literal type only once 2016-11-01 09:09:40 -07:00
Andy Hanson de6751b80c Make cachingInServerLSHost tests work with runtests-browser 2016-11-01 08:22:56 -07:00
Anders Hejlsberg 6b28d21a82 Merge branch 'master' into keyoftypes
# Conflicts:
#	src/compiler/diagnosticMessages.json
2016-10-31 16:04:40 -07:00
Anders Hejlsberg f9e208533a Unify checking of indexed access expressions and indexed access types 2016-10-31 15:28:28 -07:00
Ron Buckton 4371889854 Merge pull request #11430 from Microsoft/fixAsyncReturnTypeCheck
Fix async return type check
2016-10-31 15:18:11 -07:00
Ron Buckton 884e9f47db Merge branch 'master' into fixAsyncReturnTypeCheck 2016-10-31 15:17:26 -07:00
Andy ecb7b00e1c Forbid augmentation of untyped module (#11962)
* Forbid augmentation of untyped module

* Just use `undefined` for untyped modules
2016-10-31 15:04:22 -07:00
Arthur Ozga cbaea9996c Cleanup Extends -> Interface Change 2016-10-31 14:47:02 -07:00
Nathan Shively-Sanders ebef408dfa Move eitherIsNotLiteral check into switch and === checks
This improves error messages
2016-10-31 14:44:04 -07:00
Nathan Shively-Sanders b0080a253d Merge branch 'master' into fix-comparable-in-switch 2016-10-31 14:20:10 -07:00
Andy 49be2e2c5d Merge pull request #11957 from Microsoft/fix_realpathmap
Fix realPathMap in test harness: Must be used in `directoryExists`
2016-10-31 14:03:42 -07:00
Andy e6f6a5e6f6 Merge pull request #11495 from Microsoft/includes_glob
Implicitly consider an extensionless file in "includes" to be a recursive directory glob
2016-10-31 13:56:10 -07:00
Mohamed Hegazy 8984e43b20 Update generated files (#11963) 2016-10-31 13:15:46 -07:00
Andy Hanson ebebac9c4e Add helper function 2016-10-31 11:08:09 -07:00
Andy Hanson 03ce7b0145 Fix realPathMap in test harness: Must be used in directoryExists 2016-10-31 08:23:02 -07:00
Anders Hejlsberg 2f34f7c569 Improve more error messages 2016-10-30 19:01:07 -07:00
Anders Hejlsberg 6c205330a1 Improved error messages for invalid assignments to properties 2016-10-30 18:08:43 -07:00
Anders Hejlsberg 5515dcea34 Improved error messages for invalid assignments to identifiers 2016-10-30 16:01:15 -07:00
Vladimir Matveev 44ce59d1d8 cache type for empty type literal (#11934)
cache type for empty type literal
2016-10-29 15:57:51 -07:00
Arthur Ozga 16dc834d2d extends->implements w/ implements keyword present 2016-10-28 18:39:17 -07:00
Arthur Ozga c89b97b56a Add removeAbstractModifier Fix
Still need to add localization strings
2016-10-28 18:38:03 -07:00
jramsay 980f9fd2a9 Merge pull request #11848 from Microsoft/AddJavaScriptSemanticErrorsToSyntacticErrors
Fix for #11719 - TSServer: JS files should display syntactic errors for TS syntax
2016-10-28 16:49:53 -07:00
Vladimir Matveev fcdeecfa4a Merge pull request #11925 from Microsoft/vladima/11880
update CFG to properly handle do statements
2016-10-28 16:12:53 -07:00
Vladimir Matveev 9bb7ba5862 Merge pull request #11928 from Microsoft/vladima/11738
do not inline async IIFEs in control flow graph
2016-10-28 16:12:31 -07:00
Anders Hejlsberg 8d87971fee Minor fixes 2016-10-28 15:35:15 -07:00
Vladimir Matveev 73c59bbf85 do not inline async IIFEs in control flow graph 2016-10-28 14:43:08 -07:00
Vladimir Matveev fc93e8f6f4 update CFG to properly handle do statements 2016-10-28 14:17:01 -07:00
Vladimir Matveev fdb3b6857d enable non-ts extensions in inferred projects by default 2016-10-28 11:30:00 -07:00
Ron Buckton 5f5b117406 Merge branch 'master' into emitHelper 2016-10-28 10:52:00 -07:00
Nathan Shively-Sanders 988bf1fc69 Rename TransformFlags.Experimental -> ESNext 2016-10-28 10:24:30 -07:00
Nathan Shively-Sanders fdcc7cc185 Merge pull request #11905 from Microsoft/skip-overloads-with-too-short-function-parameters
Skip overloads with too short function parameters
2016-10-28 09:59:38 -07:00
Nathan Shively-Sanders 179682610f isAritySmaller runs later: getNonGenericSignature 2016-10-28 08:57:19 -07:00
Nathan Shively-Sanders 278d0a4665 Do not use contextual signatures with too few parameters 2016-10-27 22:52:01 -07:00
Zhengbo Li 4513ae3034 disable CoS for inferred projects (#11909) 2016-10-27 18:00:21 -07:00
Arthur Ozga d24236b933 Simplify getCodeFixChanges 2016-10-27 16:39:47 -07:00
Jason Ramsay 43bd2d8747 Changes from CR feedback 2016-10-27 16:38:59 -07:00
Arthur Ozga 3ac9ffa75e Nerf Extends to implements For Now 2016-10-27 16:33:33 -07:00
Nathan Shively-Sanders 39b9163715 Rename Experimental transform to ESNext
1. Spread/rest are no longer experimental.
2. We need a place to put stage 3 ES features.
2016-10-27 16:03:01 -07:00
Andy Hanson 12f6dcefa1 Revert "Merge pull request #11354 from Microsoft/map4"
This reverts commit adfdae0dc4, reversing
changes made to aad663cebf.
2016-10-27 15:50:21 -07:00
Nathan Shively-Sanders 3e71d50708 Ignore optionality when skipping overloads 2016-10-27 15:42:41 -07:00
Nathan Shively-Sanders 5a336fedba Minor style improvements 2016-10-27 15:38:29 -07:00
Nathan Shively-Sanders 58ffb4e668 Merge branch 'master' into object-spread 2016-10-27 15:29:21 -07:00
Nathan Shively-Sanders 83fdecf86a 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.
2016-10-27 14:41:40 -07:00
Ron Buckton 81c7e9677d Merge branch 'master' into emitHelper 2016-10-27 13:55:40 -07:00
Anders Hejlsberg ece1f19099 Refactor getIndexedAccessType to be reusable from checkIndexedAccess 2016-10-27 13:54:26 -07:00
Andy Hanson bcc0807198 Respond to PR comments 2016-10-27 13:14:56 -07:00
Anders Hejlsberg 4b50ef3585 Consider index signatures in type produced by 'keyof T' 2016-10-27 13:07:36 -07:00
Andy Hanson 867093707b Merge branch 'master' into map4 2016-10-27 12:36:50 -07:00
Andy aad663cebf Merge pull request #11894 from Microsoft/for_loops
Simplify for loops in fourslash.ts
2016-10-27 12:21:57 -07:00
Andy Hanson dec5f4b39a Merge branch 'master' into map4 2016-10-27 12:21:06 -07:00
Andy 231b5ac52d Merge pull request #11891 from Microsoft/jsx_resolution_diagnostic
Fix bug: Return a resolution diagnostic for a `.jsx` import if `--allowJs` is turned off
2016-10-27 12:05:59 -07:00
Andy 6f519d8a27 Merge pull request #11899 from Microsoft/optional_extension
Make `extension` property of `ResolvedModule` optional
2016-10-27 12:05:29 -07:00
Andy Hanson 0f8003fb39 Make extension property of ResolvedModule optional; introduce ResolvedModuleFull interface for when the extension is provided. 2016-10-27 11:35:20 -07:00
Andy a143f9788e Merge pull request #11889 from Microsoft/untyped_imports
Allow untyped imports
2016-10-27 11:32:21 -07:00
Andy Hanson ce099e5374 Change diagnostic message 2016-10-27 11:10:27 -07:00
Andy Hanson eb45962e20 Rename to zipWith 2016-10-27 10:26:46 -07:00
Andy f307948af0 Merge pull request #11893 from Microsoft/truthy_enum
Fix bug: We want to test for existence of the enum value, not whether it's non-zero
2016-10-27 09:03:16 -07:00
Andy Hanson ca09ef4499 Simplify for loops in fourslash.ts 2016-10-27 09:01:04 -07:00
Andy Hanson 4937d9c8b4 Allow untyped imports 2016-10-27 08:54:19 -07:00
Andy Hanson 4e20882ac0 Fix: test for presence, not absence 2016-10-27 08:43:22 -07:00
Andy Hanson ed82fddb8c Fix bug: We want to test for existence of the enum value, not whether it's non-zero 2016-10-27 08:14:08 -07:00
Andy Hanson 91885266ac Remove a comment about a parameter that no longer exists 2016-10-27 08:09:59 -07:00
Andy Hanson 8448e741c9 Fix bug: Return a resolution diagnostic for a .jsx import if --allowJs is turned off 2016-10-27 08:08:02 -07:00
Andy b5ba3152ff Merge pull request #11704 from Microsoft/refactor_module_resolution
Return both ts and js results from module resolution
2016-10-27 06:03:29 -07:00
Ron Buckton c1505a0ed9 Added RawExpression to move the UMD helper out of the emitter 2016-10-26 18:38:59 -07:00
Ron Buckton 83f5d3f25c Move emit helpers into related transformers 2016-10-26 17:54:09 -07:00
Ron Buckton e6bea90a1f Merge pull request #11769 from Microsoft/moveModuleTransformToEnd
Move module transformers to end of transformations
2016-10-26 17:51:34 -07:00
Vladimir Matveev 50e2fd87da only emit /// types reference for a symbol in d.ts file if all declarations of a symbol come from type reference directives (#11872)
* only emit /// types reference for a symbol in d.ts file if all declarations of a symbol come from type reference directives

* pass proper value for current directory when compiling .d.ts files
2016-10-26 17:15:04 -07:00
Arthur Ozga 5d9a4e3054 Move codeFixProvider.ts 2016-10-26 17:02:09 -07:00
Arthur Ozga a66b0ae54c Split CodeFixes in Separate Files 2016-10-26 16:57:43 -07:00
Vladimir Matveev 3e18aba36a 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
2016-10-26 16:48:29 -07:00
Arthur Ozga ecc029fd1c more temp 2016-10-26 14:27:51 -07:00
Arthur Ozga 132b7461d5 Covnert to Doc Comment 2016-10-26 14:27:26 -07:00
Arthur Ozga 2abf906ac7 Merge branch 'master' into interfaceFixes 2016-10-26 14:02:09 -07:00
Anders Hejlsberg e7cfbfe185 Support parametric property access expressions + some renaming 2016-10-26 13:39:12 -07:00
Arthur Ozga f74872dd69 temp 2016-10-26 11:30:52 -07:00
Andy Hanson c958c47ef5 Merge branch 'master' into map4 2016-10-26 11:05:51 -07:00
Andy Hanson 718d57ff3c Move helper functions to core (fix build) 2016-10-26 10:13:34 -07:00
Alexander Rusakov 8ad68adac9 Fix #10108 (Completion suggestion for object literal with getter) (#11808)
* Fix #10108 (Completion suggestion for object literal with getter)

* completions for setter
2016-10-26 10:01:23 -07:00
Andy Hanson 9130fbd731 Merge branch 'master' into refactor_module_resolution 2016-10-26 08:27:34 -07:00
Andy Hanson 07bb2582b6 Don't require resolvedTsFileName and resolvedJsFileName, just resolvedFileName and extension. Also, change search order to do all TS searching before searching for JS. 2016-10-26 08:13:58 -07:00
Jason Ramsay 1b16c0b94b For JavaScript files, we report semantic errors for using TypeScript-only constructs from within a JavaScript file as syntactic errors. 2016-10-25 18:09:04 -07:00
Vladimir Matveev f6b82d5e9f add a fallback logic for older versions of node that don't support 'homedir' (#11845)
* add a fallback logic for older versions of node that don't support 'homedir'

* try os.homedir first
2016-10-25 16:36:02 -07:00
Vladimir Matveev 72f81e2fc4 Merge pull request #11841 from Microsoft/vladima/report-typings-installer-pid
report typings installer process id to parent process
2016-10-25 15:37:56 -07:00
Vladimir Matveev 7890f63250 use unresolved imports as a source of used typings (#11828) 2016-10-25 15:24:21 -07:00
Anders Hejlsberg c21592ede1 Initial implementation of 'T[K]' property access types 2016-10-25 14:32:20 -07:00
Arthur Ozga d1cea7361b Refactor Loop 2016-10-25 14:17:10 -07:00
Arthur Ozga 151f940100 Refactor classDeclarations 2016-10-25 14:01:33 -07:00
Arthur Ozga 6b4f6b5864 Remove Type Assignability QuickFix 2016-10-25 13:58:32 -07:00
Zhengbo Li d0170d1ac8 Support dotted name in @typedef tag (#11695)
* Support dotted name in @typedef tag

* Use a new node flag to get rid of the extra logics

* replace jsdoc namespace node flag with optional property

* Fix linting error
2016-10-25 13:32:48 -07:00
Vladimir Matveev f48728af74 report typings installer process id to parent process 2016-10-25 13:18:57 -07:00
Asad Saeeduddin 66c1178134 Use symbol fully-qualified name instead of node text in error message (#11761)
* Add test

* Add baselines

* Use fqn of symbol instead of node text
2016-10-25 11:45:32 -07:00
Arthur Ozga 48f947f50d Merge pull request #11829 from Microsoft/arozga/RemoveNavBarWhiteSpace
remove whitespace in nav bar completions
2016-10-25 11:44:29 -07:00
Arthur Ozga 59cfa2eafe remove whitespace 2016-10-25 11:06:04 -07:00
Arthur Ozga 77df58bdb6 simplify regex 2016-10-25 11:03:54 -07:00
Arthur Ozga 476b6e02c8 remove check on property assignment 2016-10-25 10:59:17 -07:00
Arthur Ozga c9b490f234 Merge branch 'master' into arozga/RemoveNavBarWhiteSpace 2016-10-25 10:39:18 -07:00
Arthur Ozga 82e8e43236 only remove whitespace for expr assignment 2016-10-25 10:38:41 -07:00
Andy Hanson 040942f2b2 Merge branch 'master' into includes_glob 2016-10-25 08:19:37 -07:00
Andy Hanson 1b15646c41 Simplify isImplicitGlob test 2016-10-25 08:13:07 -07:00
Andy Hanson dc99355b5d Move most of resolveModuleNameForLsHost to lsHost 2016-10-25 08:02:16 -07:00
Anders Hejlsberg 07478aae14 Introduce PropertyNameType 2016-10-25 06:35:35 -07:00
Sheetal Nandi f98369b711 Fix the AV resulting from presence of undefined in the jsDocPropertyTags
Fixes #11703
2016-10-24 18:10:05 -07:00
Arthur Ozga cb804df151 remove whitespace 2016-10-24 17:53:03 -07:00
Paul van Brenk d4b99d66e0 Simplifying handling import cases 2016-10-24 17:32:58 -07:00
Vladimir Matveev 3bdff73c16 Merge pull request #11819 from Microsoft/vladima/11752
treat ambient non-aliased 'require' as commonjs 'require'
2016-10-24 16:26:32 -07:00
Nathan Shively-Sanders 32af04660f Merge branch 'master' into object-spread 2016-10-24 15:46:09 -07:00
Anders Hejlsberg ad88109420 Initial implementation of 'keyof T' type operator 2016-10-24 15:24:26 -07:00
Sheetal Nandi 1884c89620 Merge pull request #11818 from Microsoft/unusedDestructuredParameter
Report error on unused destructured parameters
2016-10-24 15:05:42 -07:00
Andy e20f52b758 Merge pull request #11757 from Microsoft/destructure_catch
Allow destructuring in catch clauses
2016-10-24 14:55:23 -07:00
Alexander Rusakov 7b684214fa Fix #11545 ('export as namespace foo' occurs EOF without semicolon) (#11797) 2016-10-24 13:18:46 -07:00
Paul van Brenk 409787495e Fix 'import a = A' case 2016-10-24 11:40:23 -07:00
Vladimir Matveev b7ea3e5bdd treat ambient non-aliased 'require' as commonjs 'require' 2016-10-24 11:19:41 -07:00
Sheetal Nandi c1c670f8f6 Report error on unused destructured parameters
Fixes #11795
2016-10-24 11:17:35 -07:00
Mohamed Hegazy 4dc6028263 Fix #11650 add an error message for no source files parsing a tsconfig.json (#11743)
* Fix #11650 add an error message for no source files parsing a tsconfig.json

* Use the file name in error message

* Use constants

* Review comments: change message text
2016-10-24 11:00:32 -07:00
Sheetal Nandi a8db81393f Merge pull request #11762 from Microsoft/jsxEmit
Set parent of reactnamespace identifier to be parse tree node
2016-10-24 10:53:24 -07:00
Anders Hejlsberg 39a4feb90a Merge pull request #11771 from Microsoft/typeFlagsRefactoring
Type flags refactoring
2016-10-24 10:49:59 -07:00
(´・ω・`) 287b54518d Fix #10967, allow boolean flags to have explicit value (#11798)
* Fix #10967, allow boolean flag to have explicit value

* add commandLineParsing test for boolean flags
2016-10-24 10:45:07 -07:00
Sheetal Nandi e38c004f90 Merge pull request #11791 from Microsoft/genericTypeParameterConstraint
Check type parameters of the type alias declaration
2016-10-24 10:42:45 -07:00
Sheetal Nandi 23d325120e Merge pull request #11790 from Microsoft/allowUnderScoreForIn
Allow unused locals in for in or for of that start with _
2016-10-24 10:42:20 -07:00
Ryan Cavanaugh 95670c6251 Perform a useful comparison. Fixes #11805 2016-10-24 10:14:41 -07:00
Nathan Shively-Sanders 8f59993186 Merge branch 'master' into object-spread 2016-10-24 10:04:08 -07:00
Nathan Shively-Sanders 35be8c351c Add more commentary to getSpreadType 2016-10-24 10:02:04 -07:00
Nathan Shively-Sanders a94fb2f5a3 Explain writeSpreadType a little better 2016-10-24 09:40:10 -07:00
Nathan Shively-Sanders 66d4798145 Error for call/construct signatures in spread type
1. Simplify the error reporting code to handle all kinds of signatures.
2. Remove index signature handling code when creating a spread type
since it's an error anyway.
2016-10-24 09:21:23 -07:00
Andy Hanson 7157692191 Respond to PR comments 2016-10-24 06:48:05 -07:00
Nathan Shively-Sanders 16dfdc49dc Clean up and reorder getSpreadType body 2016-10-22 10:08:58 -07:00
Nathan Shively-Sanders 485e2490e7 Move multiple-spread handling out of getSpreadType 2016-10-22 09:07:48 -07:00
Paul van Brenk 1f94e14d84 Remove unused case, and fix for..in 2016-10-21 17:11:32 -07:00
Sheetal Nandi f8c3a550ca Check type parameters of the type alias declaration
Fixes #11166
2016-10-21 16:45:58 -07:00