Commit Graph
45 Commits
Author SHA1 Message Date
Jack Williams 3d6650eb4f Fix #38608 (#38610)
* Fix #38608

* Work for narrowed non-unions

* Add comment
2021-03-11 07:32:49 -08:00
Jack Williams fd0ad2985b Minor fix for assertion predicates (#38710) 2020-06-20 18:27:51 -07:00
Jack Williams 05d59a1f1a Unify logic in typeof narrowing (#33434) 2020-05-06 15:15:24 -07:00
Jack WilliamsandWesley Wigham 0e15b9f245 Make never rest type top-like (#35438)
* Make never rest type top-like

* Add higher-order test

* properly support types which reduce to never

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-03-30 14:16:07 -07:00
Jack WilliamsandWesley Wigham 4c440e5e5b Fix #31319 : Narrow unit-unit inequality tests using comparability (#33071)
* Narrow unit-unit inequality tests using comparability

* Accept updated baselines

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-03-30 12:49:53 -07:00
Jack Williams c600aa7411 Fix #33732 (#36077)
* Fix #33732

* Remove code change but keep test
2020-03-17 14:58:52 -07:00
Jack Williams dcc73944f4 Fix 33436 (#35225)
* Fix 33436

* Fix code

* Fix error message after bad merge

* Remove whitespace
2020-03-12 15:40:14 -07:00
Jack Williams 67ca82b375 Add flag to omit default case (#33574) 2020-03-10 15:04:03 -07:00
Jack Williams 3bcea0dbba Fix #35060 (#35065)
* Fix 35060

* Refactor and check ro-array to tuple case

* Lint
2019-11-15 10:13:10 -08:00
Jack Williams 1c20aa0b1a Narrow unknown under inequality when assumed false (#33488) 2019-09-18 10:54:42 -07:00
Jack Williams 630499eca2 Assume void variables are initialized 2019-09-11 00:02:39 +01:00
Jack Williams ec39d41287 Change doc-string for Unreliable variance flag. (#33036) 2019-08-22 17:44:11 -07:00
Jack Williams f1cfefc3db Comment correction 2019-08-15 11:06:56 +01:00
Jack Williams 0949ad1130 Fix #24991: Weaken narrowing for == (#29840)
Spelling
2019-04-25 19:30:03 -07:00
Jack Williams 2ea91a0e9c Elaborate array and tuple relation errors 2019-04-15 18:16:38 +01:00
Jack Williams 5bef1aa13c Add regressions for conditional types that affect parameter variance (#30146) 2019-02-28 16:14:16 -08:00
Jack Williams 25f9a1fec2 Fix lint errors 2019-02-03 22:44:15 +00:00
Jack Williams 54801cbd17 Merge branch 'master' into switch-on-unknown 2019-02-03 22:36:40 +00:00
Jack Williams 30fa6d08cc Update baselines for types affected by JSON change 2019-02-03 16:49:52 +00:00
Jack Williams 3d0c7f3156 Narrow unknown in switch 2019-02-03 16:07:21 +00:00
Jack Williams 6f30537d13 Simplify type flag check 2019-01-25 09:41:35 +00:00
Jack Williams b27679eee3 Remove old test file that snuck in 2019-01-25 09:41:35 +00:00
Jack Williams 36cc154985 Narrow to any primitive or object and update tests 2019-01-25 09:41:34 +00:00
Jack Williams 1f2338bd78 Update test file and baselines 2019-01-25 09:41:34 +00:00
Jack Williams 267e5989cd Add narrowing for unknown with strict equal 2019-01-25 09:41:34 +00:00
Jack Williams 5651789629 Fix #29457
Use allTypesAssignableToKind instead of isTypeAssignableToKind to
account for union types.
2019-01-17 20:03:46 +00:00
Jack W abce9ae0be Bring typeof switch inline with if (#27680)
- Narrow unknown
- Narrow union members (in addition to filtering)
2018-10-26 14:56:26 -07:00
Jack Williams 8500f7ce20 Merge branch 'master' into trailing-void-args-are-optional 2018-10-18 19:22:18 +01:00
Jack Williams 342fda98d8 Allow trailing void arguments to be omitted 2018-10-03 19:35:05 +01:00
Jack Williams 3173cfee97 Update narrowing baseline 2018-09-06 09:45:22 +01:00
Jack Williams 911c59f47f Merge branch 'master' into typeof-in-switch 2018-09-06 09:33:01 +01:00
Jack Williams 5aaf1e6b7a Accept new baselines 2018-07-11 17:45:22 +01:00
Jack Williams 3911b5cca6 Merge branch 'master' into typeof-in-switch 2018-07-11 17:29:56 +01:00
Jack Williams 4d8529c9eb Improve comments in narrowBySwitchOnTypeOf 2018-07-11 11:00:44 +01:00
Jack Williams 6391742dca Make undefined for default case less pervasive by removing once done with it 2018-05-23 04:06:09 +01:00
Jack Williams 9e43183884 Add fall-through test and correct comment about implied type 2018-05-23 02:05:43 +01:00
Jack Williams 0d79831ead Add typeof-for-switch
Initial draft that works for union types

First draft of PR ready code with tests

Revert changed line for testing

Add exhaustiveness checking and move narrowByTypeOfWitnesses

Try caching mechanism

Comment out exhaustiveness checking to find perf regression

Re-enable exhaustiveness checking for typeof switches

Check if changes to narrowByTypeOfWitnesses fix perf alone.

Improve switch narrowing:

+ Take into account repeated clauses in the switch.
+ Handle unions of constrained type parameters.

Add more tests

Comments

Revert back to if-like behaviour

Remove redundant checks and simplify exhaustiveness checks

Change comment for narrowBySwitchOnTypeOf

Reduce implied type with getAssignmentReducedType

Remove any annotations
2018-04-18 23:17:36 +01:00
Jack Williams 5338500c05 Update symbol template test case with errors to include union types 2018-03-06 10:46:43 +00:00
Jack Williams 4e5c7be228 Add test case for taggedTemplate with symbol param and number return 2018-03-06 10:46:16 +00:00
Jack Williams fc08ff5a36 Check for symbol types in template expressions 2018-03-01 03:07:53 +00:00
jack-williams 67984c720e Fix #21848: Allows to mutate const with non-null assertion (#21873) 2018-02-12 10:57:59 -08:00
Jack Williams b16594b239 Ensure checkParameterInitializer always gets called 2018-01-10 20:33:44 +00:00
Jack Williams 4a86bc60a3 Add review suggestions
Move object destructuring assignment to checkObjectLiteralAssignment

Only check assignability of types in checkVariableLikeDeclaration for
object/array destructuring when there are properties present in the
pattern.
2018-01-10 19:52:04 +00:00
Jack Williams b9543bf617 Update initializerType when checking RHS of empty object destructure 2018-01-10 15:20:04 +00:00
Jack Williams 4acdca5258 Enforce strictNullChecks for RHS of empty destructuring assignment
When strictNullChecks is on, check the RHS of the following
destructuring assignments for possible null or undefined:

const {} = ...
const [] = ...
let {} = ...
let [] = ...
({} = ...)
2018-01-10 01:46:36 +00:00