diff --git a/cli/tests/node_compat/config.json b/cli/tests/node_compat/config.json index b133fe8b29..2f21e0d464 100644 --- a/cli/tests/node_compat/config.json +++ b/cli/tests/node_compat/config.json @@ -746,7 +746,7 @@ "test-util-isDeepStrictEqual.js", "test-util-promisify.js", "test-util-types-exists.js", - "TODO:test-util-types.js", + "test-util-types.js", "test-util.js", "test-vm-static-this.js", "test-webcrypto-sign-verify.js", diff --git a/ext/node/polyfills/internal_binding/types.ts b/ext/node/polyfills/internal_binding/types.ts index 348d5553fd..6b8b3d6e4a 100644 --- a/ext/node/polyfills/internal_binding/types.ts +++ b/ext/node/polyfills/internal_binding/types.ts @@ -57,12 +57,7 @@ const _getArrayBufferByteLength = Object.getOwnPropertyDescriptor( )!.get!; // https://tc39.es/ecma262/#sec-get-sharedarraybuffer.prototype.bytelength -const _getSharedArrayBufferByteLength = globalThis.SharedArrayBuffer - ? Object.getOwnPropertyDescriptor( - SharedArrayBuffer.prototype, - "byteLength", - )!.get! - : undefined; +let _getSharedArrayBufferByteLength; // https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag const _getTypedArrayToStringTag = Object.getOwnPropertyDescriptor( @@ -285,10 +280,11 @@ export function isSetIterator( export function isSharedArrayBuffer( value: unknown, ): value is SharedArrayBuffer { - // SharedArrayBuffer is not available on this runtime - if (_getSharedArrayBufferByteLength === undefined) { - return false; - } + // TODO(kt3k): add SharedArrayBuffer to primordials + _getSharedArrayBufferByteLength ??= Object.getOwnPropertyDescriptor( + SharedArrayBuffer.prototype, + "byteLength", + )!.get!; try { _getSharedArrayBufferByteLength.call(value);