Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e836fe1
Initial implementation of Union Types
ahejlsberg Oct 4, 2014
d70494f
Narrowing of variable types using typeof/instanceof type guards
ahejlsberg Oct 7, 2014
b8923b3
Support symbol kind for union properties
mhegazy Oct 8, 2014
5669f63
add test for quick info
mhegazy Oct 8, 2014
c439ae4
Add support for union properties in goto def
mhegazy Oct 8, 2014
95584e9
Addressing CR feedback
ahejlsberg Oct 8, 2014
fd5b808
Accepting new baselines
ahejlsberg Oct 8, 2014
3a17b02
Improved type argument inference with union types
ahejlsberg Oct 8, 2014
ea4cbbe
Merge branch 'master' into unionTypes
ahejlsberg Oct 8, 2014
5c661ba
Accepting new baselines after merge with master
ahejlsberg Oct 8, 2014
779db6e
Support find all refs on union properties
mhegazy Oct 9, 2014
2eb51ab
Use getRootSymbols for all union property needs
mhegazy Oct 9, 2014
dc43e83
Merge branch 'unionTypes' into unionTypesLS
mhegazy Oct 9, 2014
927f04f
Fix contextually typed object literal proeprties that are not propert…
mhegazy Oct 9, 2014
9f43ac0
respond to code review remarks
mhegazy Oct 10, 2014
bacb9d0
Test updates from union changes
danquirk Oct 10, 2014
8ce1760
Fixing merge conflicts
danquirk Oct 10, 2014
f5a9fee
ensure unionProperty symbols have declarations set at creation time
mhegazy Oct 10, 2014
483afea
Less aggressive subtype reduction in union types
ahejlsberg Oct 10, 2014
4e02b9f
Merge branch 'unionTypes' of https://github.com/Microsoft/TypeScript …
ahejlsberg Oct 10, 2014
c9a42c1
Accepting new baselines
ahejlsberg Oct 11, 2014
2ce627c
Handle union properties completions on apparant types
mhegazy Oct 11, 2014
4442b45
Add a temporary fix to quick info
mhegazy Oct 11, 2014
04e5309
Merge branch 'unionTypes' into unionTypesLS
mhegazy Oct 11, 2014
eee1602
Merge pull request #861 from Microsoft/unionTypesLS
mhegazy Oct 11, 2014
83d9aed
Correct contextual typing with union types
ahejlsberg Oct 13, 2014
a76a418
Accepting new baselines
ahejlsberg Oct 13, 2014
869ee41
Addressing CR feedback
ahejlsberg Oct 13, 2014
fc842b1
Merge branch 'master' into unionTypes
ahejlsberg Oct 13, 2014
4f4f59a
Merge changes from master in services.ts
mhegazy Oct 13, 2014
f5cd414
Merge branch 'master' into unionTypes
mhegazy Oct 13, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Accepting new baselines
  • Loading branch information
ahejlsberg committed Oct 13, 2014
commit a76a4188148f18f8758a3aeb9d657b0c45af07dd
2 changes: 1 addition & 1 deletion tests/baselines/reference/aliasUsageInArray.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface IHasVisualizationModel {
var xs: IHasVisualizationModel[] = [moduleA];
>xs : IHasVisualizationModel[]
>IHasVisualizationModel : IHasVisualizationModel
>[moduleA] : IHasVisualizationModel[]
>[moduleA] : typeof moduleA[]
>moduleA : typeof moduleA

var xs2: typeof moduleA[] = [moduleA];
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/arrayBestCommonTypes.types
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ module EmptyTypes {
>x : number
>y : base
>base : base
>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[]
>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: derived; }[]
>{ x: 7, y: new derived() } : { x: number; y: derived; }
>x : number
>y : derived
Expand All @@ -206,7 +206,7 @@ module EmptyTypes {
>x : boolean
>y : base
>base : base
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[]
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: derived; }[]
>{ x: true, y: new derived() } : { x: boolean; y: derived; }
>x : boolean
>y : derived
Expand All @@ -223,7 +223,7 @@ module EmptyTypes {
>x : string
>y : base
>base : base
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: base; }[]
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: derived; }[]
>{ x: undefined, y: new base() } : { x: undefined; y: base; }
>x : undefined
>undefined : undefined
Expand Down Expand Up @@ -557,7 +557,7 @@ module NonEmptyTypes {
>x : string
>y : base
>base : base
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : { x: string; y: base; }[]
>[{ x: undefined, y: new base() }, { x: '', y: new derived() }] : Array<{ x: undefined; y: base; } | { x: string; y: derived; }>
>{ x: undefined, y: new base() } : { x: undefined; y: base; }
>x : undefined
>undefined : undefined
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/arrayConcat2.types
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/compiler/arrayConcat2.ts ===
var a: string[] = [];
>a : string[]
>[] : string[]
>[] : undefined[]

a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/arrayLiteral.types
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var y = new Array<number>();

var x2: number[] = [];
>x2 : number[]
>[] : number[]
>[] : undefined[]

var x2: number[] = new Array(1);
>x2 : number[]
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayLiteralContextualType.types
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function bar(animals: { [n: number]: IAnimal }) { }
foo([
>foo([ new Giraffe(), new Elephant()]) : void
>foo : (animals: IAnimal[]) => void
>[ new Giraffe(), new Elephant()] : IAnimal[]
>[ new Giraffe(), new Elephant()] : Array<Giraffe | Elephant>

new Giraffe(),
>new Giraffe() : Giraffe
Expand All @@ -54,7 +54,7 @@ foo([
bar([
>bar([ new Giraffe(), new Elephant()]) : void
>bar : (animals: { [x: number]: IAnimal; }) => void
>[ new Giraffe(), new Elephant()] : IAnimal[]
>[ new Giraffe(), new Elephant()] : Array<Giraffe | Elephant>

new Giraffe(),
>new Giraffe() : Giraffe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ function panic(val: string[], ...opt: string[]) { }
panic([], 'one', 'two');
>panic([], 'one', 'two') : void
>panic : (val: string[], ...opt: string[]) => void
>[] : string[]
>[] : undefined[]

10 changes: 5 additions & 5 deletions tests/baselines/reference/arrayLiteralTypeInference.types
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ActionB extends Action {
var x1: Action[] = [
>x1 : Action[]
>Action : Action
>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : Action[]
>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }>

{ id: 2, trueness: false },
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
Expand All @@ -42,7 +42,7 @@ var x1: Action[] = [
var x2: Action[] = [
>x2 : Action[]
>Action : Action
>[ new ActionA(), new ActionB()] : Action[]
>[ new ActionA(), new ActionB()] : Array<ActionA | ActionB>

new ActionA(),
>new ActionA() : ActionA
Expand Down Expand Up @@ -78,7 +78,7 @@ var z1: { id: number }[] =
>id : number

[
>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : { id: number; }[]
>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : Array<{ id: number; trueness: boolean; } | { id: number; name: string; }>

{ id: 2, trueness: false },
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
Expand All @@ -97,7 +97,7 @@ var z2: { id: number }[] =
>id : number

[
>[ new ActionA(), new ActionB() ] : { id: number; }[]
>[ new ActionA(), new ActionB() ] : Array<ActionA | ActionB>

new ActionA(),
>new ActionA() : ActionA
Expand All @@ -114,7 +114,7 @@ var z3: { id: number }[] =
>id : number

[
>[ new Action(), new ActionA(), new ActionB() ] : { id: number; }[]
>[ new Action(), new ActionA(), new ActionB() ] : Action[]

new Action(),
>new Action() : Action
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/arrayLiterals.types
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '
>n : number
>a : string
>b : number
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : { a: string; b: number; }[]
>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : Array<{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }>
>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; }
>a : string
>b : number
Expand Down Expand Up @@ -105,7 +105,7 @@ class Derived2 extends Base { private n };
var context3: Base[] = [new Derived1(), new Derived2()];
>context3 : Base[]
>Base : Base
>[new Derived1(), new Derived2()] : Base[]
>[new Derived1(), new Derived2()] : Array<Derived1 | Derived2>
>new Derived1() : Derived1
>Derived1 : typeof Derived1
>new Derived2() : Derived2
Expand All @@ -115,7 +115,7 @@ var context3: Base[] = [new Derived1(), new Derived2()];
var context4: Base[] = [new Derived1(), new Derived1()];
>context4 : Base[]
>Base : Base
>[new Derived1(), new Derived1()] : Base[]
>[new Derived1(), new Derived1()] : Derived1[]
>new Derived1() : Derived1
>Derived1 : typeof Derived1
>new Derived1() : Derived1
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/badOverloadError.types
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ function method() {
>dictionary : { [x: string]: string; }
><{ [index: string]: string; }>{} : { [x: string]: string; }
>index : string
>{} : { [x: string]: string; }
>{} : { [x: string]: undefined; }
}

10 changes: 5 additions & 5 deletions tests/baselines/reference/contextualTypeArrayReturnType.types
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ interface Transform3D {
var style: IBookStyle = {
>style : IBookStyle
>IBookStyle : IBookStyle
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => NamedTransform[]; }
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { [x: string]: any; 'ry': any; }[]; }

initialLeftPageTransforms: (width: number) => {
>initialLeftPageTransforms : (width: number) => NamedTransform[]
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => NamedTransform[]
>initialLeftPageTransforms : (width: number) => { [x: string]: any; 'ry': any; }[]
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { [x: string]: any; 'ry': any; }[]
>width : number

return [
>[ {'ry': null } ] : NamedTransform[]
>[ {'ry': null } ] : { [x: string]: null; 'ry': null; }[]

{'ry': null }
>{'ry': null } : { [x: string]: Transform3D; 'ry': null; }
>{'ry': null } : { [x: string]: null; 'ry': null; }

];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/contextualTyping32.types
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret
>i : number
>foo([function(){return 1;}, function(){return 4}]) : void
>foo : (param: { (): number; (i: number): number; }[]) => void
>[function(){return 1;}, function(){return 4}] : { (): number; (i: number): number; }[]
>[function(){return 1;}, function(){return 4}] : { (): number; }[]
>function(){return 1;} : () => number
>function(){return 4} : () => number

4 changes: 2 additions & 2 deletions tests/baselines/reference/declFileGenericType2.types
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ module templa.dom.mvc.composite {
>super : typeof AbstractElementController

this._controllers = [];
>this._controllers = [] : templa.mvc.IController<templa.mvc.IModel>[]
>this._controllers = [] : undefined[]
>this._controllers : templa.mvc.IController<templa.mvc.IModel>[]
>this : AbstractCompositeElementController<ModelType>
>_controllers : templa.mvc.IController<templa.mvc.IModel>[]
>[] : templa.mvc.IController<templa.mvc.IModel>[]
>[] : undefined[]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var ANY1;

var ANY2: any[] = ["", ""];
>ANY2 : any[]
>["", ""] : any[]
>["", ""] : string[]

var obj = {x:1,y:null};
>obj : { x: number; y: any; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ b = d2;
var r: Base[] = [d1, d2];
>r : Base[]
>Base : Base
>[d1, d2] : Base[]
>[d1, d2] : Array<Derived | Derived2>
>d1 : Derived
>d2 : Derived2

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IIntervalTreeNode {
var test: IIntervalTreeNode[] = [{ interval: { begin: 0 }, children: null }]; // was error here because best common type is {}
>test : IIntervalTreeNode[]
>IIntervalTreeNode : IIntervalTreeNode
>[{ interval: { begin: 0 }, children: null }] : IIntervalTreeNode[]
>[{ interval: { begin: 0 }, children: null }] : { interval: { begin: number; }; children: null; }[]
>{ interval: { begin: 0 }, children: null } : { interval: { begin: number; }; children: null; }
>interval : { begin: number; }
>{ begin: 0 } : { begin: number; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var moduleMap: { [key: string]: IHasVisualizationModel } = {
>moduleMap : { [x: string]: IHasVisualizationModel; }
>key : string
>IHasVisualizationModel : IHasVisualizationModel
>{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: IHasVisualizationModel; "moduleA": typeof moduleA; "moduleB": typeof moduleB; }
>{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: typeof moduleA; "moduleA": typeof moduleA; "moduleB": typeof moduleB; }

"moduleA": moduleA,
>moduleA : typeof moduleA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ for (var a = ['a', 'b']; ;) { }
for (var a = <string[]>[]; ;) { }
>a : string[]
><string[]>[] : string[]
>[] : string[]
>[] : undefined[]

for (var a: string[] = []; ;) { }
>a : string[]
>[] : string[]
>[] : undefined[]

for (var a = new Array<string>(); ;) { }
>a : string[]
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/functionCall3.types
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/compiler/functionCall3.ts ===
function foo():any[]{return [1];}
>foo : () => any[]
>[1] : any[]
>[1] : number[]

var x = foo();
>x : any[]
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/functionOverloads42.types
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var x = foo([{a:'s'}]);
>x : number
>foo([{a:'s'}]) : number
>foo : { (bar: { a: number; }[]): string; (bar: { a: any; }[]): number; }
>[{a:'s'}] : { a: any; }[]
>[{a:'s'}] : { a: string; }[]
>{a:'s'} : { a: string; }
>a : string

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class EventBase {
private _listeners: { (...args: any[]): void; }[] = [];
>_listeners : { (...args: any[]): void; }[]
>args : any[]
>[] : { (...args: any[]): void; }[]
>[] : undefined[]

add(listener: (...args: any[]) => void): void {
>add : (listener: (...args: any[]) => void) => void
Expand Down
Loading