Skip to content
Permalink
Browse files
Fixed a false positive "await has no effect on the type" diagnostic w…
…ith mixed generic union (#50833)
  • Loading branch information
Andarist committed Oct 18, 2022
1 parent 1f8959f commit 85d405a1d74c0730a9d8d6307b26e8d6f3f75421
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
@@ -37104,7 +37104,7 @@ namespace ts {
// We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
// or is promise-like.
if (baseConstraint ?
baseConstraint.flags & TypeFlags.AnyOrUnknown || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
baseConstraint.flags & TypeFlags.AnyOrUnknown || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
maybeTypeOfKind(type, TypeFlags.TypeVariable)) {
return true;
}
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts" />

// @target: esnext
//// async function fn1(a: Promise<void> | void) {
//// await a;
//// }
////
//// async function fn2<T extends Promise<void> | void>(a: T) {
//// await a;
//// }

verify.getSuggestionDiagnostics([]);

0 comments on commit 85d405a

Please sign in to comment.