support int enums in jsValueToZig

This commit is contained in:
Muki Kiboigo
2025-05-22 12:49:13 -07:00
committed by Sjors
parent e7f16f371c
commit 5f4dd43124

View File

@@ -938,6 +938,12 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
}
unreachable;
},
.@"enum" => |e| {
switch (@typeInfo(e.tag_type)) {
.int => return std.meta.intToEnum(T, try jsIntToZig(e.tag_type, js_value, self.context)),
else => @compileError(named_function.full_name ++ " has an unsupported enum parameter type: " ++ @typeName(T)),
}
},
else => {},
}