@typescript-eslint/eslint-plugin 8.70.1-alpha.7 → 8.70.1-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -63,8 +63,12 @@ exports.default = (0, util_1.createRule)({
|
|
|
63
63
|
type.getCallSignatures().length === 0 &&
|
|
64
64
|
type.getConstructSignatures().length === 0 &&
|
|
65
65
|
// Types still awaiting type arguments, such as `Record<T, unknown>`
|
|
66
|
-
// inside a generic declaration, also have no members yet.
|
|
67
|
-
|
|
66
|
+
// inside a generic declaration, also have no members yet. Every
|
|
67
|
+
// primitive is assignable to `{}`, so probing with more than one of
|
|
68
|
+
// them rules those out: a mapped type whose keys are not resolved yet,
|
|
69
|
+
// such as `{ [K in Keys<T>]: K }`, accepts `number` but not `string`.
|
|
70
|
+
checker.isTypeAssignableTo(checker.getNumberType(), type) &&
|
|
71
|
+
checker.isTypeAssignableTo(checker.getStringType(), type));
|
|
68
72
|
}
|
|
69
73
|
function containsEmptyObjectType(type) {
|
|
70
74
|
return (isEmptyObjectType(type) ||
|
|
@@ -98,7 +98,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
98
98
|
}
|
|
99
99
|
function getMapSpreadSuggestions(node, type) {
|
|
100
100
|
const types = tsutils.unionConstituents(type);
|
|
101
|
-
if (types.some(t => !
|
|
101
|
+
if (types.some(t => !isIterableMap(services.program, t))) {
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
104
|
if (node.parent.type === utils_1.AST_NODE_TYPES.ObjectExpression &&
|
|
@@ -252,6 +252,9 @@ function isClassDeclaration(type) {
|
|
|
252
252
|
function isMap(program, type) {
|
|
253
253
|
return isTypeRecurser(type, t => (0, util_1.isBuiltinSymbolLike)(program, t, ['Map', 'ReadonlyMap', 'WeakMap']));
|
|
254
254
|
}
|
|
255
|
+
function isIterableMap(program, type) {
|
|
256
|
+
return isTypeRecurser(type, t => (0, util_1.isBuiltinSymbolLike)(program, t, ['Map', 'ReadonlyMap']));
|
|
257
|
+
}
|
|
255
258
|
function isTypeRecurser(type, predicate) {
|
|
256
259
|
if (type.isUnionOrIntersection()) {
|
|
257
260
|
return type.types.some(t => isTypeRecurser(t, predicate));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.70.1-alpha.
|
|
3
|
+
"version": "8.70.1-alpha.8",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@eslint-community/regexpp": "^4.12.2",
|
|
50
|
-
"@typescript-eslint/scope-manager": "8.70.1-alpha.
|
|
51
|
-
"@typescript-eslint/type-utils": "8.70.1-alpha.
|
|
52
|
-
"@typescript-eslint/utils": "8.70.1-alpha.
|
|
53
|
-
"@typescript-eslint/visitor-keys": "8.70.1-alpha.
|
|
50
|
+
"@typescript-eslint/scope-manager": "8.70.1-alpha.8",
|
|
51
|
+
"@typescript-eslint/type-utils": "8.70.1-alpha.8",
|
|
52
|
+
"@typescript-eslint/utils": "8.70.1-alpha.8",
|
|
53
|
+
"@typescript-eslint/visitor-keys": "8.70.1-alpha.8",
|
|
54
54
|
"ignore": "^7.0.5",
|
|
55
55
|
"natural-compare": "^1.4.0",
|
|
56
56
|
"ts-api-utils": "^2.5.0"
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@types/mdast": "^4.0.4",
|
|
61
61
|
"@types/natural-compare": "^1.4.3",
|
|
62
62
|
"@types/react": "^18.3.21",
|
|
63
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.70.1-alpha.
|
|
64
|
-
"@typescript-eslint/rule-tester": "8.70.1-alpha.
|
|
63
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.70.1-alpha.8",
|
|
64
|
+
"@typescript-eslint/rule-tester": "8.70.1-alpha.8",
|
|
65
65
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
66
66
|
"@vitest/coverage-v8": "^4.0.18",
|
|
67
67
|
"ajv": "^6.12.6",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"vitest": "^4.0.18"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@typescript-eslint/parser": "^8.70.1-alpha.
|
|
84
|
+
"@typescript-eslint/parser": "^8.70.1-alpha.8",
|
|
85
85
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
|
86
86
|
"typescript": ">=4.8.4 <6.1.0"
|
|
87
87
|
},
|