-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
make Array
explicitly extend ReadonlyArray
and use this
type in the callbacks
#46781
base: main
Are you sure you want to change the base?
Conversation
It looks like you've sent a pull request to update our 'lib' files. These files aren't meant to be edited by hand, as they consist of last-known good states of the compiler and are generated from 'src'. Unless this is necessary, consider closing the pull request and sending a separate PR to update 'src'. |
The TypeScript team hasn't accepted the linked issue #46394. If you can get it accepted, this PR will have a better chance of being reviewed. |
6be1262
to
f009cf6
Compare
i don't think the bot noticed but i've removed the changes to the top level |
Quite a lot of failing tests already 😅 |
dea9f3e
to
f9d062d
Compare
@andrewbranch should be good now |
I get why it’s happening and I guess it technically makes sense, but I feel like the baseline changes look kind of confusing and undesirable. |
Just out of curiosity @typescript-bot perf test this |
Heya @andrewbranch, I've started to run the parallelized Definitely Typed test suite on this PR at f9d062d. You can monitor the build here. |
Heya @andrewbranch, I've started to run the inline community code test suite on this PR at f9d062d. You can monitor the build here. Update: The results are in! |
Heya @andrewbranch, I've started to run the perf test suite on this PR at f9d062d. You can monitor the build here. Update: The results are in! |
@andrewbranch Here they are:Comparison Report - main..refs/pull/46781/merge [adonis-framework]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/adonis-framework/tsconfig.json
[bcryptjs]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/bcryptjs/tsconfig.json
[lodash]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/lodash/tsconfig.json
|
@andrewbranch Here they are:Comparison Report - main..46781
System
Hosts
Scenarios
Developer Information: |
i think i know how to fix the downstream errors, will give it a go |
will the bot listen to me? @typescript-bot perf test this |
@typescript-bot perf test this |
Heya @andrewbranch, I've started to run the inline community code test suite on this PR at acdb72d. You can monitor the build here. Update: The results are in! |
Heya @andrewbranch, I've started to run the parallelized Definitely Typed test suite on this PR at acdb72d. You can monitor the build here. |
Heya @andrewbranch, I've started to run the perf test suite on this PR at acdb72d. You can monitor the build here. Update: The results are in! |
@andrewbranch Here they are:Comparison Report - main..refs/pull/46781/merge [adonis-framework]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/adonis-framework/tsconfig.json
[bcryptjs]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/bcryptjs/tsconfig.json
[lodash]1 of 1 projects failed to build with the old tsc /mnt/ts_downloads/lodash/tsconfig.json
|
@andrewbranch Here they are:Comparison Report - main..46781
System
Hosts
Scenarios
Developer Information: |
so i fixed it by using the i'll make a PR to definitelytyped with this change later today and link it here |
My biggest concern right now is that it might be confusing to some users for the quick info / errors for every common Array method to reference |
i personally don't think that's an issue. most other languages have a base "collection" or "iterable" interface that mutable arrays extend. i'd argue that it's far more confusing now than it would be after this change. currently it's difficult to even tell if currently the only way to find out is by attempting to use an however if you think the name interface BaseArray<T> {
map<U>(callbackfn: (value: T, index: number, array: this) => U, thisArg?: any): U[];
filter<S extends T>(predicate: (value: T, index: number, array: this) => value is S, thisArg?: any): S[];
//...
}
export interface ReadonlyArray<T> extends BaseArray<T> {
//nothing to see here
}
export interface Array<T> extends ReadonlyArray<T> {
push(...items: T[]): number;
//...
} |
Array
explicitly extend ReadonlyArray
Array
explicitly extend ReadonlyArray
and use this
type in the callbacks
@DanielRosenwasser i ran the same command mentioned in that PR with and without my change, and as far as i can tell there doesn't seem to be much of a difference: before:
after:
(disclaimer: my PC is not good and it was difficult to get consistent results) |
Fixes #46394