Commit graph

29196 commits

Author SHA1 Message Date
Ryan Cavanaugh 05cbe5ac8e
Update issue reports agian (#34768)
* Update issue templates

* Add config.yml

* Updates

* Updates
2019-10-28 11:15:31 -07:00
Ryan Cavanaugh a28fcebff2
Update issue templates (#34767)
* Update issue templates

* Add config.yml
2019-10-28 11:12:20 -07:00
Orta 72b7a6527e Adds accept header to the dispatch request when requesting a playground build of monaco (#34763) 2019-10-28 11:07:36 -07:00
Andrew Branch 634e0ad52b
Fix extract type on JS function params (#34745) 2019-10-28 10:30:59 -07:00
Nathan Shively-Sanders 080e41dc90
Fix type reference to merged prototype property assignment (#34764)
The constructor function code path in the return type checking of
signatures needs to pass the *merged* symbol of the declaration to
getDeclaredTypeOfClassOrInterface. Other callers of
getDeclaredTypeOfClassOrInterface do this, or used an already-merged
symbol.

Fixes #33993
2019-10-28 10:14:04 -07:00
Eli Barzilay eb0208c589
make globalThis have an empty declarations (#34561)
Fixes #33860 by making it an error.  This is an improvement, but sounds
like it would be better to make it work later.
2019-10-25 22:49:31 -04:00
Andrew Branch d8840f8a18
Show all matching enum flags in debug flag formatter (#34689)
* Show all matching enum flags in debug formatter

* Revert "Show all matching enum flags in debug formatter"

This reverts commit 073099722a.

* Same thing but simpler

* Lint
2019-10-25 16:27:24 -07:00
Evan Cahill 88f3593742 Fix error when exporting const enums (#33060) (#34721)
* Allow export declaration to reference const enums

* Update baselines

* Add test to verify reexported const enums are elided
2019-10-25 16:04:44 -07:00
Sheetal Nandi f12eee2e4b
Include *.json in the root files if they are specified as root (#34676)
Fixes #33827
2019-10-25 13:48:38 -07:00
Sangmin Lee a01c8ef764 Fix typo in watchMode.ts (#34701) 2019-10-25 13:13:00 -07:00
Gorka Hernández Estomba 8e1d228a44 Update inconsistent use of the word multiline/multi-line in test cases (#34733)
The word multi-line and multiline are used interchangeably within the file. Multiline seems to be the most used spelling of the word across the TypeScript repository codebase so a few strings have been updated to keep consistency within a single file. Additionally, corrected a minor capitalization mistake.
2019-10-25 11:28:50 -07:00
Ryan Cavanaugh 5e4cd0594e
Update CONTRIBUTING.md 2019-10-24 16:49:51 -07:00
Anders Hejlsberg c404c08fde
Fix reachability analysis for ?? operator (#34702)
* Exclude ?? operator from true/false literal check in createFlowCondition

* Accept new API baselines

* Add tests

* Accept new baselines

* Address CR feedback

* Accept new API baselines
2019-10-24 15:57:14 -07:00
Martin Probst a03227d60e Avoid a crash with @typedef in a script file. (#33847)
* Avoid a crash with `@typedef` in a script file.

Scripts (as opposed to modules) do not have a symbol object. If a script
contains a `@typdef` defined on a namespace called `exports`, TypeScript
crashes because it attempts to create an exported symbol on the
(non-existent) symbol of the SourceFile.

This change avoids the crash by explicitly checking if the source file
has a symbol object, i.e. whether it is a module.

* Add usage of exports.SomeName typedef.

* Fix bug at bind site rather than in declare func
2019-10-24 14:04:42 -07:00
Wesley Wigham 7cfa1dfb8a
Fix regression in mixin emit by removing unneeded line of code (#34715)
* Fix regression in mixin emit by removing unneeded line of code

* Double the test, double the fun
2019-10-24 14:02:37 -07:00
Nathan Shively-Sanders d892fd408f
Fix expando handling in getTypeReferenceType (#34712)
* Fix expando handling in getTypeReferenceType

getExpandoSymbol looks for the initialiser of a symbol when it is an
expando value (IIFEs, function exprs, class exprs and empty object
literals) and returns the symbol.

Previously, however, it returned the symbol of the initialiser without
merging with the declaration symbol itself. This missed, in particular,
the prototype assignment in the following pattern:

```js
var x = function x() {
  this.y = 1
}
x.prototype = {
  z() { }
}

/** @type {x} */
var xx;
xx.z // missed!
```

getJSDocValueReference had weird try-again code that relied on calling
getTypeOfSymbol, which *does* correctly merge the symbols. This PR
re-removes that code and instead makes getExpandoSymbol call
mergeJSSymbols itself.

* Remove extra newline
2019-10-24 13:12:44 -07:00
Nathan Shively-Sanders 969634b97c
Restore delayed merge check to getTypeFromJSDocValueReference (#34706)
* Restore delayed merge check to getTypeFromJSDocValueReference

This is needed when a function merges with a prototype assignment. The
resulting *merged* symbol is a constructor function marked with
SymbolFlags.Class. However, the merge doesn't happen until
getTypeOfFuncClassEnumModule is called, which, in the
getTypeReferenceType code path, doesn't happen until
getTypeFromJSDocValueReference. That means the check for
SymbolFlags.Class is missed.

Previously, getTypeFromJSDocValueReference had a weird check
`symbol !== getTypeOfSymbol(symbol).symbol`, which, if true, ran
getTypeReferenceType again on `getTypeOfSymbol(symbol).symbol`. For
JS "aliases", this had the effect of dereferencing the alias, and for
function-prototype merges, this had the effect of ... just trying again
after the merge had happened.

This is a confusing way to run things. getTypeReferenceType should
instead detect a function-prototype merge, cause it to happen, and
*then* run the rest of its code instead of relying on try-again logic at
the very end. However, for the RC, I want to fix this code by restoring
the old check, with an additional check to make sure that #33106 doesn't
break again:

```ts
const valueType = getTypeOfSymbol(symbol)
symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol
```

I'll work on the real fix afterwards and put it into 3.8.

* Add bug number
2019-10-24 09:24:58 -07:00
Wesley Wigham 07d3a2ec7e
Do not consider element accesses which are neither statically bindable nor late bound as special assignments (#34679) 2019-10-23 16:01:25 -07:00
Nathan Shively-Sanders 8223c07527
getTypeFromJSDocValueReference: handle import types (#34683)
Previously it only handled types whose declaration was from `require`,
but now it handles types whose reference is an import type as well.
2019-10-23 15:53:38 -07:00
Edward Thomson eb08ee6848 Add GitHub Actions (#34614) 2019-10-23 13:57:49 -07:00
Orta 56b74d3652
Merge pull request #34648 from orta/readme_links
Update the README links
2019-10-23 15:14:59 -04:00
Keen Yee Liau f689982c9f Prioritize loading plugin from probeLocations over peer node_modules
This commit reoroders the loading sequence of a tsserver plugin. It
should first check `pluginProbeLocations` before checking peer
node_modules.

PR closes https://github.com/microsoft/TypeScript/issues/34616
2019-10-23 11:28:44 -07:00
Andrew Casey 6f04f526d4
Merge pull request #34659 from amcasey/FARGlobalThis
Don't assume that all symbols have declarations
2019-10-22 16:26:19 -07:00
Andrew Casey 590fd3f2a2 Don't assume that all symbols have declarations
...in Find All References.  For example, global `this` doesn't in
modules.

Part of #34404
2019-10-22 15:00:30 -07:00
Kārlis Gaņģis 479d30646f Fix crash in assigning function with this ref to alias (#34650) 2019-10-22 14:33:45 -07:00
Nathan Shively-Sanders 1cbbe288ac
Treat any mix of element/prop access as declaration in JS (#34649)
Fixes #34642 but, notably, doesn't actually make the assignment into a
working declaration. It just fixes the crash.
2019-10-22 11:28:28 -07:00
Orta Therox 73a206b47f Update the README links 2019-10-22 13:43:52 -04:00
Andrew Casey 159b6262ea
Merge pull request #34631 from amcasey/ComputedPropName
Handle undefined from getPropertyNameForPropertyNameNode
2019-10-22 10:17:05 -07:00
Andrew Casey 8cf13249ea
Merge pull request #34521 from amcasey/LazyDirectoryCreation
Stop pre-emptively creating directories
2019-10-21 17:41:54 -07:00
Andrew Casey 7862e58354 Handle undefined from getPropertyNameForPropertyNameNode
...which can be returned when the property name is computed.

Part of #34404
2019-10-21 17:41:06 -07:00
Andrew Casey af2f46e899 Use longer lambda parameter names 2019-10-21 16:22:10 -07:00
Daniel Rosenwasser 778a757e88
Change master branch version to 3.8 (#34629)
Change `master` branch version to 3.8
2019-10-21 15:37:07 -07:00
Daniel Rosenwasser def1e7163d Accepted baselines. 2019-10-21 15:11:16 -07:00
Daniel Rosenwasser 1b0fca5df5 Update version to 3.8. 2019-10-21 14:51:21 -07:00
Andrew Casey ca31f008a8 Address more potential this issues 2019-10-21 14:01:12 -07:00
Andrew Casey 6429e4cd36 Fix undefined this 2019-10-21 13:32:42 -07:00
Anders Hejlsberg f84fd300b8
Merge pull request #34607 from microsoft/fix33490
Fix type inference regression
2019-10-21 12:50:38 -07:00
Anders Hejlsberg ff6626f869
Merge pull request #34597 from microsoft/optionalChainControlFlow
More optional chaining control flow analysis
2019-10-21 12:36:07 -07:00
Daniel Rosenwasser 28028eb144
Extend the correct tsconfig.json. (#34615)
Extend the correct tsconfig.json.
2019-10-21 11:50:14 -07:00
Daniel Rosenwasser b167012561 Extend the correct tsconfig.json. 2019-10-21 10:46:41 -07:00
Andrew Branch 1d3ecc0610
Ensure export= symbol from JavaScript always has a valueDeclaration (#34553) 2019-10-21 09:56:02 -07:00
Anders Hejlsberg 82019d616d Accept new baselines 2019-10-20 18:01:41 -07:00
Anders Hejlsberg 56520da6f0 Add regression tests 2019-10-20 18:00:08 -07:00
Anders Hejlsberg 8f15a2e639 Fix type inference regression 2019-10-20 17:59:21 -07:00
Anders Hejlsberg ee846d95af Accept new baselines 2019-10-19 10:52:04 -07:00
Anders Hejlsberg d218a31a7d Add tests 2019-10-19 10:51:59 -07:00
Anders Hejlsberg 60b391507e And a few more 2019-10-19 07:04:24 -07:00
Orta e8782aef22
Merge pull request #34574 from orta/add_docs_tsserver_debug
Improve the launch template
2019-10-19 09:06:18 -04:00
Orta Therox 0a0833b376 Improve the launch template 2019-10-19 08:44:28 -04:00
Daniel Rosenwasser b845800bdf
Add option to configure automatic optional chain completions (#34552)
Add option to configure automatic optional chain completions
2019-10-18 17:35:59 -07:00