Commit Graph

26317 Commits

Author SHA1 Message Date
Wesley Wigham f701daf4e0 Infer over each mapped type constraint member if it is a union (#28006) 2018-10-22 16:33:43 -07:00
Daniel Rosenwasser 68ce68da79 Merge pull request #27964 from Igorbek/issue27854
Fix bug in reduceEachChild for tagged template expressions
2018-10-22 15:49:54 -07:00
Wesley Wigham 34256145b8 Fix lint 2018-10-22 14:37:27 -07:00
Andy Hanson 076f0bbd0f Merge branch 'master' into tsconfig_canonicalpath 2018-10-22 14:35:42 -07:00
Klaus Meinhardt 5b3fe6e68b update other interfaces and implementations
and accept baseline
2018-10-22 21:23:04 +02:00
Klaus Meinhardt 3b058a4de4 fix compile errors, accept baselines 2018-10-22 21:12:12 +02:00
Klaus Meinhardt 96480b5ba9 fix return type of LangageServiceHost.resolve*
Fixes: #28058
2018-10-22 20:59:42 +02:00
Andy 1930f8a790 fourslash: Add 'goToMarkerOrRange' helper (#28057) 2018-10-22 11:44:39 -07:00
Andy d3d4f83f89 Remove hack to get target of GetAccessor symbol (#27868)
* Remove hack to get target of GetAccessor symbol

* Add tests and get moveToNewFile to work with binding patterns
2018-10-22 11:44:06 -07:00
Sam Drugan 02c74987b7 added await keyword to completions and added test (#27912) 2018-10-22 11:32:49 -07:00
Andy afa94c527c Un-consolidate overloads for Map and WeakMap (#28052) 2018-10-22 11:18:56 -07:00
Andy 8e0142d709 Support import completions for a re-export with a different name from the original (#28055) 2018-10-22 11:16:39 -07:00
Siddharth Singh 39e533a97e Typo fix
Changed "mean" to "meant"
2018-10-22 03:33:11 +05:30
Klaus Meinhardt 63a8cb6933 use Map instead of Array 2018-10-21 19:57:23 +02:00
Klaus Meinhardt ea0c7eb3ce Fix performance regression when reusing old state
Fixes: #28025
2018-10-21 18:15:01 +02:00
Anders Hejlsberg 033ea4c232 Simplify addTypeToUnion function 2018-10-21 09:12:52 -07:00
Andy 72244c5b03 Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />'' (#28004)
* Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />''

* Calculate `isExternalLibraryImport` at the end

* Calculate isExternalLibraryImport with symlink path
2018-10-19 18:00:45 -07:00
Sheetal Nandi 424fcdde37 Merge pull request #28005 from Microsoft/noReductionUnion
Do not do any reduction (even if it contains any) to the union type when getting contextual type
2018-10-19 17:33:16 -07:00
Sheetal Nandi ad5599434e Merge pull request #27974 from Microsoft/errorUpdateWithChangeInTransitiveDeclarationFile
Use reference map from declaration file as exported map to handle deep import semantic diagnostics invalidation
2018-10-19 17:32:32 -07:00
Nathan Shively-Sanders bf393ae1cd Check EOF token to get errors for JSDoc (#28000)
* Check EOF token to get errors for JSDoc

* outputFile instead of noEmit for test
2018-10-19 16:23:34 -07:00
Sheetal Nandi 71d8961ba0 Do not do any reduction (even if it contains any) to the union type when getting contextual type
Fixes #27975
2018-10-19 16:10:08 -07:00
Wesley Wigham 69b1cb5bac Add new special assignment kinds for recognizing Object.defineProperty calls (#27208)
* Add new special assignment kinds for recognizing Object.defineProperty calls

* Add support for prototype assignments, fix nits

* Fix code review comments

* Add test documenting behavior in a few more odd scenarios
2018-10-19 14:31:55 -07:00
Nathan Shively-Sanders e379aeb151 Fix alias of module.exports->exports->IIFE (#27992)
In JS, when you assign `module.exports = exports` and the entire module is
wrapped in an IIFE, the resulting `export=` symbol, after following
aliases, is the module itself. This results in trying to merge the
file's exports with itself inside `getCommonJsExportEquals`, since it
thinks that it has found new exports, possibly in an object literal,
that need to be merged with the file's exports.

For example:

```js
(function() {
exports.a = 1
module.exports = exports
})()
```
2018-10-19 13:50:38 -07:00
Ryan Cavanaugh b64d08a21b Merge pull request #27522 from jack-williams/trailing-void-args-are-optional
Fix #4260 : Allow trailing arguments that accept void to be omitted
2018-10-19 10:16:56 -07:00
Nathan Shively-Sanders 8779d4ca88 Fix JS merge crashes from lovefield (#27989)
1. Merge enum with expando.
2. Merge enum member with property assignment.
3. Merge interface-declared method declaration with
prototype-property-assignment method declaration.

The reason that the enum merges crash is that getTypeOfSymbol assumes
that symbol flags are (basically) mutually exclusive. This assumption is
shredded, badly, for JS merges.

One fix is to drop the assumption of exclusivity and instead order cases
by least to most likely. This has the highest chance of working, but is
also slow, since you would prefer to order cases by most likely *first*,
not *last*.

The other fix, which is what I did here, is to add a last-chance
re-dispatch at the bottom of
`getTypeOfVariableOrParameterOrPropertyWorker`. This dispatch uses the
valueDeclaration instead of the symbol flags.
2018-10-19 09:23:05 -07:00
Andy a3c22683ab findAllRefs: Fix bug when symbol.declarations is undefined (#27977) 2018-10-18 14:27:21 -07:00
Sheetal Nandi 91bb32ade4 Merge pull request #27560 from Microsoft/transitiveReferences
Resolve modules, type reference directives in context of referenced file
2018-10-18 13:03:10 -07:00
Sheetal Nandi d352b8c2c7 Use reference map from declaration file as exported map to handle deep import semantic diagnostics invalidation
Fixes #27973
2018-10-18 12:04:14 -07:00
Jack Williams 8500f7ce20 Merge branch 'master' into trailing-void-args-are-optional 2018-10-18 19:22:18 +01:00
Alexander T fe6dad7725 Merge branch 'master' of https://github.com/Microsoft/TypeScript into bug/24542-bad-error-message-for-import-ing-an-export 2018-10-18 11:49:58 +03:00
Igor Oleinikov b930d5730f Change cast to the proper type 2018-10-18 01:36:05 -07:00
Igor Oleinikov b2cbbbd1d3 Fix bug in reduceEachChild (fixes #27854)
- add reducing of type arguments in tagged template expression
2018-10-18 01:34:04 -07:00
Igor Oleinikov b1fbff8b98 Add broken test for issue #27854 2018-10-18 00:31:09 -07:00
Wesley Wigham e58371e03a Remove now unnessesary casts (#27954) 2018-10-17 15:17:21 -07:00
Sheetal Nandi 7b9ae4d9d0 Merge pull request #27952 from Microsoft/contextualSignature
When contextual type doesnt find property in unit type, use the index signature from unit type(fix the incorrectly used union type to get the signature)
2018-10-17 14:59:42 -07:00
Wesley Wigham 9554f09d09 Add ability to infer to the simplified form of a type variable (#27953)
* Add ability to infer to the simplified form of a type variable

* Add test
2018-10-17 14:44:39 -07:00
Sheetal Nandi 31f4053d3e When contextual type doesnt find property, use the index signature from unit type(fix the incorrectly used union type to get the signature)
Fixes #27949
2018-10-17 14:15:56 -07:00
Wesley Wigham 7b5ef64e76 Unify JSX And Normal Call Checking Codepaths (#27627)
* Unify JSX Call Checking Codepaths

* Add tests for fixed issues

* Fix lint, move all error checking into the only-run-once resolveSignature call

* Remove unused (unreachable?) code path

* Consolidate a little more duplicated logic into signature checking

* Fix #19775 a bit more

* Cosmetic changes from CR
2018-10-16 20:16:00 -04:00
Sheetal Nandi bc72577ce3 Merge branch 'master' into transitiveReferences 2018-10-16 14:56:07 -07:00
Andy eb2297df02 Fix compile errors in tsbuildWatchMode.ts (#27870)
* Fix compile errors in tsbuildWatchMode.ts

* Remove TODO comments

* new LKG

* Add tslint disables
2018-10-16 12:28:14 -07:00
Collins Abitekaniza d396830386 add error showing where prop was also declared if is a dup 2018-10-16 21:54:14 +03:00
Sheetal Nandi b69622a114 Merge branch 'master' into transitiveReferences 2018-10-16 10:41:17 -07:00
Andy 0f4a615bcb Fix isSourceFileFromExternalLibrary for file with redirect (#27917)
* Fix isSourceFileFromExternalLibrary for file with redirect

* Alternate fix

* Use currentNodeModulesDepth > 0
2018-10-16 09:01:25 -07:00
Sheetal Nandi cb954cbb0a Merge pull request #27871 from Microsoft/formatting
Handle when advancing past , of call expression moves past endPos of formatting
2018-10-15 21:10:09 -07:00
Collins Abitekaniza 66b299dc6e refactor diagnostics 2018-10-16 06:59:00 +03:00
Collins Abitekaniza 2e993230e6 use decl key value if any 2018-10-16 06:59:00 +03:00
Anders Hejlsberg 04fd365ec3 Merge pull request #27911 from Microsoft/fixCircularMappedType
Fix circular mapped type instantiations for arrays and tuples
2018-10-15 15:51:31 -07:00
Anders Hejlsberg 9767522ca0 Merge pull request #27695 from Microsoft/mixedDiscriminantTypes
Allow non-unit types in union discriminants
2018-10-15 13:10:27 -07:00
Nathan Shively-Sanders c184184713 Add getEffectiveConstructSignatures (#27561)
* Add helpers that understand constructor functions

* getEffectiveConstructSignatures gets construct signatures from type, and
  call signatures from constructor functions if there are no construct
  signatures.
* getEffectiveConstructSignatureReturnType gets the "JS Class type" for
  constructor functions, and the return type of signatures for all other
  declarations.

This is a first step toward making constructor functions have construct
signatures instead of call signatures, which will also contribute to
fixing instantiation of generic constructor functions, which is basically
broken right now.

Note that the baselines *improve* but, because of the previously
mentioned generic problem, are still not correct. Construct signatures
for constructor functions and generic constructor functions turns out to
be an intertwined problem.

* Correct correct originalBaseType

And, for now, return anyType for generic constructor functions used as
base types. Don't give an incorrect error based on the function's return
type, which is usually void.

* Add error examples to tests

* Add construct signatures instead of getEffective* functions

* Fix typo in baseline

* Remove pesky newline

I thought I got rid of it!

* Test of constructor tag on object literal method

It doesn't work, and shouldn't in the future, because it's a runtime
error.
2018-10-15 12:47:57 -07:00
Anders Hejlsberg 709f5f2fc4 Handle circular mapped type instantiations for arrays and tuples 2018-10-15 10:18:54 -07:00