Skip to content

Commit

Permalink
https://github.com/babel/babel/pull/16150
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 30, 2024
1 parent f5ee6d1 commit 8083491
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions crates/swc_ecma_transforms_base/src/helpers/_using.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function _using(stack, value, isAwait) {
if (value === null || value === void 0) return value;
if (typeof value !== "object") {
throw new TypeError(
"using declarations can only be used with objects, null, or undefined."
);
if (Object(value) !== value) {
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
}
// core-js-pure uses Symbol.for for polyfilling well-known symbols
if (isAwait) {
Expand Down
4 changes: 2 additions & 2 deletions packages/helpers/esm/_using.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

export function _using(stack, value, isAwait) {
if (value === null || value === void 0) return value;
if (typeof value !== "object") {
throw new TypeError("using declarations can only be used with objects, null, or undefined.");
if (Object(value) !== value) {
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
}
// core-js-pure uses Symbol.for for polyfilling well-known symbols
if (isAwait) {
Expand Down

0 comments on commit 8083491

Please sign in to comment.