mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 17:05:58 -05:00
Fixed a false positive "await has no effect on the type" diagnostic with mixed generic union (#50833)
This commit is contained in:
committed by
GitHub
parent
1f8959f5dc
commit
85d405a1d7
@@ -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([]);
|
||||
Reference in New Issue
Block a user