@mittwald/api-models 4.60.0 → 4.60.1
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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { provideReact } from "./provideReact.js";
|
|
2
|
+
import { expectType } from "tsd";
|
|
3
|
+
const reactProvided = provideReact(async (ignoredP1, ignoredP2) => Promise.resolve("foo"));
|
|
4
|
+
function ignoredTestReturnTypesOfProvideReact() {
|
|
5
|
+
const usedValue = reactProvided.use("foo");
|
|
6
|
+
const asAsyncResource = reactProvided.asResource("foo");
|
|
7
|
+
expectType(usedValue);
|
|
8
|
+
expectType(asAsyncResource.use());
|
|
9
|
+
}
|
|
10
|
+
function ignoredTestParameterTypesOfProvideReact() {
|
|
11
|
+
reactProvided.use("foo", true);
|
|
12
|
+
reactProvided.asResource("foo", true);
|
|
13
|
+
reactProvided.use("foo");
|
|
14
|
+
reactProvided.asResource("foo");
|
|
15
|
+
// @ts-expect-error Not assignable
|
|
16
|
+
reactProvided.asResource(42);
|
|
17
|
+
// @ts-expect-error Not assignable
|
|
18
|
+
reactProvided.asResource("foo", 42);
|
|
19
|
+
// @ts-expect-error Not assignable
|
|
20
|
+
reactProvided.asResource("foo", true, 42);
|
|
21
|
+
}
|
|
@@ -3,7 +3,7 @@ import { AsyncReturnType } from "type-fest";
|
|
|
3
3
|
type AsyncFn = (...args: any[]) => Promise<unknown>;
|
|
4
4
|
export declare const provideReact: <T extends AsyncFn>(loader: T, dependencies?: string[]) => AsyncResourceVariant<T>;
|
|
5
5
|
export type AsyncResourceVariant<T extends AsyncFn> = T & {
|
|
6
|
-
asResource: (...params: Parameters<T>) => AsyncResource<
|
|
6
|
+
asResource: (...params: Parameters<T>) => AsyncResource<AsyncReturnType<T>>;
|
|
7
7
|
use: (...params: Parameters<T>) => AsyncReturnType<T>;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/api-models",
|
|
3
|
-
"version": "4.60.
|
|
3
|
+
"version": "4.60.1",
|
|
4
4
|
"author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Collection of domain models for coherent interaction with the API",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"context": "^3.0.31",
|
|
45
45
|
"object-code": "^1.3.3",
|
|
46
46
|
"polytype": "^0.17.0",
|
|
47
|
+
"tsd": "^0.31.2",
|
|
47
48
|
"type-fest": "^4.23.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
"optional": true
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "d32887cbcafc42383f2016afc7a03083e630ab42"
|
|
85
86
|
}
|