Skip to content

Better typings for promise.race based on conditional types - #31117

Merged
Ryan Cavanaugh (RyanCavanaugh) merged 1 commit into
microsoft:masterfrom
RyanCavanaugh:dubzzz_port
Apr 30, 2019
Merged

Ryan Cavanaugh (RyanCavanaugh) merged 1 commit into
microsoft:masterfrom
RyanCavanaugh:dubzzz_port

Conversation

@RyanCavanaugh

Copy link
Copy Markdown
Member

Following the feature - Mapped tuple types #25947 - it is now possible to have better typings for Promise.race

From Nicolas DUBIEN (@dubzzz) before I messed up his fork

Following the feature - Mapped tuple types microsoft#25947 - it is now possible to have better typings for Promise.race
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) changed the title Better typings for promise.race based on mapped tuple types Apr 25, 2019
@DanielRosenwasser

Copy link
Copy Markdown
Member

This is thanks to conditional types, not mapped types.

It'd be nice to have a test of some sort (I'm sure we don't). Something simple like

let a = Promise.race([
    Promise.resolve(10),
    Promise.resolve("hello")
]);
@dubzzz

Copy link
Copy Markdown

Daniel Rosenwasser (@DanielRosenwasser) You're right. I think my first commit was really using mapped types but I changed it following reviews 🤔

@RyanCavanaugh

Copy link
Copy Markdown
Member Author
@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 30, 2019 •

Copy link
Copy Markdown
Contributor

Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the extended test suite on this PR at 7ee4e63. You can monitor the build here. It should now contribute to this PR's status checks.

@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) merged commit d102ec0 into microsoft:master Apr 30, 2019
@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) deleted the dubzzz_port branch April 30, 2019 16:23
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 23, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 23, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 23, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 23, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 27, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Aug 29, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Sep 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Sep 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Sep 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Sep 25, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 1, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 2, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 2, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 2, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 2, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 2, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 3, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 4, 2019
Jack Bates (jablko) added a commit to jablko/TypeScript that referenced this pull request Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

5 participants