microsoft / microsoft/TypeScript
The Promise constructor cannot handle void returns on resolve
@rbuckton ci sta già lavorando.
Dal 23/7/2021.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Configuration Check
My compilation target is es5 and my lib is dom, es5, es2015.promise and es2015.iterable.
Missing / Incorrect Definition
The value for the resolve callback in the Promise constructor is required:
new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
Sample Code
Using void as the generic (return) type for a Promise results in an error:

Workaround
The current workaround is to return undefined:

But undefined is not the same as void: https://www.typescriptlang.org/docs/handbook/2/functions.html#void
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.