Skip to content

Commit 6feafc9

Browse files
committed
Remove extra overload
1 parent ef3b113 commit 6feafc9

File tree

6 files changed

+100
-106
lines changed

6 files changed

+100
-106
lines changed

src/lib/es5.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ interface ObjectConstructor {
136136
*/
137137
getOwnPropertyNames(o: any): string[];
138138

139-
/**
140-
* Creates an object that has the specified prototype.
141-
* @param o Object to use as a prototype.
142-
*/
143-
create<T extends object>(o: T): T;
144-
145139
/**
146140
* Creates an object that has the specified prototype or that has null prototype.
147141
* @param o Object to use as a prototype. May be null.

tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'.
22
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
33
Property 'exec' is missing in type 'Object'.
4-
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'.
5-
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
6-
Property 'charAt' is missing in type 'Object'.
7-
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'.
8-
Property 'charAt' is missing in type 'Number'.
4+
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,5): error TS2322: Type 'object | Object' is not assignable to type 'String'.
5+
Type 'object' is not assignable to type 'String'.
6+
Property 'charAt' is missing in type '{}'.
7+
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,5): error TS2322: Type 'object | Number' is not assignable to type 'String'.
8+
Type 'object' is not assignable to type 'String'.
99
tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'.
1010
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
1111
Property 'name' is missing in type 'Object'.
@@ -22,13 +22,13 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Ty
2222

2323
var a: String = Object.create<Object>("");
2424
~
25-
!!! error TS2322: Type 'Object' is not assignable to type 'String'.
26-
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
27-
!!! error TS2322: Property 'charAt' is missing in type 'Object'.
25+
!!! error TS2322: Type 'object | Object' is not assignable to type 'String'.
26+
!!! error TS2322: Type 'object' is not assignable to type 'String'.
27+
!!! error TS2322: Property 'charAt' is missing in type '{}'.
2828
var c: String = Object.create<Number>(1);
2929
~
30-
!!! error TS2322: Type 'Number' is not assignable to type 'String'.
31-
!!! error TS2322: Property 'charAt' is missing in type 'Number'.
30+
!!! error TS2322: Type 'object | Number' is not assignable to type 'String'.
31+
!!! error TS2322: Type 'object' is not assignable to type 'String'.
3232

3333
var w: Error = new Object();
3434
~

tests/baselines/reference/objectCreate.symbols

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,67 @@ declare var union: null | { a: number, b: string };
77

88
var n = Object.create(null); // object
99
>n : Symbol(n, Decl(objectCreate.ts, 3, 3))
10-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
10+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
1111
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
12-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
12+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
1313

1414
var t = Object.create({ a: 1, b: "" }); // {a: number, b: string }
1515
>t : Symbol(t, Decl(objectCreate.ts, 4, 3))
16-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
16+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
1717
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
18-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
18+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
1919
>a : Symbol(a, Decl(objectCreate.ts, 4, 23))
2020
>b : Symbol(b, Decl(objectCreate.ts, 4, 29))
2121

2222
var u = Object.create(union); // object | {a: number, b: string }
2323
>u : Symbol(u, Decl(objectCreate.ts, 5, 3))
24-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
24+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
2525
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
26-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
26+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
2727
>union : Symbol(union, Decl(objectCreate.ts, 1, 11))
2828

2929
var e = Object.create({}); // {}
3030
>e : Symbol(e, Decl(objectCreate.ts, 6, 3))
31-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
31+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
3232
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
33-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
33+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
3434

3535
var o = Object.create(<object>{}); // object
3636
>o : Symbol(o, Decl(objectCreate.ts, 7, 3))
37-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
37+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
3838
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
39-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
39+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
4040

4141
var a = Object.create(null, {}); // any
4242
>a : Symbol(a, Decl(objectCreate.ts, 9, 3), Decl(objectCreate.ts, 10, 3), Decl(objectCreate.ts, 11, 3), Decl(objectCreate.ts, 12, 3), Decl(objectCreate.ts, 13, 3))
43-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
43+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
4444
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
45-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
45+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
4646

4747
var a = Object.create({ a: 1, b: "" }, {});
4848
>a : Symbol(a, Decl(objectCreate.ts, 9, 3), Decl(objectCreate.ts, 10, 3), Decl(objectCreate.ts, 11, 3), Decl(objectCreate.ts, 12, 3), Decl(objectCreate.ts, 13, 3))
49-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
49+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
5050
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
51-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
51+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
5252
>a : Symbol(a, Decl(objectCreate.ts, 10, 23))
5353
>b : Symbol(b, Decl(objectCreate.ts, 10, 29))
5454

5555
var a = Object.create(union, {});
5656
>a : Symbol(a, Decl(objectCreate.ts, 9, 3), Decl(objectCreate.ts, 10, 3), Decl(objectCreate.ts, 11, 3), Decl(objectCreate.ts, 12, 3), Decl(objectCreate.ts, 13, 3))
57-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
57+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
5858
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
59-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
59+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
6060
>union : Symbol(union, Decl(objectCreate.ts, 1, 11))
6161

6262
var a = Object.create({}, {});
6363
>a : Symbol(a, Decl(objectCreate.ts, 9, 3), Decl(objectCreate.ts, 10, 3), Decl(objectCreate.ts, 11, 3), Decl(objectCreate.ts, 12, 3), Decl(objectCreate.ts, 13, 3))
64-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
64+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
6565
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
66-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
66+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
6767

6868
var a = Object.create(<object>{}, {});
6969
>a : Symbol(a, Decl(objectCreate.ts, 9, 3), Decl(objectCreate.ts, 10, 3), Decl(objectCreate.ts, 11, 3), Decl(objectCreate.ts, 12, 3), Decl(objectCreate.ts, 13, 3))
70-
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
70+
>Object.create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
7171
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
72-
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
72+
>create : Symbol(ObjectConstructor.create, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
7373

tests/baselines/reference/objectCreate.types

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ declare var union: null | { a: number, b: string };
99
var n = Object.create(null); // object
1010
>n : object
1111
>Object.create(null) : object
12-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
12+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
1313
>Object : ObjectConstructor
14-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
14+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
1515
>null : null
1616

1717
var t = Object.create({ a: 1, b: "" }); // {a: number, b: string }
18-
>t : { a: number; b: string; }
19-
>Object.create({ a: 1, b: "" }) : { a: number; b: string; }
20-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
18+
>t : object | { a: number; b: string; }
19+
>Object.create({ a: 1, b: "" }) : object | { a: number; b: string; }
20+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
2121
>Object : ObjectConstructor
22-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
22+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
2323
>{ a: 1, b: "" } : { a: number; b: string; }
2424
>a : number
2525
>1 : 1
@@ -29,43 +29,43 @@ var t = Object.create({ a: 1, b: "" }); // {a: number, b: string }
2929
var u = Object.create(union); // object | {a: number, b: string }
3030
>u : object | { a: number; b: string; }
3131
>Object.create(union) : object | { a: number; b: string; }
32-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
32+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
3333
>Object : ObjectConstructor
34-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
34+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
3535
>union : { a: number; b: string; } | null
3636

3737
var e = Object.create({}); // {}
38-
>e : {}
39-
>Object.create({}) : {}
40-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
38+
>e : object | {}
39+
>Object.create({}) : object | {}
40+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
4141
>Object : ObjectConstructor
42-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
42+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
4343
>{} : {}
4444

4545
var o = Object.create(<object>{}); // object
4646
>o : object
4747
>Object.create(<object>{}) : object
48-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
48+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
4949
>Object : ObjectConstructor
50-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
50+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
5151
><object>{} : object
5252
>{} : {}
5353

5454
var a = Object.create(null, {}); // any
5555
>a : any
5656
>Object.create(null, {}) : any
57-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
57+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
5858
>Object : ObjectConstructor
59-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
59+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
6060
>null : null
6161
>{} : {}
6262

6363
var a = Object.create({ a: 1, b: "" }, {});
6464
>a : any
6565
>Object.create({ a: 1, b: "" }, {}) : any
66-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
66+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
6767
>Object : ObjectConstructor
68-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
68+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
6969
>{ a: 1, b: "" } : { a: number; b: string; }
7070
>a : number
7171
>1 : 1
@@ -76,27 +76,27 @@ var a = Object.create({ a: 1, b: "" }, {});
7676
var a = Object.create(union, {});
7777
>a : any
7878
>Object.create(union, {}) : any
79-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
79+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
8080
>Object : ObjectConstructor
81-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
81+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
8282
>union : { a: number; b: string; } | null
8383
>{} : {}
8484

8585
var a = Object.create({}, {});
8686
>a : any
8787
>Object.create({}, {}) : any
88-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
88+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
8989
>Object : ObjectConstructor
90-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
90+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
9191
>{} : {}
9292
>{} : {}
9393

9494
var a = Object.create(<object>{}, {});
9595
>a : any
9696
>Object.create(<object>{}, {}) : any
97-
>Object.create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
97+
>Object.create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
9898
>Object : ObjectConstructor
99-
>create : { <T extends object>(o: T): T; <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
99+
>create : { <T extends object>(o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; }
100100
><object>{} : object
101101
>{} : {}
102102
>{} : {}

0 commit comments

Comments
 (0)