Skip to content

Commit feb5f05

Browse files
bhelxzach
andauthored
update bindgen dependency (#15)
* update bindgen * fix: handle int64 type and untyped objects --------- Co-authored-by: zach <zach@dylibso.com>
1 parent d20fe79 commit feb5f05

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typescript": "^5.3.2"
1818
},
1919
"dependencies": {
20-
"@dylibso/xtp-bindgen": "1.0.0-rc.13",
20+
"@dylibso/xtp-bindgen": "1.0.0-rc.16",
2121
"ejs": "^3.1.10"
2222
}
2323
}

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function toPythonTypeX(type: XtpNormalizedType): string {
3030
return opt('str');
3131
case 'int32':
3232
return opt('int');
33+
case 'int64':
34+
return opt('int');
3335
case 'float':
3436
return opt('float');
3537
case 'double':
@@ -49,11 +51,15 @@ function toPythonTypeX(type: XtpNormalizedType): string {
4951
// TODO: improve typing of dicts
5052
return opt('dict');
5153
case 'object':
52-
return opt(pythonTypeName((type as ObjectType).name));
54+
const name = (type as ObjectType).name;
55+
if (!name) {
56+
return opt('dict');
57+
}
58+
return opt(pythonTypeName(name));
5359
case 'enum':
5460
return opt(pythonTypeName((type as EnumType).name));
5561
default:
56-
throw new Error("Can't convert XTP type to Python type: " + type)
62+
throw new Error("Can't convert XTP type to Python type: " + JSON.stringify(type))
5763
}
5864
}
5965

0 commit comments

Comments
 (0)