Skip to content

Commit f3000e9

Browse files
committed
[patch] fix type errors
1 parent 3af9e5e commit f3000e9

7 files changed

+33
-9
lines changed

index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ module.exports = exported || function isSet(x) {
3131
return false;
3232
}
3333
try {
34-
$setHas.call(x);
35-
if ($mapHas) {
36-
try {
37-
$mapHas.call(x);
38-
} catch (e) {
39-
return true;
34+
if ($setHas) {
35+
$setHas.call(x, 0);
36+
if ($mapHas) {
37+
try {
38+
$mapHas.call(x, 0);
39+
} catch (e) {
40+
return true;
41+
}
4042
}
43+
// @ts-expect-error TS can't figure out that $Set is always truthy here
44+
return x instanceof $Set; // core-js workaround, pre-v2.5.0
4145
}
42-
// @ts-expect-error TS can't figure out that $Set is always truthy here
43-
return x instanceof $Set; // core-js workaround, pre-v2.5.0
4446
} catch (e) {}
4547
return false;
4648
};

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
},
7777
"publishConfig": {
7878
"ignore": [
79-
".github/workflows"
79+
".github/workflows",
80+
"types"
8081
]
8182
},
8283
"testling": {

tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "@ljharb/tsconfig",
3+
"compilerOptions": {
4+
"maxNodeModuleJsDepth": 0,
5+
},
36
"exclude": [
47
"coverage",
58
],

types/es-set/implementation.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module 'es-set/implementation' {
2+
export = SetConstructor;
3+
}

types/es-set/index.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module 'es-set' {
2+
const Set: SetConstructor;
3+
4+
export = Set;
5+
}

types/es-set/polyfill.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module 'es-set/polyfill' {
2+
function getPolyfill(): SetConstructor;
3+
4+
export = getPolyfill;
5+
}

types/es-set/shim.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module 'es-set/shim' {
2+
function shim(): SetConstructor;
3+
4+
export = shim;
5+
}

0 commit comments

Comments
 (0)