@@ -1865,6 +1865,9 @@ pub const JSValue = enum(u64) {
18651865 }
18661866
18671867 pub fn as (value : JSValue , comptime ZigType : type ) ? * ZigType {
1868+ if (value .isUndefinedOrNull ())
1869+ return null ;
1870+
18681871 return JSC .GetJSPrivateData (ZigType , value .asObjectRef ());
18691872 }
18701873
@@ -1977,13 +1980,16 @@ pub const JSValue = enum(u64) {
19771980 }
19781981
19791982 pub fn isUndefined (this : JSValue ) bool {
1980- return cppFn ( "isUndefined" , .{ this }) ;
1983+ return @enumToInt ( this ) == 0xa ;
19811984 }
19821985 pub fn isNull (this : JSValue ) bool {
1983- return cppFn ( "isNull" , .{ this }) ;
1986+ return @enumToInt ( this ) == 0x2 ;
19841987 }
19851988 pub fn isUndefinedOrNull (this : JSValue ) bool {
1986- return cppFn ("isUndefinedOrNull" , .{this });
1989+ return switch (@enumToInt (this )) {
1990+ 0xa , 0x2 = > true ,
1991+ else = > false ,
1992+ };
19871993 }
19881994 pub fn isBoolean (this : JSValue ) bool {
19891995 return cppFn ("isBoolean" , .{this });
@@ -2285,7 +2291,7 @@ pub const JSValue = enum(u64) {
22852291 return @intToPtr (* anyopaque , @enumToInt (this ));
22862292 }
22872293
2288- pub const Extern = [_][]const u8{ "parseJSON", "symbolKeyFor", "symbolFor", "getSymbolDescription", "createInternalPromise", "asInternalPromise", "asArrayBuffer_", "getReadableStreamState", "getWritableStreamState", "fromEntries", "createTypeError", "createRangeError", "createObject2", "getIfPropertyExistsImpl", "jsType", "jsonStringify", "kind_", "isTerminationException", "isSameValue", "getLengthOfArray", "toZigString", "createStringArray", "createEmptyObject", "putRecord", "asPromise", "isClass", "getNameProperty", "getClassName", "getErrorsProperty", "toInt32", "toBoolean", "isInt32", "isIterable", "forEach", "isAggregateError", "toZigException", "isException", "toWTFString", "hasProperty", "getPropertyNames", "getDirect", "putDirect", "getIfExists", "asString", "asObject", "asNumber", "isError", "jsNull", "jsUndefined", "jsTDZValue", "jsBoolean", "jsDoubleNumber", "jsNumberFromDouble", "jsNumberFromChar", "jsNumberFromU16", "jsNumberFromInt32", "jsNumberFromInt64", "jsNumberFromUint64", "isUndefined", "isNull", "isUndefinedOrNull", "isBoolean", "isAnyInt", "isUInt32AsAnyInt", "isInt32AsAnyInt", "isNumber", "isString", "isBigInt", "isHeapBigInt", "isBigInt32", "isSymbol", "isPrimitive", "isGetterSetter", "isCustomGetterSetter", "isObject", "isCell", "asCell", "toString", "toStringOrNull", "toPropertyKey", "toPropertyKeyValue", "toObject", "toString", "getPrototype", "getPropertyByPropertyName", "eqlValue", "eqlCell", "isCallable" };
2294+ pub const Extern = [_][]const u8{ "parseJSON", "symbolKeyFor", "symbolFor", "getSymbolDescription", "createInternalPromise", "asInternalPromise", "asArrayBuffer_", "getReadableStreamState", "getWritableStreamState", "fromEntries", "createTypeError", "createRangeError", "createObject2", "getIfPropertyExistsImpl", "jsType", "jsonStringify", "kind_", "isTerminationException", "isSameValue", "getLengthOfArray", "toZigString", "createStringArray", "createEmptyObject", "putRecord", "asPromise", "isClass", "getNameProperty", "getClassName", "getErrorsProperty", "toInt32", "toBoolean", "isInt32", "isIterable", "forEach", "isAggregateError", "toZigException", "isException", "toWTFString", "hasProperty", "getPropertyNames", "getDirect", "putDirect", "getIfExists", "asString", "asObject", "asNumber", "isError", "jsNull", "jsUndefined", "jsTDZValue", "jsBoolean", "jsDoubleNumber", "jsNumberFromDouble", "jsNumberFromChar", "jsNumberFromU16", "jsNumberFromInt32", "jsNumberFromInt64", "jsNumberFromUint64", "isBoolean", "isAnyInt", "isUInt32AsAnyInt", "isInt32AsAnyInt", "isNumber", "isString", "isBigInt", "isHeapBigInt", "isBigInt32", "isSymbol", "isPrimitive", "isGetterSetter", "isCustomGetterSetter", "isObject", "isCell", "asCell", "toString", "toStringOrNull", "toPropertyKey", "toPropertyKeyValue", "toObject", "toString", "getPrototype", "getPropertyByPropertyName", "eqlValue", "eqlCell", "isCallable" };
22892295};
22902296
22912297extern "c" fn Microtask__run (* Microtask , * JSGlobalObject ) void ;
0 commit comments