Skip to content

fix(promise-function-async): match promise base types like upstream - #1424

Merged
camc314 merged 1 commit into
mainfrom
fix/promise-function-async-base-type-quantifier
Nov 29, 2026
Merged

camc314 merged 1 commit into
mainfrom
fix/promise-function-async-base-type-quantifier

Conversation

@camc314

@camc314 camc314 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

To decide whether a return type is a promise, the rule also checks the base types of interfaces. The quantifier for base types was reversed. An explicit return type passed if any base was a promise, but an inferred return type needed every base to be one. typescript-eslint does the opposite. So a function annotated with an interface that extends both Promise and another interface was reported. Its fix added async, which TypeScript rejects because the annotation isn't the global Promise type. The same function without an annotation wasn't reported. Unions and intersections already behaved correctly because two inversions cancelled out. They now use the same flag as the base-type check.

interface Tag {
  tag: true;
}
interface TaggedPromise extends Promise<number>, Tag {}
function explicit(p: TaggedPromise): TaggedPromise { // no longer reported
  return p;
}
function inferred(p: TaggedPromise) { // now reported
  return p;
}

@camc314
camc314 marked this pull request as ready for review November 29, 2026 18:09
Copilot AI balanced review requested due to automatic review settings November 29, 2026 18:09
@camc314
camc314 enabled auto-merge (squash) November 29, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T18:10:44.324324Z 920393f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@camc314
camc314 merged commit b28c870 into main Nov 29, 2026
6 of 7 checks passed
@camc314
camc314 deleted the fix/promise-function-async-base-type-quantifier branch November 29, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants