Skip to content

PromiseRejectedResut reason should be unknown #63243

@karlismelderis-mckinsey

Description

⚙ Compilation target

es2024

⚙ Library

es2020.promise

Missing / Incorrect Definition

I'm getting this from es2020 lib:

interface PromiseRejectedResult {
    status: "rejected";
    reason: any;
}

while unknown would be better fit

interface PromiseRejectedResult {
    status: "rejected";
    reason: unknown;
}

Sample Code

when I'm working with reason from rejected eslint `@typescript-eslint/no-unsafe-assignment` correctly flags that I'm working with `any`


if (result.status === 'fulfilled') {
  return result.value;
}
// this is flagged by eslint 
const { reason } = result;

Documentation Link

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions