# no-useless-promise-resolve

Disallow Promise.resolve calls that preserve the same Promise

`Promise.resolve` returns its argument unchanged when that argument is already a Promise.
Instead, you SHOULD use the existing Promise directly.

- Category: suspicious
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
import { Promise } from "destack:async";

function retain(value: Promise<int32>): Promise<int32> {
    return Promise.resolve(value);
}
```

## Accepted

```ds title="main.ds"
import { Promise } from "destack:async";

function retain(value: Promise<int32>): Promise<int32> {
    return value;
}
```

## Prior art

- [eslint-plugin-unicorn · no-useless-promise-resolve-reject](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md)

[language/linter/src/rules/suspicious/no_useless_promise_resolve.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/suspicious/no_useless_promise_resolve.rs#L8)
