Accepts baselines

This commit is contained in:
Tingan Ho 2015-07-09 11:48:42 +08:00
parent 28976a0e34
commit 52b1496a64
9 changed files with 174 additions and 91 deletions

View file

@ -29,6 +29,15 @@ export function fooWithSingleOverload(a: any) {
export function fooWithTypePredicate(a: any): a is number {
return true;
}
export function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a is number {
return true;
}
export function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T {
return true;
}
export function fooWithTypeTypePredicateAndRestParam(a: any, ...rest): a is number {
return true;
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
@ -100,6 +109,22 @@ function fooWithTypePredicate(a) {
return true;
}
exports.fooWithTypePredicate = fooWithTypePredicate;
function fooWithTypePredicateAndMulitpleParams(a, b, c) {
return true;
}
exports.fooWithTypePredicateAndMulitpleParams = fooWithTypePredicateAndMulitpleParams;
function fooWithTypeTypePredicateAndGeneric(a) {
return true;
}
exports.fooWithTypeTypePredicateAndGeneric = fooWithTypeTypePredicateAndGeneric;
function fooWithTypeTypePredicateAndRestParam(a) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
return true;
}
exports.fooWithTypeTypePredicateAndRestParam = fooWithTypeTypePredicateAndRestParam;
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
}
@ -153,6 +178,9 @@ export declare function fooWithOverloads(a: string): string;
export declare function fooWithOverloads(a: number): number;
export declare function fooWithSingleOverload(a: string): string;
export declare function fooWithTypePredicate(a: any): a is number;
export declare function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a is number;
export declare function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T;
export declare function fooWithTypeTypePredicateAndRestParam(a: any, ...rest: any[]): a is number;
//// [declFileFunctions_1.d.ts]
/** This comment should appear for foo*/
declare function globalfoo(): void;

View file

@ -64,50 +64,76 @@ export function fooWithTypePredicate(a: any): a is number {
return true;
}
export function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a is number {
>fooWithTypePredicateAndMulitpleParams : Symbol(fooWithTypePredicateAndMulitpleParams, Decl(declFileFunctions_0.ts, 27, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 28, 54))
>b : Symbol(b, Decl(declFileFunctions_0.ts, 28, 61))
>c : Symbol(c, Decl(declFileFunctions_0.ts, 28, 69))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 28, 54))
return true;
}
export function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T {
>fooWithTypeTypePredicateAndGeneric : Symbol(fooWithTypeTypePredicateAndGeneric, Decl(declFileFunctions_0.ts, 30, 1))
>T : Symbol(T, Decl(declFileFunctions_0.ts, 31, 51))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 31, 54))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 31, 54))
>T : Symbol(T, Decl(declFileFunctions_0.ts, 31, 51))
return true;
}
export function fooWithTypeTypePredicateAndRestParam(a: any, ...rest): a is number {
>fooWithTypeTypePredicateAndRestParam : Symbol(fooWithTypeTypePredicateAndRestParam, Decl(declFileFunctions_0.ts, 33, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 53))
>rest : Symbol(rest, Decl(declFileFunctions_0.ts, 34, 60))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 53))
return true;
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 27, 1))
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 36, 1))
}
/** This is comment for function signature*/
function nonExportedFooWithParameters(/** this is comment about a*/a: string,
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 31, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 40, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 38))
/** this is comment for b*/
b: number) {
>b : Symbol(b, Decl(declFileFunctions_0.ts, 33, 77))
>b : Symbol(b, Decl(declFileFunctions_0.ts, 42, 77))
var d = a;
>d : Symbol(d, Decl(declFileFunctions_0.ts, 36, 7))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
>d : Symbol(d, Decl(declFileFunctions_0.ts, 45, 7))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 38))
}
function nonExportedFooWithRestParameters(a: string, ...rests: string[]) {
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 37, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 46, 1))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 47, 42))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 47, 52))
return a + rests.join("");
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 47, 42))
>rests.join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 47, 52))
>join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
}
function nonExportedFooWithOverloads(a: string): string;
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 49, 1), Decl(declFileFunctions_0.ts, 51, 56), Decl(declFileFunctions_0.ts, 52, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 51, 37))
function nonExportedFooWithOverloads(a: number): number;
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 43, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 49, 1), Decl(declFileFunctions_0.ts, 51, 56), Decl(declFileFunctions_0.ts, 52, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 52, 37))
function nonExportedFooWithOverloads(a: any): any {
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 49, 1), Decl(declFileFunctions_0.ts, 51, 56), Decl(declFileFunctions_0.ts, 52, 56))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 53, 37))
return a;
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
>a : Symbol(a, Decl(declFileFunctions_0.ts, 53, 37))
}
=== tests/cases/compiler/declFileFunctions_1.ts ===

View file

@ -61,13 +61,42 @@ export function fooWithSingleOverload(a: any) {
}
export function fooWithTypePredicate(a: any): a is number {
>fooWithTypePredicate : (a: any) => boolean
>fooWithTypePredicate : (a: any) => a is number
>a : any
>a : any
return true;
>true : boolean
}
export function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a is number {
>fooWithTypePredicateAndMulitpleParams : (a: any, b: any, c: any) => a is number
>a : any
>b : any
>c : any
>a : any
return true;
>true : boolean
}
export function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T {
>fooWithTypeTypePredicateAndGeneric : <T>(a: any) => a is T
>T : T
>a : any
>a : any
>T : T
return true;
>true : boolean
}
export function fooWithTypeTypePredicateAndRestParam(a: any, ...rest): a is number {
>fooWithTypeTypePredicateAndRestParam : (a: any, ...rest: any[]) => a is number
>a : any
>rest : any[]
>a : any
return true;
>true : boolean
}
/** This comment should appear for nonExportedFoo*/
function nonExportedFoo() {

View file

@ -5,9 +5,9 @@ var maybeArray: number | number[];
if (Array.isArray(maybeArray)) {
>Array.isArray(maybeArray) : boolean
>Array.isArray : (arg: any) => boolean
>Array.isArray : (arg: any) => arg is any[]
>Array : ArrayConstructor
>isArray : (arg: any) => boolean
>isArray : (arg: any) => arg is any[]
>maybeArray : number | number[]
maybeArray.length; // OK

View file

@ -23,19 +23,19 @@ class C extends A {
}
declare function isA(p1: any): p1 is A;
>isA : (p1: any) => boolean
>isA : (p1: any) => p1 is A
>p1 : any
>p1 : any
>A : A
declare function isB(p1: any): p1 is B;
>isB : (p1: any) => boolean
>isB : (p1: any) => p1 is B
>p1 : any
>p1 : any
>B : B
declare function isC(p1: any): p1 is C;
>isC : (p1: any) => boolean
>isC : (p1: any) => p1 is C
>p1 : any
>p1 : any
>C : C
@ -55,7 +55,7 @@ var b: B;
// Basic
if (isC(a)) {
>isC(a) : boolean
>isC : (p1: any) => boolean
>isC : (p1: any) => p1 is C
>a : A
a.propC;
@ -71,7 +71,7 @@ var subType: C;
if(isA(subType)) {
>isA(subType) : boolean
>isA : (p1: any) => boolean
>isA : (p1: any) => p1 is A
>subType : C
subType.propC;
@ -88,7 +88,7 @@ var union: A | B;
if(isA(union)) {
>isA(union) : boolean
>isA : (p1: any) => boolean
>isA : (p1: any) => p1 is A
>union : A | B
union.propA;
@ -111,7 +111,7 @@ interface I1 {
// The parameter index and argument index for the type guard target is matching.
// The type predicate type is assignable to the parameter type.
declare function isC_multipleParams(p1, p2): p1 is C;
>isC_multipleParams : (p1: any, p2: any) => boolean
>isC_multipleParams : (p1: any, p2: any) => p1 is C
>p1 : any
>p2 : any
>p1 : any
@ -119,7 +119,7 @@ declare function isC_multipleParams(p1, p2): p1 is C;
if (isC_multipleParams(a, 0)) {
>isC_multipleParams(a, 0) : boolean
>isC_multipleParams : (p1: any, p2: any) => boolean
>isC_multipleParams : (p1: any, p2: any) => p1 is C
>a : A
>0 : number
@ -131,10 +131,10 @@ if (isC_multipleParams(a, 0)) {
// Methods
var obj: {
>obj : { func1(p1: A): boolean; }
>obj : { func1(p1: A): p1 is C; }
func1(p1: A): p1 is C;
>func1 : (p1: A) => boolean
>func1 : (p1: A) => p1 is C
>p1 : A
>A : A
>p1 : any
@ -144,7 +144,7 @@ class D {
>D : D
method1(p1: A): p1 is C {
>method1 : (p1: A) => boolean
>method1 : (p1: A) => p1 is C
>p1 : A
>A : A
>p1 : any
@ -157,8 +157,8 @@ class D {
// Arrow function
let f1 = (p1: A): p1 is C => false;
>f1 : (p1: A) => boolean
>(p1: A): p1 is C => false : (p1: A) => boolean
>f1 : (p1: A) => p1 is C
>(p1: A): p1 is C => false : (p1: A) => p1 is C
>p1 : A
>A : A
>p1 : any
@ -167,8 +167,8 @@ let f1 = (p1: A): p1 is C => false;
// Function type
declare function f2(p1: (p1: A) => p1 is C);
>f2 : (p1: (p1: A) => boolean) => any
>p1 : (p1: A) => boolean
>f2 : (p1: (p1: A) => p1 is C) => any
>p1 : (p1: A) => p1 is C
>p1 : A
>A : A
>p1 : any
@ -177,8 +177,8 @@ declare function f2(p1: (p1: A) => p1 is C);
// Function expressions
f2(function(p1: A): p1 is C {
>f2(function(p1: A): p1 is C { return true;}) : any
>f2 : (p1: (p1: A) => boolean) => any
>function(p1: A): p1 is C { return true;} : (p1: A) => boolean
>f2 : (p1: (p1: A) => p1 is C) => any
>function(p1: A): p1 is C { return true;} : (p1: A) => p1 is C
>p1 : A
>A : A
>p1 : any
@ -198,21 +198,21 @@ acceptingBoolean(isA(a));
>acceptingBoolean(isA(a)) : any
>acceptingBoolean : (a: boolean) => any
>isA(a) : boolean
>isA : (p1: any) => boolean
>isA : (p1: any) => p1 is A
>a : A
// Type predicates with different parameter name.
declare function acceptingTypeGuardFunction(p1: (item) => item is A);
>acceptingTypeGuardFunction : (p1: (item: any) => boolean) => any
>p1 : (item: any) => boolean
>acceptingTypeGuardFunction : (p1: (item: any) => item is A) => any
>p1 : (item: any) => item is A
>item : any
>item : any
>A : A
acceptingTypeGuardFunction(isA);
>acceptingTypeGuardFunction(isA) : any
>acceptingTypeGuardFunction : (p1: (item: any) => boolean) => any
>isA : (p1: any) => boolean
>acceptingTypeGuardFunction : (p1: (item: any) => item is A) => any
>isA : (p1: any) => p1 is A
// Binary expressions
let union2: C | B;
@ -225,7 +225,7 @@ let union3: boolean | B = isA(union2) || union2;
>B : B
>isA(union2) || union2 : boolean | B
>isA(union2) : boolean
>isA : (p1: any) => boolean
>isA : (p1: any) => p1 is A
>union2 : B | C
>union2 : B

View file

@ -12,15 +12,15 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(46,56)
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(60,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(65,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(70,7): error TS2339: Property 'propB' does not exist on type 'A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(75,46): error TS2345: Argument of type '(p1: any) => boolean' is not assignable to parameter of type '(p1: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(75,46): error TS2345: Argument of type '(p1: any) => p1 is C' is not assignable to parameter of type '(p1: any) => p1 is B'.
Type predicate 'p1 is C' is not assignable to 'p1 is B'.
Type 'C' is not assignable to type 'B'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(79,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(79,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'.
Signature '(p1: any, p2: any): boolean' must have a type predicate.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(85,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(85,1): error TS2322: Type '(p1: any, p2: any) => p2 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'.
Type predicate 'p2 is A' is not assignable to 'p1 is A'.
Parameter 'p2' is not in the same position as parameter 'p1'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(91,1): error TS2322: Type '(p1: any, p2: any, p3: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(91,1): error TS2322: Type '(p1: any, p2: any, p3: any) => p1 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,9): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,16): error TS1228: A type predicate is only allowed in return type position for functions and methods.
tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,20): error TS1228: A type predicate is only allowed in return type position for functions and methods.
@ -141,7 +141,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39
declare function acceptingDifferentSignatureTypeGuardFunction(p1: (p1) => p1 is B);
acceptingDifferentSignatureTypeGuardFunction(isC);
~~~
!!! error TS2345: Argument of type '(p1: any) => boolean' is not assignable to parameter of type '(p1: any) => boolean'.
!!! error TS2345: Argument of type '(p1: any) => p1 is C' is not assignable to parameter of type '(p1: any) => p1 is B'.
!!! error TS2345: Type predicate 'p1 is C' is not assignable to 'p1 is B'.
!!! error TS2345: Type 'C' is not assignable to type 'B'.
@ -149,7 +149,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39
var assign1: (p1, p2) => p1 is A;
assign1 = function(p1, p2): boolean {
~~~~~~~
!!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
!!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'.
!!! error TS2322: Signature '(p1: any, p2: any): boolean' must have a type predicate.
return true;
};
@ -158,7 +158,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39
var assign2: (p1, p2) => p1 is A;
assign2 = function(p1, p2): p2 is A {
~~~~~~~
!!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
!!! error TS2322: Type '(p1: any, p2: any) => p2 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'.
!!! error TS2322: Type predicate 'p2 is A' is not assignable to 'p1 is A'.
!!! error TS2322: Parameter 'p2' is not in the same position as parameter 'p1'.
return true;
@ -168,7 +168,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39
var assign3: (p1, p2) => p1 is A;
assign3 = function(p1, p2, p3): p1 is A {
~~~~~~~
!!! error TS2322: Type '(p1: any, p2: any, p3: any) => boolean' is not assignable to type '(p1: any, p2: any) => boolean'.
!!! error TS2322: Type '(p1: any, p2: any, p3: any) => p1 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'.
return true;
};

View file

@ -23,13 +23,13 @@ class C extends A {
}
declare function isB(p1): p1 is B;
>isB : (p1: any) => boolean
>isB : (p1: any) => p1 is B
>p1 : any
>p1 : any
>B : B
declare function isC(p1): p1 is C;
>isC : (p1: any) => boolean
>isC : (p1: any) => p1 is C
>p1 : any
>p1 : any
>C : C
@ -48,7 +48,7 @@ declare function funA<T>(p1: (p1) => T): T;
>T : T
declare function funB<T>(p1: (p1) => T, p2: any): p2 is T;
>funB : <T>(p1: (p1: any) => T, p2: any) => boolean
>funB : <T>(p1: (p1: any) => T, p2: any) => p2 is T
>T : T
>p1 : (p1: any) => T
>p1 : any
@ -58,18 +58,18 @@ declare function funB<T>(p1: (p1) => T, p2: any): p2 is T;
>T : T
declare function funC<T>(p1: (p1) => p1 is T): T;
>funC : <T>(p1: (p1: any) => boolean) => T
>funC : <T>(p1: (p1: any) => p1 is T) => T
>T : T
>p1 : (p1: any) => boolean
>p1 : (p1: any) => p1 is T
>p1 : any
>p1 : any
>T : T
>T : T
declare function funD<T>(p1: (p1) => p1 is T, p2: any): p2 is T;
>funD : <T>(p1: (p1: any) => boolean, p2: any) => boolean
>funD : <T>(p1: (p1: any) => p1 is T, p2: any) => p2 is T
>T : T
>p1 : (p1: any) => boolean
>p1 : (p1: any) => p1 is T
>p1 : any
>p1 : any
>T : T
@ -78,10 +78,10 @@ declare function funD<T>(p1: (p1) => p1 is T, p2: any): p2 is T;
>T : T
declare function funE<T, U>(p1: (p1) => p1 is T, p2: U): T;
>funE : <T, U>(p1: (p1: any) => boolean, p2: U) => T
>funE : <T, U>(p1: (p1: any) => p1 is T, p2: U) => T
>T : T
>U : U
>p1 : (p1: any) => boolean
>p1 : (p1: any) => p1 is T
>p1 : any
>p1 : any
>T : T
@ -97,11 +97,11 @@ let test1: boolean = funA(isB);
>test1 : boolean
>funA(isB) : boolean
>funA : <T>(p1: (p1: any) => T) => T
>isB : (p1: any) => boolean
>isB : (p1: any) => p1 is B
if (funB(retC, a)) {
>funB(retC, a) : boolean
>funB : <T>(p1: (p1: any) => T, p2: any) => boolean
>funB : <T>(p1: (p1: any) => T, p2: any) => p2 is T
>retC : (x: any) => C
>a : A
@ -114,13 +114,13 @@ let test2: B = funC(isB);
>test2 : B
>B : B
>funC(isB) : B
>funC : <T>(p1: (p1: any) => boolean) => T
>isB : (p1: any) => boolean
>funC : <T>(p1: (p1: any) => p1 is T) => T
>isB : (p1: any) => p1 is B
if (funD(isC, a)) {
>funD(isC, a) : boolean
>funD : <T>(p1: (p1: any) => boolean, p2: any) => boolean
>isC : (p1: any) => boolean
>funD : <T>(p1: (p1: any) => p1 is T, p2: any) => p2 is T
>isC : (p1: any) => p1 is C
>a : A
a.propC;
@ -132,7 +132,7 @@ let test3: B = funE(isB, 1);
>test3 : B
>B : B
>funE(isB, 1) : B
>funE : <T, U>(p1: (p1: any) => boolean, p2: U) => T
>isB : (p1: any) => boolean
>funE : <T, U>(p1: (p1: any) => p1 is T, p2: U) => T
>isB : (p1: any) => p1 is B
>1 : number

View file

@ -29,7 +29,7 @@ var strOrNum: string | number;
>strOrNum : string | number
function isC1(x: any): x is C1 {
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>x : any
>x : any
>C1 : C1
@ -39,7 +39,7 @@ function isC1(x: any): x is C1 {
}
function isC2(x: any): x is C2 {
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>x : any
>x : any
>C2 : C2
@ -49,7 +49,7 @@ function isC2(x: any): x is C2 {
}
function isD1(x: any): x is D1 {
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>x : any
>x : any
>D1 : D1
@ -68,7 +68,7 @@ str = isC1(c1Orc2) && c1Orc2.p1; // C1
>str : string
>isC1(c1Orc2) && c1Orc2.p1 : string
>isC1(c1Orc2) : boolean
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>c1Orc2 : C1 | C2
>c1Orc2.p1 : string
>c1Orc2 : C1
@ -79,7 +79,7 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2
>num : number
>isC2(c1Orc2) && c1Orc2.p2 : number
>isC2(c1Orc2) : boolean
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>c1Orc2 : C1 | C2
>c1Orc2.p2 : number
>c1Orc2 : C2
@ -90,7 +90,7 @@ str = isD1(c1Orc2) && c1Orc2.p1; // D1
>str : string
>isD1(c1Orc2) && c1Orc2.p1 : string
>isD1(c1Orc2) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c1Orc2 : C1 | C2
>c1Orc2.p1 : string
>c1Orc2 : D1
@ -101,7 +101,7 @@ num = isD1(c1Orc2) && c1Orc2.p3; // D1
>num : number
>isD1(c1Orc2) && c1Orc2.p3 : number
>isD1(c1Orc2) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c1Orc2 : C1 | C2
>c1Orc2.p3 : number
>c1Orc2 : D1
@ -117,7 +117,7 @@ num = isC2(c2Ord1) && c2Ord1.p2; // C2
>num : number
>isC2(c2Ord1) && c2Ord1.p2 : number
>isC2(c2Ord1) : boolean
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>c2Ord1 : C2 | D1
>c2Ord1.p2 : number
>c2Ord1 : C2
@ -128,7 +128,7 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1
>num : number
>isD1(c2Ord1) && c2Ord1.p3 : number
>isD1(c2Ord1) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c2Ord1 : C2 | D1
>c2Ord1.p3 : number
>c2Ord1 : D1
@ -139,7 +139,7 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1
>str : string
>isD1(c2Ord1) && c2Ord1.p1 : string
>isD1(c2Ord1) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c2Ord1 : C2 | D1
>c2Ord1.p1 : string
>c2Ord1 : D1
@ -151,7 +151,7 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1
>D1 : D1
>isC1(c2Ord1) && c2Ord1 : D1
>isC1(c2Ord1) : boolean
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>c2Ord1 : C2 | D1
>c2Ord1 : D1

View file

@ -48,7 +48,7 @@ var strOrNum: string | number;
function isC1(x: any): x is C1 {
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>x : any
>x : any
>C1 : C1
@ -58,7 +58,7 @@ function isC1(x: any): x is C1 {
}
function isC2(x: any): x is C2 {
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>x : any
>x : any
>C2 : C2
@ -68,7 +68,7 @@ function isC2(x: any): x is C2 {
}
function isD1(x: any): x is D1 {
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>x : any
>x : any
>D1 : D1
@ -99,7 +99,7 @@ str = isC1(c1Orc2) && c1Orc2.p1; // C1
>str : string
>isC1(c1Orc2) && c1Orc2.p1 : string
>isC1(c1Orc2) : boolean
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>c1Orc2 : C1 | C2
>c1Orc2.p1 : string
>c1Orc2 : C1
@ -110,7 +110,7 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2
>num : number
>isC2(c1Orc2) && c1Orc2.p2 : number
>isC2(c1Orc2) : boolean
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>c1Orc2 : C1 | C2
>c1Orc2.p2 : number
>c1Orc2 : C2
@ -121,7 +121,7 @@ str = isD1(c1Orc2) && c1Orc2.p1; // D1
>str : string
>isD1(c1Orc2) && c1Orc2.p1 : string
>isD1(c1Orc2) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c1Orc2 : C1 | C2
>c1Orc2.p1 : string
>c1Orc2 : D1
@ -132,7 +132,7 @@ num = isD1(c1Orc2) && c1Orc2.p3; // D1
>num : number
>isD1(c1Orc2) && c1Orc2.p3 : number
>isD1(c1Orc2) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c1Orc2 : C1 | C2
>c1Orc2.p3 : number
>c1Orc2 : D1
@ -148,7 +148,7 @@ num = isC2(c2Ord1) && c2Ord1.p2; // C2
>num : number
>isC2(c2Ord1) && c2Ord1.p2 : number
>isC2(c2Ord1) : boolean
>isC2 : (x: any) => boolean
>isC2 : (x: any) => x is C2
>c2Ord1 : C2 | D1
>c2Ord1.p2 : number
>c2Ord1 : C2
@ -159,7 +159,7 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1
>num : number
>isD1(c2Ord1) && c2Ord1.p3 : number
>isD1(c2Ord1) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c2Ord1 : C2 | D1
>c2Ord1.p3 : number
>c2Ord1 : D1
@ -170,7 +170,7 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1
>str : string
>isD1(c2Ord1) && c2Ord1.p1 : string
>isD1(c2Ord1) : boolean
>isD1 : (x: any) => boolean
>isD1 : (x: any) => x is D1
>c2Ord1 : C2 | D1
>c2Ord1.p1 : string
>c2Ord1 : D1
@ -182,7 +182,7 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1
>D1 : D1
>isC1(c2Ord1) && c2Ord1 : D1
>isC1(c2Ord1) : boolean
>isC1 : (x: any) => boolean
>isC1 : (x: any) => x is C1
>c2Ord1 : C2 | D1
>c2Ord1 : D1