Skip to content

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

Merged
Ryan Cavanaugh (RyanCavanaugh) merged 2 commits into
microsoft:masterfrom
dmitri-gb:array-every-type-guard
Jun 17, 2020
Merged

Ryan Cavanaugh (RyanCavanaugh) merged 2 commits into
microsoft:masterfrom
dmitri-gb:array-every-type-guard

Conversation

@dmitri-gb

@dmitri-gb Dmitri (dmitri-gb) commented Apr 26, 2020 •

Copy link
Copy Markdown
Contributor

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

Fixes #14963.

@msftclas

Microsoft Contribution License Agreements (msftclas) commented Apr 26, 2020 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@ikokostya ikokostya mentioned this pull request May 1, 2020
2 of 4 tasks
@sandersn Nathan Shively-Sanders (sandersn) added the For Backlog Bug PRs that fix a backlog bug label May 5, 2020
@keithlayne

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@sandersn

Copy link
Copy Markdown
Member

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 17, 2020 •

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 17, 2020 •

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
Member

TypeScript Bot (@typescript-bot) rwc test this

@sandersn

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 17, 2020 •

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
Contributor

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
Copy Markdown
Member

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

@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) merged commit 0bc29ac into microsoft:master Jun 17, 2020
@dmitri-gb
Dmitri (dmitri-gb) deleted the array-every-type-guard branch June 17, 2020 20:24
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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