-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix Array interface (#10886) #11294
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
Fix Array interface (#10886) #11294
Conversation
What's the bug tracking this change? |
Fixes #10886 |
Can someone review this? |
sorry for the late reply. can you refresh this PR? |
a2a78de
to
9435be6
Compare
done |
now updating |
9435be6
to
c74dcb6
Compare
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.
#10886 is not acceptable because of confusing with tuple types.
>regExpExecArrayValue.slice() : string[] | ||
>regExpExecArrayValue.slice : (start?: number, end?: number) => string[] | ||
>regExpExecArrayValue.slice() : RegExpExecArray | ||
>regExpExecArrayValue.slice : (start?: number, end?: number) => RegExpExecArray |
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.
Wrong, must return string[]
. It can avoid by overloading in RegExpExecArray and RegExpMatchArray.
@@ -16,24 +16,24 @@ let t: [number, string] = [42, "hello"]; | |||
let a = t.slice(); | |||
>a : [number, string] | |||
>t.slice() : [number, string] | |||
>t.slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } | |||
>t.slice : { (start?: number, end?: number): [number, string]; (): [number, string]; } | |||
>t : [number, string] |
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.
Wrong, concat and slice methods must not return this
type when it is a tuple type. It cannot avoid.
c74dcb6
to
7ac02c4
Compare
improved. i tried to improve RegExp{Exec,Match}Array too, interface RegExpMatchArray extends Array<string> {
index?: number;
input?: string;
concat(): string[];
slice(start?: 0): string[];
}
interface RegExpExecArray extends Array<string> {
index: number;
input: string;
concat(): string[];
slice(start?: 0): string[];
} but i didn't complete that because it makes 637 errors. i cannot fix such a lot of errors. |
@mhegazy can you review before conflicting again? |
@RyanCavanaugh @ahejlsberg @DanielRosenwasser @sandersn @vladima @zhengbli @weswigham can you review instead of him? |
Fixed by #12784 |
No description provided.