Microsoft/TypeScript

Don't suggest converting custom promise-like returning function to async ones

Open

#40.701 geöffnet am 22. Sept. 2020

Auf GitHub ansehen
 (4 Kommentare) (1 Reaktion) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
Domain: LS: RefactoringsExperience EnhancementHelp WantedSuggestion

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

Search Terms

async converted function

Suggestion

Do not suggest that a function is converted to async if its return value is explicitly set to something that is not the global Promise type.

Use Cases

If using a package that provides an extended version of promises (for instance cancellable promises) then the transformation is wrong to occur.

Examples

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Contributor Guide