diff --git a/interop/src/arkts/SerializerBase.ts b/interop/src/arkts/SerializerBase.ts index fba25295ef18251acd322fa36aa2a2619705cf70..033a2bf48a2c53fe96a09fec8015fdbc01c60a05 100644 --- a/interop/src/arkts/SerializerBase.ts +++ b/interop/src/arkts/SerializerBase.ts @@ -79,10 +79,15 @@ export function runtimeType(value: T): int32 { if (value instanceof Function) return RuntimeType.FUNCTION - if (value instanceof Object) - return RuntimeType.OBJECT + // slow workaround for enum + const typeName = typeof value + if (typeName == "number") + return RuntimeType.NUMBER - throw new Error(`bug: ${value} is ${typeof value}`) + if (typeName == "string") + return RuntimeType.STRING + + return RuntimeType.OBJECT } export function toPeerPtr(value: object): pointer {