Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / ansi-escapes / node_modules / type-fest / source / promise-value.d.ts
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/ansi-escapes/node_modules/type-fest/source/promise-value.d.ts b/.config/coc/extensions/node_modules/coc-prettier/node_modules/ansi-escapes/node_modules/type-fest/source/promise-value.d.ts
new file mode 100644 (file)
index 0000000..7686dd1
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+Returns the type that is wrapped inside a `Promise` type.
+If the type is not a `Promise`, the type itself is returned.
+
+@example
+```
+import {PromiseValue} from 'type-fest';
+
+type AsyncData = Promise<string>;
+let asyncData: PromiseValue<AsyncData> = Promise.resolve('ABC');
+
+type Data = PromiseValue<AsyncData>;
+let data: Data = await asyncData;
+
+// Here's an example that shows how this type reacts to non-Promise types.
+type SyncData = PromiseValue<string>;
+let syncData: SyncData = getSyncData();
+```
+*/
+export type PromiseValue<PromiseType, Otherwise = PromiseType> = PromiseType extends Promise<infer Value> ? Value : Otherwise;