Skip to content

Add a type-guard overload of Array.every #38200

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

Merged
merged 2 commits into from
Jun 17, 2020
Merged

Add a type-guard overload of Array.every #38200

merged 2 commits into from
Jun 17, 2020

Conversation

dmitri-gb
Copy link
Contributor

@dmitri-gb dmitri-gb commented Apr 26, 2020

This adds a type-guard aware overload of Array.every.

Fixes #14963.

@msftclas
Copy link

msftclas commented Apr 26, 2020

CLA assistant check
All CLA requirements met.

@ikokostya ikokostya mentioned this pull request May 1, 2020
4 tasks
@sandersn sandersn added the For Backlog Bug PRs that fix a backlog bug label May 5, 2020
@sandersn sandersn self-assigned this May 5, 2020
@keithlayne
Copy link

I've wanted this feature too, but it was pointed out in another issue that Array.prototype.every differs from Array.prototype.filter in that it does not return a new array, and other references mutate the underlying array in an incompatible way.

However, TS has other unsound narrowings, so maybe this should be a pragmatic exception? I'm not sure. Seems easy enough to wrap if you need it in a more sound way.

@RyanCavanaugh
Copy link
Member

Overall LGTM. Can you fix the merge conflict so we can run some user tests?

@sandersn
Copy link
Member

@typescript-bot user test this
@typescript-bot run tests

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 17, 2020

Heya @sandersn, I've started to run the parallelized community code test suite on this PR at b89c084. You can monitor the build here.

@sandersn
Copy link
Member

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 17, 2020

Heya @sandersn, I've started to run the parallelized Definitely Typed test suite on this PR at b89c084. You can monitor the build here.

@sandersn
Copy link
Member

@typescript-bot rwc test this

@sandersn
Copy link
Member

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 17, 2020

Heya @sandersn, I've started to run the extended test suite on this PR at b89c084. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@sandersn
Copy link
Member

User tests are fine -- we caught vs code during a build break, but otherwise there's nothing there.

@RyanCavanaugh RyanCavanaugh merged commit 0bc29ac into microsoft:master Jun 17, 2020
@dmitri-gb dmitri-gb deleted the array-every-type-guard branch June 17, 2020 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Type guards in Array.prototype.every
6 participants