Skip to content

bug(lib): Explicitly stating wrong return type of Promise.then without arguments results in no error #63244

@iluha168

Description

@iluha168

🔎 Search Terms

  • silenced Promise resolution type mismatch
  • Promise generic explicit no error
  • no error when Promise type is specified explicitly
  • generic inside optional argument

🕗 Version & Regression Information

TS v3.3.3 correctly detects the error, which is the earliest Playground version. All other Playground versions silence the error.

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=6.0.0-dev.20260312#code/MYewdgzgLgBFCm0BcMAKAnEBbAlheAPNOjmAOYB8MAvGprvgHTqIgA2AbvABQCMAlIygALeGG78A3EA

💻 Code

const test: Promise<string> = Promise.resolve(1).then();

🙁 Actual behavior

No TypeScript errors.

🙂 Expected behavior

I expected a similar error to what TS v3.3.3 yields:

Type Promise<number> is not assignable to type Promise<string>. Type number is not assignable to type string.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions