typenative 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish-github-packages.yml +73 -36
- package/CHANGELOG.md +109 -95
- package/LICENSE +21 -21
- package/README.md +154 -152
- package/bin/index.js +133 -126
- package/bin/transpiler.js +258 -15
- package/package.json +63 -59
- package/types/typenative.d.ts +247 -193
package/types/typenative.d.ts
CHANGED
|
@@ -1,193 +1,247 @@
|
|
|
1
|
-
interface Boolean {}
|
|
2
|
-
|
|
3
|
-
interface CallableFunction extends Function {}
|
|
4
|
-
|
|
5
|
-
interface Function {
|
|
6
|
-
/* apply(thisArg: any, argArray?: any): any;
|
|
7
|
-
call(thisArg: any, ...argArray: any[]): any;
|
|
8
|
-
bind(thisArg: any, ...argArray: any[]): any; */
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface IArguments {
|
|
12
|
-
[index: number]: any;
|
|
13
|
-
length: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface NewableFunction extends Function {}
|
|
17
|
-
|
|
18
|
-
interface Number {
|
|
19
|
-
toString(): string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface Object {
|
|
23
|
-
constructor: Function;
|
|
24
|
-
toString(): string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface RegExp {
|
|
28
|
-
test(string: string): boolean;
|
|
29
|
-
exec(string: string): string[] | null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface RegExpConstructor {
|
|
33
|
-
new (pattern: string, flags?: string): RegExp;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare var RegExp: RegExpConstructor;
|
|
37
|
-
|
|
38
|
-
interface SymbolConstructor {
|
|
39
|
-
readonly iterator: unique symbol;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare var Symbol: SymbolConstructor;
|
|
43
|
-
|
|
44
|
-
interface IteratorYieldResult<TYield> {
|
|
45
|
-
done?: false;
|
|
46
|
-
value: TYield;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface IteratorReturnResult<TReturn> {
|
|
50
|
-
done: true;
|
|
51
|
-
value: TReturn;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
|
|
55
|
-
|
|
56
|
-
interface Iterator<T, TReturn = any, TNext = any> {
|
|
57
|
-
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
|
58
|
-
next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
59
|
-
return?(value?: TReturn): IteratorResult<T, TReturn>;
|
|
60
|
-
throw?(e?: any): IteratorResult<T, TReturn>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {
|
|
64
|
-
[Symbol.iterator](): IterableIterator<T, TReturn, TNext>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface Array<T> extends IterableIterator<T> {
|
|
68
|
-
/**
|
|
69
|
-
* Gets or sets the length of the array. This is a number one higher than the highest index in the array.
|
|
70
|
-
*/
|
|
71
|
-
length: number;
|
|
72
|
-
/**
|
|
73
|
-
* Appends new elements to the end of an array.
|
|
74
|
-
*/
|
|
75
|
-
push(element: T): void;
|
|
76
|
-
/**
|
|
77
|
-
* Adds all the elements of an array into a string, separated by the specified separator string.
|
|
78
|
-
*/
|
|
79
|
-
join(separator?: string): string;
|
|
80
|
-
/**
|
|
81
|
-
* Returns a copy of a section of an array.
|
|
82
|
-
*/
|
|
83
|
-
slice(start?: number, end?: number): T[];
|
|
84
|
-
/**
|
|
85
|
-
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
|
86
|
-
*/
|
|
87
|
-
map<U>(callback: (value: T, index?: number, array?: T[]) => U): U[];
|
|
88
|
-
/**
|
|
89
|
-
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
90
|
-
*/
|
|
91
|
-
filter(callback: (value: T, index?: number, array?: T[]) => boolean): T[];
|
|
92
|
-
/**
|
|
93
|
-
* Determines whether the specified callback function returns true for any element of an array.
|
|
94
|
-
*/
|
|
95
|
-
some(callback: (value: T, index?: number, array?: T[]) => boolean): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Returns the value of the first element in the array where callback is true, and undefined otherwise.
|
|
98
|
-
*/
|
|
99
|
-
find(callback: (value: T, index?: number, array?: T[]) => boolean): T | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
|
|
102
|
-
*/
|
|
103
|
-
indexOf(searchElement: T): number;
|
|
104
|
-
/**
|
|
105
|
-
* Determines whether an array includes a certain element.
|
|
106
|
-
*/
|
|
107
|
-
includes(searchElement: T): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Returns a string representation of an array.
|
|
110
|
-
*/
|
|
111
|
-
toString(): string;
|
|
112
|
-
|
|
113
|
-
[n: number]: T;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface String {
|
|
117
|
-
/** Returns the length of the string. */
|
|
118
|
-
length: number;
|
|
119
|
-
/** Returns the character at the specified index. */
|
|
120
|
-
charAt(pos: number): string;
|
|
121
|
-
/** Returns the position of the first occurrence of a substring. */
|
|
122
|
-
indexOf(searchString: string): number;
|
|
123
|
-
/** Determines whether a string contains the specified substring. */
|
|
124
|
-
includes(searchString: string): boolean;
|
|
125
|
-
/** Determines whether a string begins with the specified characters. */
|
|
126
|
-
startsWith(searchString: string): boolean;
|
|
127
|
-
/** Determines whether a string ends with the specified characters. */
|
|
128
|
-
endsWith(searchString: string): boolean;
|
|
129
|
-
/** Splits a string into substrings using the specified separator. */
|
|
130
|
-
split(separator: string): string[];
|
|
131
|
-
/** Removes whitespace from both ends of a string. */
|
|
132
|
-
trim(): string;
|
|
133
|
-
/** Removes whitespace from the beginning of a string. */
|
|
134
|
-
trimStart(): string;
|
|
135
|
-
/** Removes whitespace from the end of a string. */
|
|
136
|
-
trimEnd(): string;
|
|
137
|
-
/** Converts all characters to uppercase. */
|
|
138
|
-
toUpperCase(): string;
|
|
139
|
-
/** Converts all characters to lowercase. */
|
|
140
|
-
toLowerCase(): string;
|
|
141
|
-
/** Replaces the first occurrence of a substring. */
|
|
142
|
-
replace(searchValue: string, replaceValue: string): string;
|
|
143
|
-
/** Replaces all occurrences of a substring. */
|
|
144
|
-
replaceAll(searchValue: string, replaceValue: string): string;
|
|
145
|
-
/** Returns a section of a string. */
|
|
146
|
-
substring(start: number, end?: number): string;
|
|
147
|
-
/** Returns a section of a string. */
|
|
148
|
-
slice(start: number, end?: number): string;
|
|
149
|
-
/** Returns a string repeated the specified number of times. */
|
|
150
|
-
repeat(count: number): string;
|
|
151
|
-
/** Concatenates strings. */
|
|
152
|
-
concat(...strings: string[]): string;
|
|
153
|
-
/** Returns a string representation. */
|
|
154
|
-
toString(): string;
|
|
155
|
-
[index: number]: string;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
interface Console {
|
|
159
|
-
log(...data: any[]): void;
|
|
160
|
-
time(label?: string): void;
|
|
161
|
-
timeEnd(label?: string): void;
|
|
162
|
-
}
|
|
163
|
-
declare var console: Console;
|
|
164
|
-
|
|
165
|
-
interface Math {
|
|
166
|
-
random(): number;
|
|
167
|
-
floor(x: number): number;
|
|
168
|
-
ceil(x: number): number;
|
|
169
|
-
round(x: number): number;
|
|
170
|
-
abs(x: number): number;
|
|
171
|
-
max(a: number, b: number): number;
|
|
172
|
-
min(a: number, b: number): number;
|
|
173
|
-
sqrt(x: number): number;
|
|
174
|
-
pow(base: number, exponent: number): number;
|
|
175
|
-
}
|
|
176
|
-
declare var Math: Math;
|
|
177
|
-
|
|
178
|
-
declare function parseInt(s: string): number;
|
|
179
|
-
declare function parseFloat(s: string): number;
|
|
180
|
-
|
|
181
|
-
interface Promise<T> {
|
|
182
|
-
then(callback: (value: T) => void): void;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
interface PromiseConstructor {
|
|
186
|
-
new <T>(executor: (resolve: (value: T) => void) => void): Promise<T>;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
declare var Promise: PromiseConstructor;
|
|
190
|
-
|
|
191
|
-
declare function setTimeout(callback: () => void, ms: number): void;
|
|
192
|
-
|
|
193
|
-
declare function assert(condition: boolean, message?: string): void;
|
|
1
|
+
interface Boolean {}
|
|
2
|
+
|
|
3
|
+
interface CallableFunction extends Function {}
|
|
4
|
+
|
|
5
|
+
interface Function {
|
|
6
|
+
/* apply(thisArg: any, argArray?: any): any;
|
|
7
|
+
call(thisArg: any, ...argArray: any[]): any;
|
|
8
|
+
bind(thisArg: any, ...argArray: any[]): any; */
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface IArguments {
|
|
12
|
+
[index: number]: any;
|
|
13
|
+
length: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NewableFunction extends Function {}
|
|
17
|
+
|
|
18
|
+
interface Number {
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Object {
|
|
23
|
+
constructor: Function;
|
|
24
|
+
toString(): string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface RegExp {
|
|
28
|
+
test(string: string): boolean;
|
|
29
|
+
exec(string: string): string[] | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface RegExpConstructor {
|
|
33
|
+
new (pattern: string, flags?: string): RegExp;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare var RegExp: RegExpConstructor;
|
|
37
|
+
|
|
38
|
+
interface SymbolConstructor {
|
|
39
|
+
readonly iterator: unique symbol;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare var Symbol: SymbolConstructor;
|
|
43
|
+
|
|
44
|
+
interface IteratorYieldResult<TYield> {
|
|
45
|
+
done?: false;
|
|
46
|
+
value: TYield;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface IteratorReturnResult<TReturn> {
|
|
50
|
+
done: true;
|
|
51
|
+
value: TReturn;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
|
|
55
|
+
|
|
56
|
+
interface Iterator<T, TReturn = any, TNext = any> {
|
|
57
|
+
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
|
|
58
|
+
next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
59
|
+
return?(value?: TReturn): IteratorResult<T, TReturn>;
|
|
60
|
+
throw?(e?: any): IteratorResult<T, TReturn>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {
|
|
64
|
+
[Symbol.iterator](): IterableIterator<T, TReturn, TNext>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface Array<T> extends IterableIterator<T> {
|
|
68
|
+
/**
|
|
69
|
+
* Gets or sets the length of the array. This is a number one higher than the highest index in the array.
|
|
70
|
+
*/
|
|
71
|
+
length: number;
|
|
72
|
+
/**
|
|
73
|
+
* Appends new elements to the end of an array.
|
|
74
|
+
*/
|
|
75
|
+
push(element: T): void;
|
|
76
|
+
/**
|
|
77
|
+
* Adds all the elements of an array into a string, separated by the specified separator string.
|
|
78
|
+
*/
|
|
79
|
+
join(separator?: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a copy of a section of an array.
|
|
82
|
+
*/
|
|
83
|
+
slice(start?: number, end?: number): T[];
|
|
84
|
+
/**
|
|
85
|
+
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
|
86
|
+
*/
|
|
87
|
+
map<U>(callback: (value: T, index?: number, array?: T[]) => U): U[];
|
|
88
|
+
/**
|
|
89
|
+
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
90
|
+
*/
|
|
91
|
+
filter(callback: (value: T, index?: number, array?: T[]) => boolean): T[];
|
|
92
|
+
/**
|
|
93
|
+
* Determines whether the specified callback function returns true for any element of an array.
|
|
94
|
+
*/
|
|
95
|
+
some(callback: (value: T, index?: number, array?: T[]) => boolean): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the value of the first element in the array where callback is true, and undefined otherwise.
|
|
98
|
+
*/
|
|
99
|
+
find(callback: (value: T, index?: number, array?: T[]) => boolean): T | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
|
|
102
|
+
*/
|
|
103
|
+
indexOf(searchElement: T): number;
|
|
104
|
+
/**
|
|
105
|
+
* Determines whether an array includes a certain element.
|
|
106
|
+
*/
|
|
107
|
+
includes(searchElement: T): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Returns a string representation of an array.
|
|
110
|
+
*/
|
|
111
|
+
toString(): string;
|
|
112
|
+
|
|
113
|
+
[n: number]: T;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface String {
|
|
117
|
+
/** Returns the length of the string. */
|
|
118
|
+
length: number;
|
|
119
|
+
/** Returns the character at the specified index. */
|
|
120
|
+
charAt(pos: number): string;
|
|
121
|
+
/** Returns the position of the first occurrence of a substring. */
|
|
122
|
+
indexOf(searchString: string): number;
|
|
123
|
+
/** Determines whether a string contains the specified substring. */
|
|
124
|
+
includes(searchString: string): boolean;
|
|
125
|
+
/** Determines whether a string begins with the specified characters. */
|
|
126
|
+
startsWith(searchString: string): boolean;
|
|
127
|
+
/** Determines whether a string ends with the specified characters. */
|
|
128
|
+
endsWith(searchString: string): boolean;
|
|
129
|
+
/** Splits a string into substrings using the specified separator. */
|
|
130
|
+
split(separator: string): string[];
|
|
131
|
+
/** Removes whitespace from both ends of a string. */
|
|
132
|
+
trim(): string;
|
|
133
|
+
/** Removes whitespace from the beginning of a string. */
|
|
134
|
+
trimStart(): string;
|
|
135
|
+
/** Removes whitespace from the end of a string. */
|
|
136
|
+
trimEnd(): string;
|
|
137
|
+
/** Converts all characters to uppercase. */
|
|
138
|
+
toUpperCase(): string;
|
|
139
|
+
/** Converts all characters to lowercase. */
|
|
140
|
+
toLowerCase(): string;
|
|
141
|
+
/** Replaces the first occurrence of a substring. */
|
|
142
|
+
replace(searchValue: string, replaceValue: string): string;
|
|
143
|
+
/** Replaces all occurrences of a substring. */
|
|
144
|
+
replaceAll(searchValue: string, replaceValue: string): string;
|
|
145
|
+
/** Returns a section of a string. */
|
|
146
|
+
substring(start: number, end?: number): string;
|
|
147
|
+
/** Returns a section of a string. */
|
|
148
|
+
slice(start: number, end?: number): string;
|
|
149
|
+
/** Returns a string repeated the specified number of times. */
|
|
150
|
+
repeat(count: number): string;
|
|
151
|
+
/** Concatenates strings. */
|
|
152
|
+
concat(...strings: string[]): string;
|
|
153
|
+
/** Returns a string representation. */
|
|
154
|
+
toString(): string;
|
|
155
|
+
[index: number]: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface Console {
|
|
159
|
+
log(...data: any[]): void;
|
|
160
|
+
time(label?: string): void;
|
|
161
|
+
timeEnd(label?: string): void;
|
|
162
|
+
}
|
|
163
|
+
declare var console: Console;
|
|
164
|
+
|
|
165
|
+
interface Math {
|
|
166
|
+
random(): number;
|
|
167
|
+
floor(x: number): number;
|
|
168
|
+
ceil(x: number): number;
|
|
169
|
+
round(x: number): number;
|
|
170
|
+
abs(x: number): number;
|
|
171
|
+
max(a: number, b: number): number;
|
|
172
|
+
min(a: number, b: number): number;
|
|
173
|
+
sqrt(x: number): number;
|
|
174
|
+
pow(base: number, exponent: number): number;
|
|
175
|
+
}
|
|
176
|
+
declare var Math: Math;
|
|
177
|
+
|
|
178
|
+
declare function parseInt(s: string): number;
|
|
179
|
+
declare function parseFloat(s: string): number;
|
|
180
|
+
|
|
181
|
+
interface Promise<T> {
|
|
182
|
+
then(callback: (value: T) => void): void;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface PromiseConstructor {
|
|
186
|
+
new <T>(executor: (resolve: (value: T) => void) => void): Promise<T>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare var Promise: PromiseConstructor;
|
|
190
|
+
|
|
191
|
+
declare function setTimeout(callback: () => void, ms: number): void;
|
|
192
|
+
|
|
193
|
+
declare function assert(condition: boolean, message?: string): void;
|
|
194
|
+
|
|
195
|
+
interface Error {
|
|
196
|
+
message: string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface ErrorConstructor {
|
|
200
|
+
new(message?: string): Error;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare var Error: ErrorConstructor;
|
|
204
|
+
|
|
205
|
+
interface Map<K, V> {
|
|
206
|
+
/** The number of key/value pairs in the Map. */
|
|
207
|
+
readonly size: number;
|
|
208
|
+
/** Adds or updates a key/value pair. */
|
|
209
|
+
set(key: K, value: V): this;
|
|
210
|
+
/** Returns the value for the given key, or undefined if absent. */
|
|
211
|
+
get(key: K): V | undefined;
|
|
212
|
+
/** Returns true if the key exists in the Map. */
|
|
213
|
+
has(key: K): boolean;
|
|
214
|
+
/** Removes the entry for the given key. Returns true if the entry existed. */
|
|
215
|
+
delete(key: K): boolean;
|
|
216
|
+
/** Removes all entries. */
|
|
217
|
+
clear(): void;
|
|
218
|
+
[Symbol.iterator](): Iterator<[K, V]>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface MapConstructor {
|
|
222
|
+
new <K, V>(): Map<K, V>;
|
|
223
|
+
new <K, V>(entries: [K, V][]): Map<K, V>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare var Map: MapConstructor;
|
|
227
|
+
|
|
228
|
+
interface Set<T> {
|
|
229
|
+
/** The number of values in the Set. */
|
|
230
|
+
readonly size: number;
|
|
231
|
+
/** Inserts a value (no-op if already present). Returns the Set. */
|
|
232
|
+
add(value: T): this;
|
|
233
|
+
/** Returns true if the value exists in the Set. */
|
|
234
|
+
has(value: T): boolean;
|
|
235
|
+
/** Removes the given value. Returns true if the value existed. */
|
|
236
|
+
delete(value: T): boolean;
|
|
237
|
+
/** Removes all values. */
|
|
238
|
+
clear(): void;
|
|
239
|
+
[Symbol.iterator](): Iterator<T>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface SetConstructor {
|
|
243
|
+
new <T>(): Set<T>;
|
|
244
|
+
new <T>(values: T[]): Set<T>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare var Set: SetConstructor;
|