mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Adding more tests
This commit is contained in:
parent
963de957cb
commit
ccffc9f25f
@ -1,5 +1,5 @@
|
||||
//// [objectLiteralContextualTyping.ts]
|
||||
// Test related to #1774
|
||||
// Tests related to #1774
|
||||
|
||||
interface Item {
|
||||
name: string;
|
||||
@ -15,15 +15,27 @@ var x: string;
|
||||
var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
|
||||
var y: string;
|
||||
|
||||
var z = foo({ a: 10 });
|
||||
var z = foo({ name: "Sprocket", description: false });
|
||||
var z: number;
|
||||
|
||||
var w = foo({ a: 10 });
|
||||
var w: number;
|
||||
|
||||
declare function bar<T>(param: { x?: T }): T;
|
||||
|
||||
var b = bar({});
|
||||
var b: {};
|
||||
|
||||
|
||||
//// [objectLiteralContextualTyping.js]
|
||||
// Test related to #1774
|
||||
// Tests related to #1774
|
||||
var x = foo({ name: "Sprocket" });
|
||||
var x;
|
||||
var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
|
||||
var y;
|
||||
var z = foo({ a: 10 });
|
||||
var z = foo({ name: "Sprocket", description: false });
|
||||
var z;
|
||||
var w = foo({ a: 10 });
|
||||
var w;
|
||||
var b = bar({});
|
||||
var b;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTyping.ts ===
|
||||
// Test related to #1774
|
||||
// Tests related to #1774
|
||||
|
||||
interface Item {
|
||||
>Item : Item
|
||||
@ -41,13 +41,41 @@ var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
|
||||
var y: string;
|
||||
>y : string
|
||||
|
||||
var z = foo({ a: 10 });
|
||||
var z = foo({ name: "Sprocket", description: false });
|
||||
>z : number
|
||||
>foo({ name: "Sprocket", description: false }) : number
|
||||
>foo : { (item: Item): string; (item: any): number; }
|
||||
>{ name: "Sprocket", description: false } : { name: string; description: boolean; }
|
||||
>name : string
|
||||
>description : boolean
|
||||
|
||||
var z: number;
|
||||
>z : number
|
||||
|
||||
var w = foo({ a: 10 });
|
||||
>w : number
|
||||
>foo({ a: 10 }) : number
|
||||
>foo : { (item: Item): string; (item: any): number; }
|
||||
>{ a: 10 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
var z: number;
|
||||
>z : number
|
||||
var w: number;
|
||||
>w : number
|
||||
|
||||
declare function bar<T>(param: { x?: T }): T;
|
||||
>bar : <T>(param: { x?: T; }) => T
|
||||
>T : T
|
||||
>param : { x?: T; }
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var b = bar({});
|
||||
>b : {}
|
||||
>bar({}) : {}
|
||||
>bar : <T>(param: { x?: T; }) => T
|
||||
>{} : { x?: {}; }
|
||||
|
||||
var b: {};
|
||||
>b : {}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Test related to #1774
|
||||
// Tests related to #1774
|
||||
|
||||
interface Item {
|
||||
name: string;
|
||||
@ -14,5 +14,13 @@ var x: string;
|
||||
var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
|
||||
var y: string;
|
||||
|
||||
var z = foo({ a: 10 });
|
||||
var z = foo({ name: "Sprocket", description: false });
|
||||
var z: number;
|
||||
|
||||
var w = foo({ a: 10 });
|
||||
var w: number;
|
||||
|
||||
declare function bar<T>(param: { x?: T }): T;
|
||||
|
||||
var b = bar({});
|
||||
var b: {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user