From d41f6f28103d73ed1e9fd2db8a1faad1e93a752c Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 3 Dec 2024 14:51:21 -0800 Subject: [PATCH] fix: handle int64 type and untyped objects --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c7e0ef8..fb0ede5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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': @@ -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)) } }