-
Notifications
You must be signed in to change notification settings - Fork 12.8k
ES6 typings #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES6 typings #987
Changes from 4 commits
fe4a96e
c8db066
63e1363
4f8605b
13a6487
00bfc06
ff32be7
f5eef43
6ae43f3
6b5d0b0
20bbebc
4257e1c
abed6e4
ded34ef
7d6f7ea
2897612
1986fb1
0629bba
6c6d9bf
0dddfd9
25ce5db
19854a0
4413dd5
f33c1d5
1abe1d7
bdee183
4c2f5d1
ff2e4fa
ebf4ed8
d3e70ec
507ec3d
ef14da0
af38970
cc270c7
199b71c
99d13f4
4e79458
d390f67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,10 +109,7 @@ interface Object { | |
propertyIsEnumerable(v: string): boolean; | ||
} | ||
|
||
/** | ||
* Provides functionality common to all JavaScript objects. | ||
*/ | ||
declare var Object: { | ||
interface ObjectConstructor { | ||
new (value?: any): Object; | ||
(): any; | ||
(value: any): any; | ||
|
@@ -206,6 +203,11 @@ declare var Object: { | |
keys(o: any): string[]; | ||
} | ||
|
||
/** | ||
* Provides functionality common to all JavaScript objects. | ||
*/ | ||
declare var Object: ObjectConstructor; | ||
|
||
/** | ||
* Creates a new function. | ||
*/ | ||
|
@@ -240,8 +242,8 @@ interface Function { | |
caller: Function; | ||
} | ||
|
||
declare var Function: { | ||
/** | ||
interface FunctionConstructor { | ||
/** | ||
* Creates a new function. | ||
* @param args A list of arguments the function accepts. | ||
*/ | ||
|
@@ -250,6 +252,8 @@ declare var Function: { | |
prototype: Function; | ||
} | ||
|
||
declare var Function: FunctionConstructor; | ||
|
||
interface IArguments { | ||
[index: number]: any; | ||
length: number; | ||
|
@@ -409,24 +413,29 @@ interface String { | |
[index: number]: string; | ||
} | ||
|
||
/** | ||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings. | ||
*/ | ||
declare var String: { | ||
interface StringConstructor { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we set on fromCharCode(...codes: number[]): string; which is a method on the static side. A lot of I can honestly view it either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no strong feelings about the name. Personally I would rather not introduce a new named type and kept it the way it is now; and maybe we should. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer |
||
new (value?: any): String; | ||
(value?: any): string; | ||
prototype: String; | ||
fromCharCode(...codes: number[]): string; | ||
} | ||
|
||
/** | ||
* Allows manipulation and formatting of text strings and determination and location of substrings within strings. | ||
*/ | ||
declare var String: StringConstructor; | ||
|
||
interface Boolean { | ||
} | ||
declare var Boolean: { | ||
|
||
interface BoolenConstructor { | ||
new (value?: any): Boolean; | ||
(value?: any): boolean; | ||
prototype: Boolean; | ||
} | ||
|
||
declare var Boolean: BoolenConstructor; | ||
|
||
interface Number { | ||
/** | ||
* Returns a string representation of an object. | ||
|
@@ -453,8 +462,7 @@ interface Number { | |
toPrecision(precision?: number): string; | ||
} | ||
|
||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ | ||
declare var Number: { | ||
interface NumberConstructor { | ||
new (value?: any): Number; | ||
(value?: any): number; | ||
prototype: Number; | ||
|
@@ -484,6 +492,9 @@ declare var Number: { | |
POSITIVE_INFINITY: number; | ||
} | ||
|
||
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ | ||
declare var Number: NumberConstructor; | ||
|
||
interface Math { | ||
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ | ||
E: number; | ||
|
@@ -749,7 +760,7 @@ interface Date { | |
toJSON(key?: any): string; | ||
} | ||
|
||
declare var Date: { | ||
interface DateConstructor { | ||
new (): Date; | ||
new (value: number): Date; | ||
new (value: string): Date; | ||
|
@@ -775,6 +786,8 @@ declare var Date: { | |
now(): number; | ||
} | ||
|
||
declare var Date: DateConstructor; | ||
|
||
interface RegExpMatchArray extends Array<string> { | ||
index?: number; | ||
input?: string; | ||
|
@@ -815,7 +828,8 @@ interface RegExp { | |
// Non-standard extensions | ||
compile(): RegExp; | ||
} | ||
declare var RegExp: { | ||
|
||
interface RegExpConstructor { | ||
new (pattern: string, flags?: string): RegExp; | ||
(pattern: string, flags?: string): RegExp; | ||
|
||
|
@@ -832,64 +846,87 @@ declare var RegExp: { | |
lastMatch: string; | ||
} | ||
|
||
declare var RegExp: RegExpConstructor; | ||
|
||
interface Error { | ||
name: string; | ||
message: string; | ||
} | ||
declare var Error: { | ||
|
||
interface ErrorConstructor { | ||
new (message?: string): Error; | ||
(message?: string): Error; | ||
prototype: Error; | ||
} | ||
|
||
declare var Error: ErrorConstructor; | ||
|
||
interface EvalError extends Error { | ||
} | ||
declare var EvalError: { | ||
|
||
interface EvalErrorConstructor { | ||
new (message?: string): EvalError; | ||
(message?: string): EvalError; | ||
prototype: EvalError; | ||
} | ||
|
||
declare var EvalError: EvalErrorConstructor; | ||
|
||
interface RangeError extends Error { | ||
} | ||
declare var RangeError: { | ||
|
||
interface RangeErrorConstructor { | ||
new (message?: string): RangeError; | ||
(message?: string): RangeError; | ||
prototype: RangeError; | ||
} | ||
|
||
declare var RangeError: RangeErrorConstructor; | ||
|
||
interface ReferenceError extends Error { | ||
} | ||
declare var ReferenceError: { | ||
|
||
interface ReferenceErrorConstructor { | ||
new (message?: string): ReferenceError; | ||
(message?: string): ReferenceError; | ||
prototype: ReferenceError; | ||
} | ||
|
||
declare var ReferenceError: ReferenceErrorConstructor; | ||
|
||
interface SyntaxError extends Error { | ||
} | ||
declare var SyntaxError: { | ||
|
||
interface SyntaxErrorConstructor { | ||
new (message?: string): SyntaxError; | ||
(message?: string): SyntaxError; | ||
prototype: SyntaxError; | ||
} | ||
|
||
declare var SyntaxError: SyntaxErrorConstructor; | ||
|
||
interface TypeError extends Error { | ||
} | ||
declare var TypeError: { | ||
|
||
interface TypeErrorConstructor { | ||
new (message?: string): TypeError; | ||
(message?: string): TypeError; | ||
prototype: TypeError; | ||
} | ||
|
||
declare var TypeError: TypeErrorConstructor; | ||
|
||
interface URIError extends Error { | ||
} | ||
declare var URIError: { | ||
|
||
interface URIErrorConstructor { | ||
new (message?: string): URIError; | ||
(message?: string): URIError; | ||
prototype: URIError; | ||
} | ||
|
||
declare var URIError: URIErrorConstructor; | ||
|
||
interface JSON { | ||
/** | ||
* Converts a JavaScript Object Notation (JSON) string into an object. | ||
|
@@ -1092,7 +1129,8 @@ interface Array<T> { | |
|
||
[n: number]: T; | ||
} | ||
declare var Array: { | ||
|
||
interface ArrayConstructor { | ||
new (arrayLength?: number): any[]; | ||
new <T>(arrayLength: number): T[]; | ||
new <T>(...items: T[]): T[]; | ||
|
@@ -1102,3 +1140,5 @@ declare var Array: { | |
isArray(arg: any): boolean; | ||
prototype: Array<any>; | ||
} | ||
|
||
declare var Array: ArrayConstructor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no parens.