@galacean/engine-core 1.4.13 → 1.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "1.4.13"
21
+ "@galacean/engine-math": "1.4.15"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "1.4.13"
24
+ "@galacean/engine-design": "1.4.15"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -3,12 +3,36 @@
3
3
  */
4
4
  export declare class AssetPromise<T> implements PromiseLike<T> {
5
5
  /**
6
- * Return a new resource Promise through the provided asset promise collection.
7
- * The resolved of the new AssetPromise will be triggered when all the Promises in the provided set are completed.
8
- * @param - Promise Collection
9
- * @returns AssetPromise
6
+ * Creates a new resolved AssetPromise.
7
+ * @returns A resolved AssetPromise.
8
+ */
9
+ static resolve(): AssetPromise<void>;
10
+ /**
11
+ * Creates a new resolved AssetPromise fork the provided value.
12
+ * @param value - A value
13
+ * @returns A AssetPromise whose internal state matches the provided promise.
14
+ */
15
+ static resolve<T>(value: T): AssetPromise<Awaited<T>>;
16
+ /**
17
+ * Creates a new resolved AssetPromise for the provided value.
18
+ * @param value - A PromiseLike
19
+ * @returns A AssetPromise whose internal state matches the provided promise.
20
+ */
21
+ static resolve<T>(value: PromiseLike<T>): AssetPromise<Awaited<T>>;
22
+ /**
23
+ * Creates a AssetPromise that is resolved with an array of results when all of the provided PromiseLike resolve, or rejected when any PromiseLike is rejected.
24
+ * @param values An array of PromiseLikes
25
+ * @returns A new AssetPromise.
26
+ */
27
+ static all<T extends [] | unknown[]>(values: T extends [] ? [...T] : readonly [...T]): AssetPromise<{
28
+ [K in keyof T]: UnwrapPromise<T[K]>;
29
+ }>;
30
+ /**
31
+ * Creates a AssetPromise that is resolved with an array of results when all of the provided PromiseLikes resolve, or rejected when any PromiseLikes is rejected.
32
+ * @param values An iterable of PromiseLikes
33
+ * @returns A new AssetPromise.
10
34
  */
11
- static all<T = any>(promises: (PromiseLike<T> | T)[]): AssetPromise<T[]>;
35
+ static all<T>(values: Iterable<T | PromiseLike<T>>): AssetPromise<Awaited<T>[]>;
12
36
  /** compatible with Promise */
13
37
  get [Symbol.toStringTag](): string;
14
38
  private _promise;
@@ -59,4 +83,5 @@ interface AssetPromiseExecutor<T> {
59
83
  }
60
84
  type TaskCompleteCallback = (loaded: number, total: number) => void;
61
85
  type TaskDetailCallback = (url: string, loaded: number, total: number) => void;
86
+ type UnwrapPromise<T> = T extends PromiseLike<infer U> ? U : T;
62
87
  export {};