Skip to content

Commit

Permalink
Update narrowing baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-williams committed Sep 6, 2018
1 parent 911c59f commit 3173cfe
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions tests/baselines/reference/narrowingByTypeofInSwitch.types
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function assertSymbol(x: symbol) {
function assertFunction(x: Function) {
>assertFunction : (x: Function) => Function
>x : Function
>Function : Function

return x;
>x : Function
Expand All @@ -67,7 +66,6 @@ function assertUndefined(x: undefined) {
function assertAll(x: Basic) {
>assertAll : (x: Basic) => Basic
>x : Basic
>Basic : Basic

return x;
>x : Basic
Expand All @@ -91,12 +89,10 @@ function assertBooleanOrObject(x: boolean | object) {

type Basic = number | boolean | string | symbol | object | Function | undefined;
>Basic : Basic
>Function : Function

function testUnion(x: Basic) {
>testUnion : (x: Basic) => void
>x : Basic
>Basic : Basic

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -152,10 +148,7 @@ function testUnion(x: Basic) {

function testExtendsUnion<T extends Basic>(x: T) {
>testExtendsUnion : <T extends Basic>(x: T) => void
>T : T
>Basic : Basic
>x : T
>T : T

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -276,7 +269,6 @@ function a1(x: string | object | undefined) {
function testUnionExplicitDefault(x: Basic) {
>testUnionExplicitDefault : (x: Basic) => void
>x : Basic
>Basic : Basic

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -316,7 +308,6 @@ function testUnionExplicitDefault(x: Basic) {
function testUnionImplicitDefault(x: Basic) {
>testUnionImplicitDefault : (x: Basic) => string | object | undefined
>x : Basic
>Basic : Basic

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -354,10 +345,7 @@ function testUnionImplicitDefault(x: Basic) {

function testExtendsExplicitDefault<T extends Basic>(x: T) {
>testExtendsExplicitDefault : <T extends Basic>(x: T) => void
>T : T
>Basic : Basic
>x : T
>T : T

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -397,10 +385,7 @@ function testExtendsExplicitDefault<T extends Basic>(x: T) {

function testExtendsImplicitDefault<T extends Basic>(x: T) {
>testExtendsImplicitDefault : <T extends Basic>(x: T) => string | number | boolean | symbol | object | undefined
>T : T
>Basic : Basic
>x : T
>T : T

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -448,8 +433,6 @@ type R = { x: string, y: number }
function exhaustiveChecks(x: number | string | L | R): string {
>exhaustiveChecks : (x: string | number | R | L) => string
>x : string | number | R | L
>L : L
>R : R

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -483,11 +466,7 @@ function exhaustiveChecks(x: number | string | L | R): string {

function exhaustiveChecksGenerics<T extends L | R | number | string>(x: T): string {
>exhaustiveChecksGenerics : <T extends string | number | R | L>(x: T) => string
>T : T
>L : L
>R : R
>x : T
>T : T

switch (typeof x) {
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand All @@ -511,7 +490,6 @@ function exhaustiveChecksGenerics<T extends L | R | number | string>(x: T): stri
>(x as L) : L
>x as L : L
>x : T
>L : L
>42 : 42

case 'object': return (x as R).x; // Can't narrow generic
Expand All @@ -520,22 +498,13 @@ function exhaustiveChecksGenerics<T extends L | R | number | string>(x: T): stri
>(x as R) : R
>x as R : R
>x : T
>R : R
>x : string
}
}

function multipleGeneric<X extends L, Y extends R>(xy: X | Y): [X, string] | [Y, number] {
>multipleGeneric : <X extends L, Y extends R>(xy: X | Y) => [X, string] | [Y, number]
>X : X
>L : L
>Y : Y
>R : R
>xy : X | Y
>X : X
>Y : Y
>X : X
>Y : Y

switch (typeof xy) {
>typeof xy : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down Expand Up @@ -566,17 +535,7 @@ function multipleGeneric<X extends L, Y extends R>(xy: X | Y): [X, string] | [Y,

function multipleGenericFuse<X extends L | number, Y extends R | number>(xy: X | Y): [X, number] | [Y, string] | [(X | Y)] {
>multipleGenericFuse : <X extends number | L, Y extends number | R>(xy: X | Y) => [X, number] | [Y, string] | [X | Y]
>X : X
>L : L
>Y : Y
>R : R
>xy : X | Y
>X : X
>Y : Y
>X : X
>Y : Y
>X : X
>Y : Y

switch (typeof xy) {
>typeof xy : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand All @@ -603,15 +562,7 @@ function multipleGenericFuse<X extends L | number, Y extends R | number>(xy: X |

function multipleGenericExhaustive<X extends L, Y extends R>(xy: X | Y): [X, string] | [Y, number] {
>multipleGenericExhaustive : <X extends L, Y extends R>(xy: X | Y) => [X, string] | [Y, number]
>X : X
>L : L
>Y : Y
>R : R
>xy : X | Y
>X : X
>Y : Y
>X : X
>Y : Y

switch (typeof xy) {
>typeof xy : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
Expand Down

0 comments on commit 3173cfe

Please sign in to comment.