From: Eduardo San Martin Morote Date: Sun, 30 Jan 2022 09:05:41 +0000 (+0100) Subject: fix(types): custom Awaited for TS 4.x X-Git-Tag: pinia@2.0.11~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fcb62e6fc77e273daf5396d68a9b17126d3ea35;p=thirdparty%2Fvuejs%2Fpinia.git fix(types): custom Awaited for TS 4.x Fix #1006 --- diff --git a/packages/pinia/src/types.ts b/packages/pinia/src/types.ts index 20a0c532..0f8c8c85 100644 --- a/packages/pinia/src/types.ts +++ b/packages/pinia/src/types.ts @@ -165,7 +165,7 @@ type _Awaited = T extends null | undefined ? T // special case for `null | undefined` when not in `--strictNullChecks` mode : T extends object & { then(onfulfilled: infer F): any } // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped ? F extends (value: infer V, ...args: any) => any // if the argument to `then` is callable, extracts the first argument - ? Awaited // recursively unwrap the value + ? _Awaited // recursively unwrap the value : never // the argument to `then` was not callable : T // non-object or non-thenable