@flint.fyi/ts 0.18.0 → 0.18.1
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.
|
@@ -7,7 +7,7 @@ import * as ts$1 from "typescript";
|
|
|
7
7
|
import * as tsutils from "ts-api-utils";
|
|
8
8
|
//#region src/rules/anyAssignments.ts
|
|
9
9
|
function isTypeAny(type) {
|
|
10
|
-
return tsutils.isTypeFlagSet(type, ts$1.TypeFlags.Any);
|
|
10
|
+
return tsutils.isTypeFlagSet(type, ts$1.TypeFlags.Any) && !tsutils.isIntrinsicErrorType(type);
|
|
11
11
|
}
|
|
12
12
|
function isTypeAnyArray(type, checker) {
|
|
13
13
|
if (!checker.isArrayType(type)) return false;
|
|
@@ -99,11 +99,11 @@ var anyAssignments_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
99
99
|
if (element.dotDotDotToken) continue;
|
|
100
100
|
let key;
|
|
101
101
|
const propertyName = element.propertyName ?? element.name;
|
|
102
|
-
if (ts$1.isIdentifier(propertyName)) key = propertyName.text;
|
|
103
|
-
else if (ts$1.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
if (ts$1.isIdentifier(propertyName) || ts$1.isStringLiteral(propertyName) || ts$1.isNumericLiteral(propertyName)) key = propertyName.text;
|
|
103
|
+
else if (ts$1.isComputedPropertyName(propertyName)) {
|
|
104
|
+
const expression = propertyName.expression;
|
|
105
|
+
if (ts$1.isStringLiteral(expression) || ts$1.isNoSubstitutionTemplateLiteral(expression)) key = expression.text;
|
|
106
|
+
}
|
|
107
107
|
if (key === void 0) continue;
|
|
108
108
|
const propertySymbol = senderType.getProperty(key);
|
|
109
109
|
if (!propertySymbol) continue;
|
|
@@ -131,6 +131,7 @@ var anyAssignments_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
131
131
|
return checkObjectDestructureWorker(pattern, senderType, sourceFile, typeChecker);
|
|
132
132
|
}
|
|
133
133
|
function checkAssignment(initializerType, declaredType, initializer, reportNode, sourceFile, typeChecker) {
|
|
134
|
+
if (tsutils.isIntrinsicErrorType(initializerType)) return false;
|
|
134
135
|
const anyType = discriminateAnyType(initializerType, typeChecker, initializer);
|
|
135
136
|
if (declaredType === void 0) {
|
|
136
137
|
if (anyType !== AnyType.Safe) {
|
|
@@ -206,9 +207,7 @@ var anyAssignments_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
206
207
|
const contextualType = typeChecker.getContextualType(node.parent);
|
|
207
208
|
if (!contextualType) return;
|
|
208
209
|
let key;
|
|
209
|
-
if (ts$1.isIdentifier(node.name)) key = node.name.text;
|
|
210
|
-
else if (ts$1.isStringLiteral(node.name)) key = node.name.text;
|
|
211
|
-
else if (ts$1.isNumericLiteral(node.name)) key = node.name.text;
|
|
210
|
+
if (ts$1.isIdentifier(node.name) || ts$1.isStringLiteral(node.name) || ts$1.isNumericLiteral(node.name)) key = node.name.text;
|
|
212
211
|
if (key === void 0) return;
|
|
213
212
|
const propertySymbol = contextualType.getProperty(key);
|
|
214
213
|
if (!propertySymbol) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/ts",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "[Experimental] TypeScript language plugin for Flint.",
|
|
5
5
|
"homepage": "https://www.flint.fyi/rules/ts",
|
|
6
6
|
"repository": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"ts-api-utils": "^2.4.0",
|
|
30
30
|
"typescript": "^5.9.3 || ^6.0.0",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@flint.fyi/
|
|
32
|
+
"@flint.fyi/typescript-language": "^0.18.1",
|
|
33
33
|
"@flint.fyi/utils": "^0.14.1",
|
|
34
|
-
"@flint.fyi/
|
|
34
|
+
"@flint.fyi/core": "^0.21.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"tsdown": "0.21.0",
|