Skip to content

Commit aeeff28

Browse files
authored
Merge pull request microsoft#13350 from HerringtonDarkholme/lib
update declaration file to use intrinsic object type
2 parents a67b80d + e8af1d2 commit aeeff28

6 files changed

+12
-12
lines changed

src/lib/es2015.collection.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface ReadonlyMap<K, V> {
2222
readonly size: number;
2323
}
2424

25-
interface WeakMap<K, V> {
25+
interface WeakMap<K extends object, V> {
2626
delete(key: K): boolean;
2727
get(key: K): V | undefined;
2828
has(key: K): boolean;
@@ -31,7 +31,7 @@ interface WeakMap<K, V> {
3131

3232
interface WeakMapConstructor {
3333
new (): WeakMap<any, any>;
34-
new <K, V>(entries?: [K, V][]): WeakMap<K, V>;
34+
new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>;
3535
readonly prototype: WeakMap<any, any>;
3636
}
3737
declare var WeakMap: WeakMapConstructor;

src/lib/es2015.core.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ interface ObjectConstructor {
325325
* @param o The object to change its prototype.
326326
* @param proto The value of the new prototype or null.
327327
*/
328-
setPrototypeOf(o: any, proto: any): any;
328+
setPrototypeOf(o: any, proto: object | null): any;
329329

330330
/**
331331
* Gets the own property descriptor of the specified object.

src/lib/es2015.iterable.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ interface MapConstructor {
9999
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
100100
}
101101

102-
interface WeakMap<K, V> { }
102+
interface WeakMap<K extends object, V> { }
103103

104104
interface WeakMapConstructor {
105-
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
105+
new <K extends object, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
106106
}
107107

108108
interface Set<T> {
@@ -442,4 +442,4 @@ interface Float64ArrayConstructor {
442442
* @param thisArg Value of 'this' used to invoke the mapfn.
443443
*/
444444
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
445-
}
445+
}

src/lib/es2015.proxy.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface ProxyHandler<T> {
2-
getPrototypeOf? (target: T): {} | null;
2+
getPrototypeOf? (target: T): object | null;
33
setPrototypeOf? (target: T, v: any): boolean;
44
isExtensible? (target: T): boolean;
55
preventExtensions? (target: T): boolean;
@@ -12,7 +12,7 @@ interface ProxyHandler<T> {
1212
enumerate? (target: T): PropertyKey[];
1313
ownKeys? (target: T): PropertyKey[];
1414
apply? (target: T, thisArg: any, argArray?: any): any;
15-
construct? (target: T, argArray: any, newTarget?: any): {};
15+
construct? (target: T, argArray: any, newTarget?: any): object
1616
}
1717

1818
interface ProxyConstructor {

src/lib/es2015.symbol.wellknown.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ interface Map<K, V> {
110110
readonly [Symbol.toStringTag]: "Map";
111111
}
112112

113-
interface WeakMap<K, V>{
113+
interface WeakMap<K extends object, V>{
114114
readonly [Symbol.toStringTag]: "WeakMap";
115115
}
116116

@@ -324,4 +324,4 @@ interface Float32Array {
324324
*/
325325
interface Float64Array {
326326
readonly [Symbol.toStringTag]: "Float64Array";
327-
}
327+
}

src/lib/es5.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ interface ObjectConstructor {
146146
* Creates an object that has the specified prototype, and that optionally contains specified properties.
147147
* @param o Object to use as a prototype. May be null
148148
*/
149-
create<T>(o: T): T;
149+
create<T extends object>(o: T): T;
150150

151151
/**
152152
* Creates an object that has the specified prototype, and that optionally contains specified properties.
153153
* @param o Object to use as a prototype. May be null
154154
* @param properties JavaScript object that contains one or more property descriptors.
155155
*/
156-
create(o: any, properties: PropertyDescriptorMap): any;
156+
create(o: object | null, properties: PropertyDescriptorMap): any;
157157

158158
/**
159159
* Adds a property to an object, or modifies attributes of an existing property.

0 commit comments

Comments
 (0)