microsoft / microsoft/TypeScript
bug(lib): Explicitly stating wrong return type of `Promise.then` without arguments results in no error
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- PR merge metrics
- PR metrics pending
Description
### 🔎 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
```ts
const test: Promise = 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` is not assignable to type `Promise`. Type `number` is not assignable to type `string`.
### Additional information about the issue
_No response_
Contributor guide
Research direction
Reproduce the reported example in the linked TypeScript Playground, comparing the current behavior with the TypeScript 3.3.3 result described in the issue. Trace the type-checking path for Promise.then called without arguments; done means the explicit Promise assignment reports the Promise mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100