Skip to content

Commit

Permalink
[patch] fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 3, 2025
1 parent 3af9e5e commit f3000e9
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ module.exports = exported || function isSet(x) {
return false;
}
try {
$setHas.call(x);
if ($mapHas) {
try {
$mapHas.call(x);
} catch (e) {
return true;
if ($setHas) {
$setHas.call(x, 0);
if ($mapHas) {
try {
$mapHas.call(x, 0);
} catch (e) {
return true;
}
}
// @ts-expect-error TS can't figure out that $Set is always truthy here
return x instanceof $Set; // core-js workaround, pre-v2.5.0
}
// @ts-expect-error TS can't figure out that $Set is always truthy here
return x instanceof $Set; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
},
"publishConfig": {
"ignore": [
".github/workflows"
".github/workflows",
"types"
]
},
"testling": {
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"maxNodeModuleJsDepth": 0,
},
"exclude": [
"coverage",
],
Expand Down
3 changes: 3 additions & 0 deletions types/es-set/implementation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'es-set/implementation' {
export = SetConstructor;
}
5 changes: 5 additions & 0 deletions types/es-set/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'es-set' {
const Set: SetConstructor;

export = Set;
}
5 changes: 5 additions & 0 deletions types/es-set/polyfill.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'es-set/polyfill' {
function getPolyfill(): SetConstructor;

export = getPolyfill;
}
5 changes: 5 additions & 0 deletions types/es-set/shim.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'es-set/shim' {
function shim(): SetConstructor;

export = shim;
}

0 comments on commit f3000e9

Please sign in to comment.