21352 Commits

Author SHA1 Message Date
TypeScript Bot
330c8acda2 Cherry-pick PR #34702 into release-3.7 (#34710)
Component commits:
7be925173c Exclude ?? operator from true/false literal check in createFlowCondition

b9802166ae Accept new API baselines

3d4c14c5f8 Add tests

7362545e8c Accept new baselines

2d1af77839 Address CR feedback

8f0de27784 Accept new API baselines
2019-10-24 16:05:34 -07:00
TypeScript Bot
1ac8f40933 🤖 Cherry-pick PR #33847 into release-3.7 (#34720)
Component commits:
97dcbd3bb9 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.

f9b7d6eaa8 Add usage of exports.SomeName typedef.

92dc69ddf0 Fix bug at bind site rather than in declare func
2019-10-24 14:30:58 -07:00
Andrew Casey
04d55bf05f Handle undefined from getPropertyNameForPropertyNameNode
...which can be returned when the property name is computed.

Part of #34404
2019-10-24 10:29:29 -07:00
TypeScript Bot
23d1b7b38a Cherry-pick PR #34706 into release-3.7 (#34708)
Component commits:
056a656937 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.

d1515f4ee0 Add bug number
2019-10-24 09:58:21 -07:00
TypeScript Bot
49301482a0 Cherry-pick PR #34683 into release-3.7 (#34705)
Component commits:
2aa257df80 getTypeFromJSDocValueReference: handle import types
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-24 09:25:35 -07:00
Wesley Wigham
7afaef1067 Cherry-pick PR #34679 into release-3.7
Component commits:
e0b98c6eae Do not consider element accesses which are neither statically bindable nor late bound as special assignments
2019-10-23 13:22:52 -07:00
Nathan Shively-Sanders
f21e9312e8
Cherry-pick PR #34649 into release-3.7 (#34657)
Component commits:
b6744812a0 Treat any mix of element/prop access as declaration in JS
Fixes #34642 but, notably, doesn't actually make the assignment into a
working declaration. It just fixes the crash.
2019-10-22 15:22:40 -07:00
TypeScript Bot
ea71ecfe22 Cherry-pick PR #34650 into release-3.7 (#34658)
Component commits:
6a6f4a666e Fix crash in assigning function with this ref to alias
2019-10-22 15:22:31 -07:00
Nathan Shively-Sanders
2b0d4600a7 Cherry-pick PR #34649 into release-3.7
Component commits:
b6744812a0 Treat any mix of element/prop access as declaration in JS
Fixes #34642 but, notably, doesn't actually make the assignment into a
working declaration. It just fixes the crash.
2019-10-22 21:47:42 +00:00
Daniel Rosenwasser
0d53d2fb6b Update version. 2019-10-21 14:49:04 -07:00
Daniel Rosenwasser
eea12682ee Merge remote-tracking branch 'origin/master' into release-3.7 2019-10-21 14:48:19 -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
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
8f15a2e639 Fix type inference regression 2019-10-20 17:59:21 -07:00
Anders Hejlsberg
60b391507e And a few more 2019-10-19 07:04:24 -07: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
Daniel Rosenwasser
f33465416f
Ensure original files are included in tsconfig.release.json (#34584)
Ensure original files are included in tsconfig.release.json
2019-10-18 17:35:37 -07:00
Ron Buckton
556da72ffd
[WIP] Improve optional chaining checker performance (#33794)
* Improve optional chaining checker performance

* Improve optional chaining checker performance

* Add flags to Signature

* Inline getOptionalExpression

* split checks for optional chains

* Cache optional call signatures
2019-10-18 17:27:47 -07:00
Anders Hejlsberg
98fe34225c Handle more cases 2019-10-18 16:33:55 -07:00
Andrew Branch
91196fc53f
Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes (#34577)
* Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes

* Revert unneeded change
2019-10-18 16:31:43 -07:00
Daniel Rosenwasser
fbc070f328 Extend tsconfig.release.json from the sibling tsconfig.json to ensure files aren't forgotten. 2019-10-18 16:12:31 -07:00
Daniel Rosenwasser
218bbcd669 Don't immediately return in getMemberSymbols. 2019-10-18 15:23:56 -07:00
Nathan Shively-Sanders
cdf1ab2dec
Bind @class in the right place -- bindWorker not bindChildrenWorker (#34575)
Also add an assert to make future mismatches fail in an obvious place
instead of in a while loop.
2019-10-18 14:13:14 -07:00
Nathan Shively-Sanders
fa1884ed1b
Fix crash in expando assignment to alias (#34566)
* Fix crash in expando assignment to alias

This PR disallows expando assignments

Fixes #34493, but disallows the prototype assignment nonetheless.

* Revert mistaken changes
2019-10-18 13:31:44 -07:00
Nathan Shively-Sanders
1d5add528d
Emit computed property temps even w/o init w/useDefineForClassFields (#34406)
Fixes #33857
2019-10-18 13:23:38 -07:00
Daniel Rosenwasser
9b6a027167 Perform checks prior to calling addTypeProperties. 2019-10-18 13:03:25 -07:00
Anders Hejlsberg
241de73556
Merge pull request #34496 from microsoft/fix34272
Properly attach alias symbol to `readonly T[]` types
2019-10-18 12:07:03 -07:00
Anders Hejlsberg
d3df927c7a Optional chain control flow analysis fixes 2019-10-18 10:50:03 -07:00
Ben Lichtman
1bfc47252f
Merge pull request #33938 from uniqueiniquity/classifcationAssertion
Add assertion when classification has unexpected length
2019-10-18 09:44:51 -07:00
Ben Lichtman
65561a89dd fix assertion condition 2019-10-18 09:18:16 -07:00
Michael Crane
0fc388893e Remove redundant and misplaced perfLogger startup statement (#34551) 2019-10-18 09:13:40 -07:00
Nathan Shively-Sanders
82f927f8dd
Fix stack overflow in circular assignment declaration (#34543)
* Fix stack overflow in circular assignment declaration

It also needs to have multiple assignments so that it has a ValueModule
flag.

Fixes #33006

* remove errant comment

* Remove other possible circularity

* Restore fallback with additional condition
2019-10-18 09:01:21 -07:00
Daniel Rosenwasser
85e09134be Update comment. 2019-10-17 17:45:13 -07:00
Daniel Rosenwasser
15445e156a Add user preference to the protocol. 2019-10-17 17:41:49 -07:00
Daniel Rosenwasser
73e9715da5 Added option 'includeAutomaticOptionalChainCompletions' to disable '?.' completions. 2019-10-17 17:41:49 -07:00
Andrew Casey
7275e9ca93 Delete redundant test 2019-10-17 17:22:47 -07:00
Daniel Rosenwasser
d2fab65df6 Added test. 2019-10-17 17:04:45 -07:00
Andrew Casey
526e413abc Dropping assert for 3.7 2019-10-17 16:51:30 -07:00
Andrew Casey
8927aaabb5 Rewrite tests 2019-10-17 16:50:22 -07:00
Andrew Casey
9dd8391244 Add additional properties to switch declaration 2019-10-17 16:36:54 -07:00
Andrew Casey
d18130d36b Consolidate checks in emitFilesAndReportErrors 2019-10-17 16:36:54 -07:00
Andrew Casey
caf0041f8a Add listFilesOnly command-line option
Msbuild currently uses a combination of `--listFiles` and `--noEmit` to
obtain a list of files to be consumed by tsc.  However, these two flags
don't suppress type checking, the results of which msbuild will never
consume.  This new switch gives msbuild a faster way to obtain the file
list.

Note: like `--noEmit`, doesn't make sense in build mode.
2019-10-17 16:36:50 -07:00
csigs
80cb807663 LEGO: check in for master to temporary branch. 2019-10-17 22:10:36 +00:00
Sheetal Nandi
580e3f56aa
Merge pull request #34527 from microsoft/rootDir
Use getNormalizedAbsolutePath to combine basePath and config value for file names
2019-10-17 14:19:49 -07:00
Andrew Branch
454a3a0b0f
Fix auto-imports from auto type acquisition definitions (#33766)
* Fix auto-imports from ATA typings

* Compare canonical filenames in isImportablePath
2019-10-17 13:59:09 -07:00
Sheetal Nandi
fde10a2494 Merge branch 'master' into rootDir 2019-10-17 12:54:26 -07:00
Sheetal Nandi
575339c2e1 Merge branch 'master' into testChanges 2019-10-17 12:26:16 -07:00
Sheetal Nandi
4055689579
Merge pull request #34487 from microsoft/skipTsBuildinfoEmit
Do not write build info if there are no files to emit
2019-10-17 12:22:25 -07:00