Skip to content

Commit 5ee1b5f

Browse files
authored
Merge pull request #10 from graphemecluster/master
Several Improvements
2 parents 0bb4da3 + 78c7247 commit 5ee1b5f

34 files changed

+2076
-607
lines changed

build/replacement.ts

+3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export const replacement = new Map([
55
"eval",
66
"ObjectConstructor",
77
"CallableFunction",
8+
"NewableFunction",
89
"IArguments",
10+
"String",
911
"JSON",
1012
"ArrayConstructor",
1113
"ReadonlyArray",
@@ -45,6 +47,7 @@ export const replacement = new Map([
4547
["es2015.promise.d.ts", new Set(["PromiseConstructor"])],
4648
["es2015.proxy.d.ts", new Set(["ProxyHandler"])],
4749
["es2015.reflect.d.ts", new Set(["Reflect"])],
50+
["es2015.symbol.wellknown.d.ts", new Set(["Array", "RegExp", "String"])],
4851
["es2017.object.d.ts", new Set(["ObjectConstructor"])],
4952
["es2018.asyncgenerator.d.ts", new Set(["AsyncGenerator"])],
5053
["es2018.asynciterable.d.ts", new Set(["AsyncIterator"])],

docs/diff.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The following files are improved in better-typescript-lib:
1010
- [es2015.promise.d.ts](./diff/es2015.promise.d.ts.md)
1111
- [es2015.proxy.d.ts](./diff/es2015.proxy.d.ts.md)
1212
- [es2015.reflect.d.ts](./diff/es2015.reflect.d.ts.md)
13+
- [es2015.symbol.wellknown.d.ts](./diff/es2015.symbol.wellknown.d.ts.md)
1314
- [es2017.object.d.ts](./diff/es2017.object.d.ts.md)
1415
- [es2018.asyncgenerator.d.ts](./diff/es2018.asyncgenerator.d.ts.md)
1516
- [es2018.asynciterable.d.ts](./diff/es2018.asynciterable.d.ts.md)

docs/diff/es2015.collection.d.ts.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ Index: es2015.collection.d.ts
55
===================================================================
66
--- es2015.collection.d.ts
77
+++ es2015.collection.d.ts
8-
@@ -1,28 +1,28 @@
8+
@@ -1,28 +1,30 @@
9+
+/// <reference no-default-lib="true"/>
10+
+
911
interface Map<K, V> {
1012
clear(): void;
1113
delete(key: K): boolean;
1214
- forEach(
1315
- callbackfn: (value: V, key: K, map: Map<K, V>) => void,
1416
- thisArg?: any
15-
+ forEach<This>(
17+
+ forEach<This = undefined>(
1618
+ callbackfn: (this: This, value: V, key: K, map: Map<K, V>) => void,
1719
+ thisArg?: This
1820
): void;
@@ -36,14 +38,14 @@ Index: es2015.collection.d.ts
3638
- forEach(
3739
- callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void,
3840
- thisArg?: any
39-
+ forEach<This>(
41+
+ forEach<This = undefined>(
4042
+ callbackfn: (this: This, value: V, key: K, map: ReadonlyMap<K, V>) => void,
4143
+ thisArg?: This
4244
): void;
4345
get(key: K): V | undefined;
4446
has(key: K): boolean;
4547
readonly size: number;
46-
@@ -33,39 +33,39 @@
48+
@@ -33,39 +35,39 @@
4749
get(key: K): V | undefined;
4850
has(key: K): boolean;
4951
set(key: K, value: V): this;
@@ -52,8 +54,9 @@ Index: es2015.collection.d.ts
5254

5355
interface WeakMapConstructor {
5456
- new <K extends object = object, V = any>(
55-
+ new <K extends object = object, V = unknown>(
56-
entries?: readonly [K, V][] | null
57+
- entries?: readonly [K, V][] | null
58+
+ new <K extends object, V>(
59+
+ entries?: readonly (readonly [K, V])[] | null
5760
): WeakMap<K, V>;
5861
- readonly prototype: WeakMap<object, any>;
5962
+ readonly prototype: WeakMap<object, unknown>;
@@ -67,7 +70,7 @@ Index: es2015.collection.d.ts
6770
- forEach(
6871
- callbackfn: (value: T, value2: T, set: Set<T>) => void,
6972
- thisArg?: any
70-
+ forEach<This>(
73+
+ forEach<This = undefined>(
7174
+ callbackfn: (this: This, value: T, value2: T, set: Set<T>) => void,
7275
+ thisArg?: This
7376
): void;
@@ -88,7 +91,7 @@ Index: es2015.collection.d.ts
8891
- forEach(
8992
- callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void,
9093
- thisArg?: any
91-
+ forEach<This>(
94+
+ forEach<This = undefined>(
9295
+ callbackfn: (this: This, value: T, value2: T, set: ReadonlySet<T>) => void,
9396
+ thisArg?: This
9497
): void;

docs/diff/es2015.core.d.ts.md

+29-83
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ Index: es2015.core.d.ts
55
===================================================================
66
--- es2015.core.d.ts
77
+++ es2015.core.d.ts
8-
@@ -201,9 +201,8 @@
8+
@@ -200,9 +200,9 @@
9+
* Returns an implementation-dependent approximation to the cube root of number.
910
* @param x A numeric expression.
1011
*/
1112
cbrt(x: number): number;
12-
}
13-
-
13+
-}
14+
+} /// <reference no-default-lib="true"/>
15+
1416
interface NumberConstructor {
1517
/**
1618
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
17-
* that is representable as a Number value, which is approximately:
18-
@@ -216,29 +215,29 @@
19+
@@ -216,29 +216,29 @@
1920
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
2021
* number. Only finite values of the type number, result in true.
2122
* @param number A numeric value.
@@ -49,18 +50,7 @@ Index: es2015.core.d.ts
4950
/**
5051
* The value of the largest integer n such that n and n + 1 are both exactly representable as
5152
* a Number value.
52-
@@ -261,9 +260,9 @@
53-
54-
/**
55-
* Converts A string to an integer.
56-
* @param string A string to convert into a number.
57-
- * @param radix A value between 2 and 36 that specifies the base of the number in `string`.
58-
+ * @param radix A value between 2 and 36 that specifies the base of the number in numString.
59-
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
60-
* All other strings are considered decimal.
61-
*/
62-
parseInt(string: string, radix?: number): number;
63-
@@ -273,45 +272,16 @@
53+
@@ -273,45 +273,16 @@
6454
/**
6555
* Copy the values of all of the enumerable own properties from one or more source objects to a
6656
* target object. Returns the target object.
@@ -95,7 +85,7 @@ Index: es2015.core.d.ts
9585
- source3: W
9686
- ): T & U & V & W;
9787
+ ...sources: Ts
98-
+ ): UnionToIntersection<T | Ts[number]>;
88+
+ ): First<UnionToIntersection<[T] | { [K in keyof Ts]: [Ts[K]] }[number]>>;
9989

10090
/**
10191
- * Copy the values of all of the enumerable own properties from one or more source objects to a
@@ -110,18 +100,33 @@ Index: es2015.core.d.ts
110100
* @param o Object to retrieve the symbols from.
111101
*/
112102
getOwnPropertySymbols(o: any): symbol[];
113-
@@ -333,9 +303,9 @@
103+
@@ -326,16 +297,23 @@
104+
* Returns true if the values are the same value, false otherwise.
105+
* @param value1 The first value.
106+
* @param value2 The second value.
107+
*/
108+
- is(value1: any, value2: any): boolean;
109+
+ is<T>(value1: T, value2: T): boolean;
110+
111+
/**
114112
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
115113
* @param o The object to change its prototype.
116114
* @param proto The value of the new prototype or null.
117115
*/
118116
- setPrototypeOf(o: any, proto: object | null): any;
119-
+ setPrototypeOf<T>(o: T, proto: object | null): T;
117+
+ setPrototypeOf<T extends object, U extends object>(o: T, proto: U): T & U;
118+
+
119+
+ /**
120+
+ * Sets the prototype of a specified object o to object proto or null. Returns the object o.
121+
+ * @param o The object to change its prototype.
122+
+ * @param proto The value of the new prototype or null.
123+
+ */
124+
+ setPrototypeOf<T extends object>(o: T, proto: null): T;
120125
}
121126

122127
interface ReadonlyArray<T> {
123128
/**
124-
@@ -440,19 +410,11 @@
129+
@@ -440,19 +418,11 @@
125130
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
126131
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
127132
* is "NFC"
@@ -142,7 +147,7 @@ Index: es2015.core.d.ts
142147
* the empty string is returned.
143148
* @param count number of copies to append
144149
*/
145-
@@ -466,33 +428,33 @@
150+
@@ -466,10 +436,10 @@
146151
startsWith(searchString: string, position?: number): boolean;
147152

148153
/**
@@ -154,75 +159,16 @@ Index: es2015.core.d.ts
154159
anchor(name: string): string;
155160

156161
/**
157-
- * Returns a `<big>` HTML element
158-
+ * Returns a `<big>` HTML element
159-
* @deprecated A legacy feature for browser compatibility
160-
*/
161-
big(): string;
162-
163-
/**
164-
- * Returns a `<blink>` HTML element
165-
+ * Returns a `<blink>` HTML element
166-
* @deprecated A legacy feature for browser compatibility
167-
*/
168-
blink(): string;
169-
170-
/**
171-
- * Returns a `<b>` HTML element
172-
+ * Returns a `<bold>` HTML element
173-
* @deprecated A legacy feature for browser compatibility
174-
*/
175-
bold(): string;
176-
177-
/**
178-
- * Returns a `<tt>` HTML element
179-
+ * Returns a `<tt>` HTML element
180-
* @deprecated A legacy feature for browser compatibility
181-
*/
182-
fixed(): string;
183-
184-
@@ -514,9 +476,9 @@
162+
@@ -514,9 +484,9 @@
185163
*/
186164
fontsize(size: string): string;
187165

188166
/**
189167
- * Returns an `<i>` HTML element
190-
+ * Returns a `<i>` HTML element
168+
+ * Returns a `<i>` HTML element
191169
* @deprecated A legacy feature for browser compatibility
192170
*/
193171
italics(): string;
194172

195-
@@ -526,27 +488,27 @@
196-
*/
197-
link(url: string): string;
198-
199-
/**
200-
- * Returns a `<small>` HTML element
201-
+ * Returns a `<small>` HTML element
202-
* @deprecated A legacy feature for browser compatibility
203-
*/
204-
small(): string;
205-
206-
/**
207-
- * Returns a `<strike>` HTML element
208-
+ * Returns a `<strike>` HTML element
209-
* @deprecated A legacy feature for browser compatibility
210-
*/
211-
strike(): string;
212-
213-
/**
214-
- * Returns a `<sub>` HTML element
215-
+ * Returns a `<sub>` HTML element
216-
* @deprecated A legacy feature for browser compatibility
217-
*/
218-
sub(): string;
219-
220-
/**
221-
- * Returns a `<sup>` HTML element
222-
+ * Returns a `<sup>` HTML element
223-
* @deprecated A legacy feature for browser compatibility
224-
*/
225-
sup(): string;
226-
}
227173

228174
```

docs/diff/es2015.proxy.d.ts.md

+16-23
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,14 @@ Index: es2015.proxy.d.ts
55
===================================================================
66
--- es2015.proxy.d.ts
77
+++ es2015.proxy.d.ts
8-
@@ -1,25 +1,28 @@
8+
@@ -1,25 +1,27 @@
99
+/// <reference no-default-lib="true"/>
1010
+
1111
interface ProxyHandler<T extends object> {
1212
- apply?(target: T, thisArg: any, argArray: any[]): any;
1313
- construct?(target: T, argArray: any[], newTarget: Function): object;
14-
+ getPrototypeOf?(target: T): object | null;
15-
+ setPrototypeOf?(target: T, v: unknown): boolean;
16-
+ isExtensible?(target: T): boolean;
17-
+ preventExtensions?(target: T): boolean;
18-
+ getOwnPropertyDescriptor?(
19-
+ target: T,
20-
+ p: PropertyKey
21-
+ ): PropertyDescriptor | undefined;
22-
+ has?(target: T, p: PropertyKey): boolean;
23-
+ get?(target: T, p: PropertyKey, receiver: unknown): any;
24-
+ set?(target: T, p: PropertyKey, value: unknown, receiver: unknown): boolean;
25-
+ deleteProperty?(target: T, p: PropertyKey): boolean;
14+
+ apply?(target: T, thisArg: unknown, argArray: unknown[]): any;
15+
+ construct?(target: T, argArray: unknown[], newTarget: unknown): object;
2616
defineProperty?(
2717
target: T,
2818
- p: string | symbol,
@@ -31,21 +21,24 @@ Index: es2015.proxy.d.ts
3121
): boolean;
3222
- deleteProperty?(target: T, p: string | symbol): boolean;
3323
- get?(target: T, p: string | symbol, receiver: any): any;
34-
- getOwnPropertyDescriptor?(
35-
- target: T,
24+
+ deleteProperty?(target: T, p: PropertyKey): boolean;
25+
+ get?(target: T, p: PropertyKey, receiver: unknown): any;
26+
getOwnPropertyDescriptor?(
27+
target: T,
3628
- p: string | symbol
37-
- ): PropertyDescriptor | undefined;
38-
- getPrototypeOf?(target: T): object | null;
29+
+ p: PropertyKey
30+
): PropertyDescriptor | undefined;
31+
getPrototypeOf?(target: T): object | null;
3932
- has?(target: T, p: string | symbol): boolean;
40-
- isExtensible?(target: T): boolean;
33+
+ has?(target: T, p: PropertyKey): boolean;
34+
isExtensible?(target: T): boolean;
4135
- ownKeys?(target: T): ArrayLike<string | symbol>;
42-
- preventExtensions?(target: T): boolean;
36+
+ ownKeys?(target: T): PropertyKey[];
37+
preventExtensions?(target: T): boolean;
4338
- set?(target: T, p: string | symbol, value: any, receiver: any): boolean;
4439
- setPrototypeOf?(target: T, v: object | null): boolean;
45-
+ enumerate?(target: T): PropertyKey[];
46-
+ ownKeys?(target: T): PropertyKey[];
47-
+ apply?(target: T, thisArg: unknown, argArray: unknown[]): any;
48-
+ construct?(target: T, argArray: unknown[], newTarget: unknown): object;
40+
+ set?(target: T, p: PropertyKey, value: unknown, receiver: unknown): boolean;
41+
+ setPrototypeOf?(target: T, v: unknown): boolean;
4942
}
5043

5144
interface ProxyConstructor {

0 commit comments

Comments
 (0)