Skip to content

Commit 2d983d5

Browse files
committed
wip
1 parent e3fae49 commit 2d983d5

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

examples/package.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@ async function main() {
2525

2626
const packageable = substrate.createPackageable([a, b], { x, y, z });
2727
// console.log("packageable", JSON.stringify(packageable, null, 2));
28+
29+
30+
// alt.
31+
const mod = substrate.parameterize({
32+
nodes: [a, b],
33+
inputs: { x, y, z },
34+
});
35+
36+
const p = new Module(
37+
{
38+
module_json: mod.toJSON(),
39+
inputs: {
40+
x: "xxx",
41+
y: "yyy",
42+
z: {
43+
string: "hi",
44+
obj: { a: 123 },
45+
arr: ["123"],
46+
},
47+
},
48+
}
49+
);
2850

2951
// using the package node.
3052
const p = new Package(

examples/types.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env -S npx ts-node --transpileOnly
2+
3+
4+
class Foo<F extends (...args: any[]) => any> {
5+
f: F;
6+
7+
constructor(f: F) {
8+
this.f = f;
9+
}
10+
11+
run(...args: Parameters<F>): ReturnType<F> {
12+
return this.f(...args);
13+
}
14+
}
15+
16+
// (a: number, b: number) => number
17+
const add = (a: number, b: number) => a + b;
18+
19+
const foo = new Foo(add);
20+
// run(a: number, b: number): ReturnType<(a: number, b: number) => number>
21+
const res = foo.run(1, 2);

src/Package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Packageable {
5252
return {
5353
dag,
5454
inputs: inputNameToSchema,
55-
apiVersion: this.apiVersion,
55+
api_version: this.apiVersion,
5656
};
5757
}
5858
}

0 commit comments

Comments
 (0)