Skip to content

Commit d6ac405

Browse files
committed
refactor(node:util): safer type checks
1 parent 911a14b commit d6ac405

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/runtime/node/internal/util/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ export const isArgumentsObject = /*@__PURE__*/ notImplemented<
1111
>("util.types.isArgumentsObject");
1212

1313
export const isBigIntObject = (val: any): val is bigint =>
14-
val instanceof BigInt;
14+
typeof val === "bigint";
1515

1616
export const isBooleanObject: typeof nodeUtilTypes.isBooleanObject = (
1717
val,
18-
): val is boolean => val instanceof Boolean;
18+
): val is boolean => typeof val === "boolean";
1919

2020
export const isNumberObject: typeof nodeUtilTypes.isNumberObject = (
2121
val,
22-
): val is number => val instanceof Number;
22+
): val is number => typeof val === "number";
2323

2424
export const isStringObject: typeof nodeUtilTypes.isStringObject = (
2525
val,
26-
): val is string => val instanceof String;
26+
): val is string => typeof val === "string";
2727

2828
export const isSymbolObject: typeof nodeUtilTypes.isSymbolObject = (
2929
val,
30-
): val is symbol => val instanceof Symbol;
30+
): val is symbol => typeof val === "symbol";
3131

3232
export const isNativeError = /*@__PURE__*/ notImplemented<
3333
typeof nodeUtilTypes.isNativeError

0 commit comments

Comments
 (0)