TypeScript/tests/baselines/reference/voidOperatorWithStringType.types

173 lines
3.5 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithStringType.ts ===
// void operator on string type
var STRING: string;
>STRING : string
2014-08-15 23:33:16 +02:00
var STRING1: string[] = ["", "abc"];
>STRING1 : string[]
2014-08-15 23:33:16 +02:00
>["", "abc"] : string[]
2015-04-13 21:36:11 +02:00
>"" : string
>"abc" : string
2014-08-15 23:33:16 +02:00
function foo(): string { return "abc"; }
>foo : () => string
2015-04-13 21:36:11 +02:00
>"abc" : string
2014-08-15 23:33:16 +02:00
class A {
>A : A
2014-08-15 23:33:16 +02:00
public a: string;
>a : string
2014-08-15 23:33:16 +02:00
static foo() { return ""; }
>foo : () => string
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
}
module M {
>M : typeof M
2014-08-15 23:33:16 +02:00
export var n: string;
>n : string
2014-08-15 23:33:16 +02:00
}
var objA = new A();
>objA : A
2014-08-15 23:33:16 +02:00
>new A() : A
>A : typeof A
2014-08-15 23:33:16 +02:00
// string type var
var ResultIsAny1 = void STRING;
>ResultIsAny1 : any
2014-08-15 23:33:16 +02:00
>void STRING : undefined
>STRING : string
2014-08-15 23:33:16 +02:00
var ResultIsAny2 = void STRING1;
>ResultIsAny2 : any
2014-08-15 23:33:16 +02:00
>void STRING1 : undefined
>STRING1 : string[]
2014-08-15 23:33:16 +02:00
// string type literal
var ResultIsAny3 = void "";
>ResultIsAny3 : any
2014-08-15 23:33:16 +02:00
>void "" : undefined
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
var ResultIsAny4 = void { x: "", y: "" };
>ResultIsAny4 : any
2014-08-15 23:33:16 +02:00
>void { x: "", y: "" } : undefined
>{ x: "", y: "" } : { x: string; y: string; }
>x : string
2015-04-13 21:36:11 +02:00
>"" : string
>y : string
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } };
>ResultIsAny5 : any
2014-08-15 23:33:16 +02:00
>void { x: "", y: (s: string) => { return s; } } : undefined
>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; }
>x : string
2015-04-13 21:36:11 +02:00
>"" : string
>y : (s: string) => string
2014-08-15 23:33:16 +02:00
>(s: string) => { return s; } : (s: string) => string
>s : string
>s : string
2014-08-15 23:33:16 +02:00
// string type expressions
var ResultIsAny6 = void objA.a;
>ResultIsAny6 : any
2014-08-15 23:33:16 +02:00
>void objA.a : undefined
>objA.a : string
>objA : A
>a : string
2014-08-15 23:33:16 +02:00
var ResultIsAny7 = void M.n;
>ResultIsAny7 : any
2014-08-15 23:33:16 +02:00
>void M.n : undefined
>M.n : string
>M : typeof M
>n : string
2014-08-15 23:33:16 +02:00
var ResultIsAny8 = void STRING1[0];
>ResultIsAny8 : any
2014-08-15 23:33:16 +02:00
>void STRING1[0] : undefined
>STRING1[0] : string
>STRING1 : string[]
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
var ResultIsAny9 = void foo();
>ResultIsAny9 : any
2014-08-15 23:33:16 +02:00
>void foo() : undefined
>foo() : string
>foo : () => string
2014-08-15 23:33:16 +02:00
var ResultIsAny10 = void A.foo();
>ResultIsAny10 : any
2014-08-15 23:33:16 +02:00
>void A.foo() : undefined
>A.foo() : string
>A.foo : () => string
>A : typeof A
>foo : () => string
2014-08-15 23:33:16 +02:00
var ResultIsAny11 = void (STRING + STRING);
>ResultIsAny11 : any
2014-08-15 23:33:16 +02:00
>void (STRING + STRING) : undefined
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string
>STRING : string
2014-08-15 23:33:16 +02:00
var ResultIsAny12 = void STRING.charAt(0);
>ResultIsAny12 : any
2014-08-15 23:33:16 +02:00
>void STRING.charAt(0) : undefined
>STRING.charAt(0) : string
>STRING.charAt : (pos: number) => string
>STRING : string
>charAt : (pos: number) => string
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
// multiple void operators
var ResultIsAny13 = void void STRING;
>ResultIsAny13 : any
2014-08-15 23:33:16 +02:00
>void void STRING : undefined
>void STRING : undefined
>STRING : string
2014-08-15 23:33:16 +02:00
var ResultIsAny14 = void void void (STRING + STRING);
>ResultIsAny14 : any
2014-08-15 23:33:16 +02:00
>void void void (STRING + STRING) : undefined
>void void (STRING + STRING) : undefined
>void (STRING + STRING) : undefined
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string
>STRING : string
2014-08-15 23:33:16 +02:00
// miss assignment operators
void "";
>void "" : undefined
2015-04-13 21:36:11 +02:00
>"" : string
2014-08-15 23:33:16 +02:00
void STRING;
>void STRING : undefined
>STRING : string
2014-08-15 23:33:16 +02:00
void STRING1;
>void STRING1 : undefined
>STRING1 : string[]
2014-08-15 23:33:16 +02:00
void foo();
>void foo() : undefined
>foo() : string
>foo : () => string
2014-08-15 23:33:16 +02:00
void objA.a,M.n;
>void objA.a,M.n : string
>void objA.a : undefined
>objA.a : string
>objA : A
>a : string
>M.n : string
>M : typeof M
>n : string
2014-08-15 23:33:16 +02:00