-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
This function types #6739
This function types #6739
Changes from 12 commits
0a968f0
d8a77c0
a639b71
9bd7afb
ca16209
22e571f
5fe8478
04e7d81
a4f1154
d030889
675e081
f6361ce
8032b06
0af56c0
8c87da5
2f74da1
71488fc
5821b87
80de700
fa59875
738713b
41bb446
a014edf
e7aa7e4
482accc
7b531fc
4012587
3297824
fa22250
3a46e72
1032cc5
c9f5f3d
a91cdcc
9e5f260
f64110a
0113ad5
e4ed7f9
0060b4d
da98258
ce68932
81f0d86
4197a30
9e5fba6
2a9f39b
921d5f8
6c735b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1819,6 +1819,10 @@ | |
"category": "Error", | ||
"code": 2670 | ||
}, | ||
"A function that is called with the 'new' keyword cannot have a 'this' type that is void.": { | ||
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. Void in single quotes 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. done |
||
"category": "Error", | ||
"code": 2671 | ||
}, | ||
"Import declaration '{0}' is using private name '{1}'.": { | ||
"category": "Error", | ||
"code": 4000 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,22 +215,25 @@ interface Function { | |
* @param thisArg The object to be used as the this object. | ||
* @param argArray A set of arguments to be passed to the function. | ||
*/ | ||
apply(thisArg: any, argArray?: any): any; | ||
apply<T,U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; | ||
apply(this: Function, thisArg: any, argArray?: any): any; | ||
|
||
/** | ||
* Calls a method of an object, substituting another object for the current object. | ||
* @param thisArg The object to be used as the current object. | ||
* @param argArray A list of arguments to be passed to the method. | ||
*/ | ||
call(thisArg: any, ...argArray: any[]): any; | ||
call<T,U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; | ||
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. Space after comma before 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. done |
||
call(this: Function, thisArg: any, ...argArray: any[]): any; | ||
|
||
/** | ||
* For a given function, creates a bound function that has the same body as the original function. | ||
* The this object of the bound function is associated with the specified object, and has the specified initial parameters. | ||
* @param thisArg An object to which the this keyword can refer inside the new function. | ||
* @param argArray A list of arguments to be passed to the new function. | ||
*/ | ||
bind(thisArg: any, ...argArray: any[]): any; | ||
bind<T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U; | ||
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. Wouldn't you want to place some constraint between 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.
|
||
bind(this: Function, thisArg: any, ...argArray: any[]): any; | ||
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. Is there a reason you need the explicit 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.
|
||
|
||
prototype: any; | ||
readonly length: number; | ||
|
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.
So any interface containing a method is now generic. Probably unavoidable, but we should get some data on what it means for performance.
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.
I ran some numbers this afternoon and didn't see a big change. Could be misreading the results though.
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.
Just to recap your findings: On the Monaco project this ends up adding as much as 10% to the check time for an overall impact of up to 5%.