Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"typescript": "^5.3.2"
},
"dependencies": {
"@dylibso/xtp-bindgen": "1.0.0-rc.13",
"@dylibso/xtp-bindgen": "1.0.0-rc.16",
"ejs": "^3.1.10"
}
}
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function toPythonTypeX(type: XtpNormalizedType): string {
return opt('str');
case 'int32':
return opt('int');
case 'int64':
return opt('int');
case 'float':
return opt('float');
case 'double':
Expand All @@ -49,11 +51,15 @@ function toPythonTypeX(type: XtpNormalizedType): string {
// TODO: improve typing of dicts
return opt('dict');
case 'object':
return opt(pythonTypeName((type as ObjectType).name));
const name = (type as ObjectType).name;
if (!name) {
return opt('dict');
}
return opt(pythonTypeName(name));
case 'enum':
return opt(pythonTypeName((type as EnumType).name));
default:
throw new Error("Can't convert XTP type to Python type: " + type)
throw new Error("Can't convert XTP type to Python type: " + JSON.stringify(type))
}
}

Expand Down