Commit Graph

2814 Commits

Author SHA1 Message Date
Wesley Wigham
f8b6a8fc8d Introduce literal freshness for literal enum member types (#26556)
* Introduce literal freshness for literal enum members, allow enum references in ambient const initializers

* Merge statements

* Add enum literal readonly property test case

* Accept better baselines post-merge
2018-09-07 12:09:07 -07:00
Daniel Rosenwasser
cf2f339a5c Merge pull request #26895 from Microsoft/callableErrors
Find first callable/constructable type in union when appropriate
2018-09-07 00:06:11 -07:00
Ryan Cavanaugh
8f654f0f1e Merge pull request #21957 from jack-williams/typeof-in-switch
Fix #2214. Support narrowing with typeof in switch condition.
2018-09-06 10:46:13 -07:00
Sheetal Nandi
ddba6d8a70 Merge pull request #26825 from Microsoft/resolveJsonModuleEmit
Support json module emit when module emit is commonjs, amd, es2015 or esnext
2018-09-06 09:57:47 -07:00
Sheetal Nandi
8b30ff8393 Merge pull request #26817 from Microsoft/resolvingJsonModuleLikeJsExportsEqual
Use widened type and non fresh type when resolving json module
2018-09-06 09:49:53 -07:00
Jack Williams
911c59f47f Merge branch 'master' into typeof-in-switch 2018-09-06 09:33:01 +01:00
Wesley Wigham
d8f736d319 Change typeof narrowing to narrow selected union members (#25243)
* For typeof narrow all union members prior to filtering

* Revise narrowTypeByTypeof to both narrow unions and applicable union members

* Add repros from issue
2018-09-06 00:41:09 -07:00
Ryan Cavanaugh
54f7666017 Merge pull request #26453 from ajafff/abstract-property-in-initializer
disallow abstract property access in property initializer
2018-09-05 17:43:21 -07:00
Daniel Rosenwasser
d989e10c49 Renamed test. 2018-09-05 15:11:48 -07:00
Wesley Wigham
0b1183a461 Allow isSymbolAccessible to paint object literal declarations as visible (#24668)
* Dont use resolveEntityName for computed property name symbol resolution - use checkExpression and resolvedSymbol instead

* Fix lint
2018-09-05 14:52:47 -07:00
Wesley Wigham
69c7e67c88 Check privateness when emittign readonly/const props (#26920) 2018-09-05 13:49:38 -07:00
Ryan Cavanaugh
69f91b5ed8 Merge pull request #26837 from mattmccutchen/issue-26835
Argument arity error should only consider signatures with correct type argument arity.
2018-09-05 12:22:48 -07:00
Ryan Cavanaugh
4717ddb986 Merge pull request #26828 from Microsoft/narrowUnknownByObject
Narrowing unknown by typeof object to object | null
2018-09-05 12:16:24 -07:00
Ryan Cavanaugh
c188864394 Merge pull request #26112 from rhys-vdw/22685-array-flat-fix
Fix issue with Array#flatMap callback return type
2018-09-05 11:55:42 -07:00
Ryan Cavanaugh
4975dc85b1 Merge pull request #25822 from Kingwl/rechabilityImprove
improve enum rechability check
2018-09-05 11:46:07 -07:00
Wesley Wigham
62d8b85f1d Allow literal initializers of readonly properties in declaration files (#26313)
* Allow literal initializers of readonly properties in declaration files

* Move some conditions a bit
2018-09-05 11:30:05 -07:00
Wesley Wigham
4ac8976750 Always check index type validity for all types when an error node is present so we always issue an error (#26789)
* Always check index type validity for all types when an error node is present so we always issue an error

* Change type a bit
2018-09-04 16:00:28 -07:00
Wesley Wigham
ca662419e8 Dont consider export specifiers visible in their local scope (#26884) 2018-09-04 16:00:10 -07:00
Wesley Wigham
f1370ecd54 Allow special assignments to have a contextual type of their declared type if present (#26802)
* Allow special assignments to have a contextual type of their declared type if present

* Expand change to cover all js special assignments

* Remove extraneous line
2018-09-04 15:58:18 -07:00
Daniel Rosenwasser
3d812ef93a Added test. 2018-09-04 11:07:50 -07:00
Matt McCutchen
f2d26fd0bb Argument arity error should only consider signatures with correct type
argument arity.

Fixes #26835.
2018-09-01 19:48:47 -04:00
Sheetal Nandi
f1a179a314 Narrowing unknown by typeof object to object | null
Fixes #26327
2018-08-31 15:24:53 -07:00
Sheetal Nandi
e41dbcdccd Support json module emit when module emit is commonjs, amd, es2015 or esnext
Fixes #25755 and #26020
2018-08-31 14:05:14 -07:00
Sheetal Nandi
50ccd91263 Baseline the require of json file in js file 2018-08-31 14:04:30 -07:00
Nathan Shively-Sanders
c929e74310 Add [Constructor]Parameter types to lib.d.ts (#26243) 2018-08-31 07:46:16 -07:00
Sheetal Nandi
d5b7edba8a Merge pull request #26751 from Microsoft/declarationEmitWithComposite
Correctly mark visibile nodes when declaration isnt explicitly turned on but composite is true
2018-08-29 22:55:01 -07:00
Sheetal Nandi
38a85cfbf4 Add test to verify #26669 where declaration output is incorrect when declaration flag is not set explicitly in options 2018-08-29 16:14:55 -07:00
Anders Hejlsberg
c48c3632bd Update tests 2018-08-29 14:02:15 -07:00
Andy
3931b72118 noUnusedLocals: Destructuring assignment is a write (#26365)
* noUnusedLocals: Destructuring assignment is a write

* Code review

* Clarify test
2018-08-28 11:43:45 -07:00
Anders Hejlsberg
ac0d5da631 Merge pull request #26679 from Microsoft/improveGetTypeOfExpression
Improve control flow analysis of type assertions
2018-08-27 18:30:16 -07:00
Wesley Wigham
0dbad04c3f Distribute indexed accesses when simplifying them (#26281)
* unknownify accesses

* Move to simplify to break less with fewer changes

* Accept baselines for now

* Always propegate any as an index type

* Fix flow control in the presence of simplifiable types

* Add spy repro from #25181

* Retain errorType when it is used as a marker for the lack of a constraint

* Small refinement

* Add new test

* Move most potentially recursive types from isIdenticalTo into structuredTypeRelatedTo to match the non-identity relations

* Fix nits

* Doesnt need to be undefineable at all
2018-08-27 13:32:01 -07:00
Anders Hejlsberg
0c759b8194 Add regression test 2018-08-25 18:25:14 -07:00
Anders Hejlsberg
09bc7505a7 Add regression test 2018-08-25 16:09:18 -07:00
Wesley Wigham
5e8b63cd1d Use context free expression types in evolving array checking and cache context free type (#26585)
* Use context free expression types in evolving array checking and cache context free type

* Simplify second test

* Low max depth a tad just so node 8 wont stack out

* By request make flow control a round number
2018-08-22 16:17:42 -07:00
Ron Buckton
1f8aa057f8 Merge pull request #26483 from Microsoft/fix20594
Ensure for-in loop variable is checked
2018-08-22 11:41:17 -07:00
Anders Hejlsberg
93c76cb617 Merge pull request #26558 from Microsoft/fixInfiniteConstraints
Fix infinite constraints
2018-08-21 17:24:42 -07:00
Anders Hejlsberg
db9c202b64 Add regression test 2018-08-21 16:17:14 -07:00
Anders Hejlsberg
6a81d4c129 Merge branch 'master' into fixInfiniteConstraints 2018-08-20 16:30:32 -07:00
Anders Hejlsberg
886a6d7473 Fix test 2018-08-20 16:23:09 -07:00
Anders Hejlsberg
88f7759d6b Add tests 2018-08-20 16:21:25 -07:00
Anders Hejlsberg
6262ac8b3d Add tests 2018-08-20 12:41:48 -07:00
Wesley Wigham
d433c6ed05 Track late bound names in binding patterns (#26336) 2018-08-17 16:30:01 -07:00
Anders Hejlsberg
178f792f18 Merge pull request #26340 from Microsoft/neverIndexedAccess
T[K] should be 'never' when T is 'never'
2018-08-15 16:07:11 -07:00
Ron Buckton
a901930723 Ensure for-in loop variable is checked 2018-08-15 16:03:28 -07:00
Sheetal Nandi
969b46e44b Merge pull request #26458 from Microsoft/pathMappingResultsToNodeModules
When path mapping results to file in node_modules, mark it as external library
2018-08-15 15:28:50 -07:00
Daniel Rosenwasser
dfef227b18 Merge pull request #26473 from Microsoft/doGlobalImplicitThisRight
Fix bad message for captured global 'this'.
2018-08-15 13:08:38 -07:00
Sheetal Nandi
b983da55fd Merge pull request #26457 from Microsoft/baseUrlPathMappingResolveJsonModule
Do not include json file unless --resolveJsonModule is specified
2018-08-15 11:43:01 -07:00
Nathan Shively-Sanders
2bfd919b6a Narrow on element access of literal (#26424)
* Narrow literal element accesses

This means that, for example, the tuple `[number, string?]` allows its
second element to be narrowed with element access:

```ts
export function f(pair: [number, string?]): string {
  return pair[1] ? pair[1] : 'nope';
}
```

* Update baselines

* Cleanup

* More cleanup

* Test dashes in property names

* More cleanup

* Delete undead code
2018-08-15 09:58:39 -07:00
Daniel Rosenwasser
dc1fbc24cd Updated test cases. 2018-08-14 23:02:08 -07:00
Sheetal Nandi
a32f62b310 Write tests to demonstrate how baseUrl + pathMapping to node_modules behaves 2018-08-14 16:26:41 -07:00