@typescript-eslint/type-utils 5.53.1-alpha.8 → 6.0.0-alpha.58
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.
- package/{_ts3.4 → _ts4.2}/dist/containsAllTypesByName.d.ts +0 -0
- package/_ts4.2/dist/getConstrainedTypeAtLocation.d.ts +7 -0
- package/{_ts3.4 → _ts4.2}/dist/getContextualType.d.ts +0 -0
- package/_ts4.2/dist/getDeclaration.d.ts +7 -0
- package/{_ts3.4 → _ts4.2}/dist/getSourceFileOfNode.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/getTokenAtPosition.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/getTypeArguments.d.ts +1 -1
- package/{_ts3.4 → _ts4.2}/dist/getTypeName.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/index.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/isTypeReadonly.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/isUnsafeAssignment.d.ts +2 -2
- package/{_ts3.4 → _ts4.2}/dist/predicates.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/propertyTypes.d.ts +1 -1
- package/{_ts3.4 → _ts4.2}/dist/requiresQuoting.d.ts +0 -0
- package/{_ts3.4 → _ts4.2}/dist/typeFlagUtils.d.ts +0 -0
- package/dist/containsAllTypesByName.js +3 -3
- package/dist/containsAllTypesByName.js.map +1 -1
- package/dist/getConstrainedTypeAtLocation.d.ts +2 -1
- package/dist/getConstrainedTypeAtLocation.d.ts.map +1 -1
- package/dist/getConstrainedTypeAtLocation.js +6 -4
- package/dist/getConstrainedTypeAtLocation.js.map +1 -1
- package/dist/getContextualType.d.ts.map +1 -1
- package/dist/getContextualType.js +7 -8
- package/dist/getContextualType.js.map +1 -1
- package/dist/getDeclaration.d.ts +2 -1
- package/dist/getDeclaration.d.ts.map +1 -1
- package/dist/getDeclaration.js +3 -4
- package/dist/getDeclaration.js.map +1 -1
- package/dist/getTypeArguments.js +1 -2
- package/dist/getTypeArguments.js.map +1 -1
- package/dist/getTypeName.js +2 -2
- package/dist/getTypeName.js.map +1 -1
- package/dist/isTypeReadonly.d.ts.map +1 -1
- package/dist/isTypeReadonly.js +12 -11
- package/dist/isTypeReadonly.js.map +1 -1
- package/dist/isUnsafeAssignment.js +28 -6
- package/dist/isUnsafeAssignment.js.map +1 -1
- package/dist/predicates.js +2 -2
- package/dist/predicates.js.map +1 -1
- package/dist/typeFlagUtils.js +2 -2
- package/dist/typeFlagUtils.js.map +1 -1
- package/package.json +13 -13
- package/_ts3.4/dist/getConstrainedTypeAtLocation.d.ts +0 -6
- package/_ts3.4/dist/getDeclaration.d.ts +0 -6
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
+
import type * as ts from 'typescript';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getConstrainedTypeAtLocation(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Type;
|
|
7
|
+
//# sourceMappingURL=getConstrainedTypeAtLocation.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
+
import type * as ts from 'typescript';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the declaration for the given variable
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDeclaration(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Declaration | null;
|
|
7
|
+
//# sourceMappingURL=getDeclaration.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import type * as ts from 'typescript';
|
|
3
3
|
/**
|
|
4
4
|
* Does a simple check to see if there is an any being assigned to a non-any type.
|
|
5
5
|
*
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
2
|
export declare function getTypeOfPropertyOfName(checker: ts.TypeChecker, type: ts.Type, name: string, escapedName?: ts.__String): ts.Type | undefined;
|
|
3
3
|
export declare function getTypeOfPropertyOfType(checker: ts.TypeChecker, type: ts.Type, property: ts.Symbol): ts.Type | undefined;
|
|
4
4
|
//# sourceMappingURL=propertyTypes.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.containsAllTypesByName = void 0;
|
|
27
|
-
const
|
|
27
|
+
const tools = __importStar(require("ts-api-utils"));
|
|
28
28
|
const ts = __importStar(require("typescript"));
|
|
29
29
|
const typeFlagUtils_1 = require("./typeFlagUtils");
|
|
30
30
|
/**
|
|
@@ -38,7 +38,7 @@ function containsAllTypesByName(type, allowAny, allowedNames, matchAnyInstead =
|
|
|
38
38
|
if ((0, typeFlagUtils_1.isTypeFlagSet)(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown)) {
|
|
39
39
|
return !allowAny;
|
|
40
40
|
}
|
|
41
|
-
if (
|
|
41
|
+
if (tools.isTypeReference(type)) {
|
|
42
42
|
type = type.target;
|
|
43
43
|
}
|
|
44
44
|
const symbol = type.getSymbol();
|
|
@@ -46,7 +46,7 @@ function containsAllTypesByName(type, allowAny, allowedNames, matchAnyInstead =
|
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
48
|
const predicate = (t) => containsAllTypesByName(t, allowAny, allowedNames, matchAnyInstead);
|
|
49
|
-
if (
|
|
49
|
+
if (tools.isUnionOrIntersectionType(type)) {
|
|
50
50
|
return matchAnyInstead
|
|
51
51
|
? type.types.some(predicate)
|
|
52
52
|
: type.types.every(predicate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containsAllTypesByName.js","sourceRoot":"","sources":["../src/containsAllTypesByName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"containsAllTypesByName.js","sourceRoot":"","sources":["../src/containsAllTypesByName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,+CAAiC;AAEjC,mDAAgD;AAEhD;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,IAAa,EACb,QAAiB,EACjB,YAAyB,EACzB,eAAe,GAAG,KAAK;IAEvB,IAAI,IAAA,6BAAa,EAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QAChE,OAAO,CAAC,QAAQ,CAAC;KAClB;IAED,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QAC/B,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;KACpB;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,IAAI,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,CAAC,CAAU,EAAW,EAAE,CACxC,sBAAsB,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;IAErE,IAAI,KAAK,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE;QACzC,OAAO,eAAe;YACpB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;YAC5B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KACjC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAElC,OAAO,CACL,OAAO,KAAK,KAAK,WAAW;QAC5B,CAAC,eAAe;YACd,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;YACvB,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC;AApCD,wDAoCC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/typescript-estree';
|
|
1
2
|
import type * as ts from 'typescript';
|
|
2
3
|
/**
|
|
3
4
|
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
|
|
4
5
|
*/
|
|
5
|
-
export declare function getConstrainedTypeAtLocation(
|
|
6
|
+
export declare function getConstrainedTypeAtLocation(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Type;
|
|
6
7
|
//# sourceMappingURL=getConstrainedTypeAtLocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConstrainedTypeAtLocation.d.ts","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,
|
|
1
|
+
{"version":3,"file":"getConstrainedTypeAtLocation.d.ts","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,iCAAiC,EAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI,GAClB,EAAE,CAAC,IAAI,CAOT"}
|
|
@@ -4,10 +4,12 @@ exports.getConstrainedTypeAtLocation = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
|
|
6
6
|
*/
|
|
7
|
-
function getConstrainedTypeAtLocation(
|
|
8
|
-
const nodeType =
|
|
9
|
-
const constrained =
|
|
10
|
-
|
|
7
|
+
function getConstrainedTypeAtLocation(services, node) {
|
|
8
|
+
const nodeType = services.getTypeAtLocation(node);
|
|
9
|
+
const constrained = services.program
|
|
10
|
+
.getTypeChecker()
|
|
11
|
+
.getBaseConstraintOfType(nodeType);
|
|
12
|
+
return constrained ?? nodeType;
|
|
11
13
|
}
|
|
12
14
|
exports.getConstrainedTypeAtLocation = getConstrainedTypeAtLocation;
|
|
13
15
|
//# sourceMappingURL=getConstrainedTypeAtLocation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConstrainedTypeAtLocation.js","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getConstrainedTypeAtLocation.js","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,QAA2C,EAC3C,IAAmB;IAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO;SACjC,cAAc,EAAE;SAChB,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAErC,OAAO,WAAW,IAAI,QAAQ,CAAC;AACjC,CAAC;AAVD,oEAUC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContextualType.d.ts","sourceRoot":"","sources":["../src/getContextualType.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getContextualType.d.ts","sourceRoot":"","sources":["../src/getContextualType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,UAAU,GAClB,EAAE,CAAC,IAAI,GAAG,SAAS,CAuCrB"}
|
|
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getContextualType = void 0;
|
|
27
|
-
const tsutils_1 = require("tsutils");
|
|
28
27
|
const ts = __importStar(require("typescript"));
|
|
29
28
|
/**
|
|
30
29
|
* Returns the contextual type of a given node.
|
|
@@ -36,24 +35,24 @@ function getContextualType(checker, node) {
|
|
|
36
35
|
if (!parent) {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
|
-
if (
|
|
38
|
+
if (ts.isCallExpression(parent) || ts.isNewExpression(parent)) {
|
|
40
39
|
if (node === parent.expression) {
|
|
41
40
|
// is the callee, so has no contextual type
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
else if (
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
else if (ts.isVariableDeclaration(parent) ||
|
|
45
|
+
ts.isPropertyDeclaration(parent) ||
|
|
46
|
+
ts.isParameter(parent)) {
|
|
48
47
|
return parent.type ? checker.getTypeFromTypeNode(parent.type) : undefined;
|
|
49
48
|
}
|
|
50
|
-
else if (
|
|
49
|
+
else if (ts.isJsxExpression(parent)) {
|
|
51
50
|
return checker.getContextualType(parent);
|
|
52
51
|
}
|
|
53
|
-
else if (
|
|
52
|
+
else if (ts.isPropertyAssignment(parent) && ts.isIdentifier(node)) {
|
|
54
53
|
return checker.getContextualType(node);
|
|
55
54
|
}
|
|
56
|
-
else if (
|
|
55
|
+
else if (ts.isBinaryExpression(parent) &&
|
|
57
56
|
parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
58
57
|
parent.right === node) {
|
|
59
58
|
// is RHS of assignment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContextualType.js","sourceRoot":"","sources":["../src/getContextualType.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"getContextualType.js","sourceRoot":"","sources":["../src/getContextualType.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,OAAuB,EACvB,IAAmB;IAEnB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,IAAI,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE;QAC7D,IAAI,IAAI,KAAK,MAAM,CAAC,UAAU,EAAE;YAC9B,2CAA2C;YAC3C,OAAO;SACR;KACF;SAAM,IACL,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;QAChC,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC;QAChC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EACtB;QACA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KAC3E;SAAM,IAAI,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;KAC1C;SAAM,IAAI,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACnE,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KACxC;SAAM,IACL,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC7B,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW;QACvD,MAAM,CAAC,KAAK,KAAK,IAAI,EACrB;QACA,uBAAuB;QACvB,OAAO,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC/C;SAAM,IACL,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,QAAQ,CACjE,MAAM,CAAC,IAAI,CACZ,EACD;QACA,oEAAoE;QACpE,OAAO;KACR;IACD,2CAA2C;IAE3C,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AA1CD,8CA0CC"}
|
package/dist/getDeclaration.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/typescript-estree';
|
|
1
2
|
import type * as ts from 'typescript';
|
|
2
3
|
/**
|
|
3
4
|
* Gets the declaration for the given variable
|
|
4
5
|
*/
|
|
5
|
-
export declare function getDeclaration(
|
|
6
|
+
export declare function getDeclaration(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Declaration | null;
|
|
6
7
|
//# sourceMappingURL=getDeclaration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDeclaration.d.ts","sourceRoot":"","sources":["../src/getDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,cAAc,CAC5B,
|
|
1
|
+
{"version":3,"file":"getDeclaration.d.ts","sourceRoot":"","sources":["../src/getDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,iCAAiC,EAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI,GAClB,EAAE,CAAC,WAAW,GAAG,IAAI,CAOvB"}
|
package/dist/getDeclaration.js
CHANGED
|
@@ -4,14 +4,13 @@ exports.getDeclaration = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Gets the declaration for the given variable
|
|
6
6
|
*/
|
|
7
|
-
function getDeclaration(
|
|
8
|
-
|
|
9
|
-
const symbol = checker.getSymbolAtLocation(node);
|
|
7
|
+
function getDeclaration(services, node) {
|
|
8
|
+
const symbol = services.getSymbolAtLocation(node);
|
|
10
9
|
if (!symbol) {
|
|
11
10
|
return null;
|
|
12
11
|
}
|
|
13
12
|
const declarations = symbol.getDeclarations();
|
|
14
|
-
return
|
|
13
|
+
return declarations?.[0] ?? null;
|
|
15
14
|
}
|
|
16
15
|
exports.getDeclaration = getDeclaration;
|
|
17
16
|
//# sourceMappingURL=getDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDeclaration.js","sourceRoot":"","sources":["../src/getDeclaration.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getDeclaration.js","sourceRoot":"","sources":["../src/getDeclaration.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,SAAgB,cAAc,CAC5B,QAA2C,EAC3C,IAAmB;IAEnB,MAAM,MAAM,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC9C,OAAO,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACnC,CAAC;AAVD,wCAUC"}
|
package/dist/getTypeArguments.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTypeArguments = void 0;
|
|
4
4
|
function getTypeArguments(type, checker) {
|
|
5
|
-
var _a;
|
|
6
5
|
// getTypeArguments was only added in TS3.7
|
|
7
6
|
if (checker.getTypeArguments) {
|
|
8
7
|
return checker.getTypeArguments(type);
|
|
9
8
|
}
|
|
10
|
-
return
|
|
9
|
+
return type.typeArguments ?? [];
|
|
11
10
|
}
|
|
12
11
|
exports.getTypeArguments = getTypeArguments;
|
|
13
12
|
//# sourceMappingURL=getTypeArguments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypeArguments.js","sourceRoot":"","sources":["../src/getTypeArguments.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAC9B,IAAsB,EACtB,OAAuB
|
|
1
|
+
{"version":3,"file":"getTypeArguments.js","sourceRoot":"","sources":["../src/getTypeArguments.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAC9B,IAAsB,EACtB,OAAuB;IAEvB,2CAA2C;IAC3C,IAAI,OAAO,CAAC,gBAAgB,EAAE;QAC5B,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;KACvC;IAED,OAAO,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;AAClC,CAAC;AAVD,4CAUC"}
|
package/dist/getTypeName.js
CHANGED
|
@@ -43,8 +43,8 @@ function getTypeName(typeChecker, type) {
|
|
|
43
43
|
// the type parameter for some reason. So this gets the constraint type
|
|
44
44
|
// via AST.
|
|
45
45
|
const symbol = type.getSymbol();
|
|
46
|
-
const decls = symbol
|
|
47
|
-
const typeParamDecl = decls
|
|
46
|
+
const decls = symbol?.getDeclarations();
|
|
47
|
+
const typeParamDecl = decls?.[0];
|
|
48
48
|
if (ts.isTypeParameterDeclaration(typeParamDecl) &&
|
|
49
49
|
typeParamDecl.constraint != null) {
|
|
50
50
|
return getTypeName(typeChecker, typeChecker.getTypeFromTypeNode(typeParamDecl.constraint));
|
package/dist/getTypeName.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypeName.js","sourceRoot":"","sources":["../src/getTypeName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;GAIG;AACH,SAAgB,WAAW,CACzB,WAA2B,EAC3B,IAAa;IAEb,0DAA0D;IAC1D,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,QAAQ,CAAC;KACjB;IAED,wEAAwE;IACxE,sEAAsE;IACtE,8BAA8B;IAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACnD,sEAAsE;QACtE,uEAAuE;QACvE,WAAW;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"getTypeName.js","sourceRoot":"","sources":["../src/getTypeName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;GAIG;AACH,SAAgB,WAAW,CACzB,WAA2B,EAC3B,IAAa;IAEb,0DAA0D;IAC1D,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAChD,OAAO,QAAQ,CAAC;KACjB;IAED,wEAAwE;IACxE,sEAAsE;IACtE,8BAA8B;IAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACnD,sEAAsE;QACtE,uEAAuE;QACvE,WAAW;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,MAAM,EAAE,eAAe,EAAE,CAAC;QACxC,MAAM,aAAa,GAAG,KAAK,EAAE,CAAC,CAAC,CAAgC,CAAC;QAChE,IACE,EAAE,CAAC,0BAA0B,CAAC,aAAa,CAAC;YAC5C,aAAa,CAAC,UAAU,IAAI,IAAI,EAChC;YACA,OAAO,WAAW,CAChB,WAAW,EACX,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC,CAC1D,CAAC;SACH;KACF;IAED,qEAAqE;IACrE,gCAAgC;IAChC,2BAA2B;IAC3B,uCAAuC;IACvC,IACE,IAAI,CAAC,OAAO,EAAE;QACd,IAAI,CAAC,KAAK;aACP,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;aAC7C,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,EAC7B;QACA,OAAO,QAAQ,CAAC;KACjB;IAED,0EAA0E;IAC1E,uEAAuE;IACvE,IACE,IAAI,CAAC,cAAc,EAAE;QACrB,IAAI,CAAC,KAAK;aACP,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;aAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,EAC5B;QACA,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAvDD,kCAuDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTypeReadonly.d.ts","sourceRoot":"","sources":["../src/isTypeReadonly.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isTypeReadonly.d.ts","sourceRoot":"","sources":["../src/isTypeReadonly.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAajC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;CAQrC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,mBAEzC,CAAC;AAwRF;;GAEG;AACH,iBAAS,cAAc,CACrB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,OAAO,GAAE,mBAAiD,GACzD,OAAO,CAKT;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/isTypeReadonly.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.isTypeReadonly = exports.readonlynessOptionsDefaults = exports.readonlynessOptionsSchema = void 0;
|
|
27
27
|
const utils_1 = require("@typescript-eslint/utils");
|
|
28
|
-
const
|
|
28
|
+
const tools = __importStar(require("ts-api-utils"));
|
|
29
29
|
const ts = __importStar(require("typescript"));
|
|
30
30
|
const propertyTypes_1 = require("./propertyTypes");
|
|
31
31
|
exports.readonlynessOptionsSchema = {
|
|
@@ -45,12 +45,11 @@ function hasSymbol(node) {
|
|
|
45
45
|
}
|
|
46
46
|
function isTypeReadonlyArrayOrTuple(checker, type, options, seenTypes) {
|
|
47
47
|
function checkTypeArguments(arrayType) {
|
|
48
|
-
var _a;
|
|
49
48
|
const typeArguments =
|
|
50
49
|
// getTypeArguments was only added in TS3.7
|
|
51
50
|
checker.getTypeArguments
|
|
52
51
|
? checker.getTypeArguments(arrayType)
|
|
53
|
-
:
|
|
52
|
+
: arrayType.typeArguments ?? [];
|
|
54
53
|
// this shouldn't happen in reality as:
|
|
55
54
|
// - tuples require at least 1 type argument
|
|
56
55
|
// - ReadonlyArray requires at least 1 type argument
|
|
@@ -101,7 +100,7 @@ function isTypeReadonlyObject(checker, type, options, seenTypes) {
|
|
|
101
100
|
if (options.treatMethodsAsReadonly) {
|
|
102
101
|
if (property.valueDeclaration !== undefined &&
|
|
103
102
|
hasSymbol(property.valueDeclaration) &&
|
|
104
|
-
|
|
103
|
+
tools.isSymbolFlagSet(property.valueDeclaration.symbol, ts.SymbolFlags.Method)) {
|
|
105
104
|
continue;
|
|
106
105
|
}
|
|
107
106
|
const declarations = property.getDeclarations();
|
|
@@ -110,11 +109,11 @@ function isTypeReadonlyObject(checker, type, options, seenTypes) {
|
|
|
110
109
|
: undefined;
|
|
111
110
|
if (lastDeclaration !== undefined &&
|
|
112
111
|
hasSymbol(lastDeclaration) &&
|
|
113
|
-
|
|
112
|
+
tools.isSymbolFlagSet(lastDeclaration.symbol, ts.SymbolFlags.Method)) {
|
|
114
113
|
continue;
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
|
-
if (
|
|
116
|
+
if (tools.isPropertyReadonlyInType(type, property.getEscapedName(), checker)) {
|
|
118
117
|
continue;
|
|
119
118
|
}
|
|
120
119
|
const name = ts.getNameOfDeclaration(property.valueDeclaration);
|
|
@@ -154,15 +153,17 @@ function isTypeReadonlyObject(checker, type, options, seenTypes) {
|
|
|
154
153
|
// a helper function to ensure the seenTypes map is always passed down, except by the external caller
|
|
155
154
|
function isTypeReadonlyRecurser(checker, type, options, seenTypes) {
|
|
156
155
|
seenTypes.add(type);
|
|
157
|
-
if (
|
|
156
|
+
if (tools.isUnionType(type)) {
|
|
158
157
|
// all types in the union must be readonly
|
|
159
|
-
const result =
|
|
158
|
+
const result = tools
|
|
159
|
+
.unionTypeParts(type)
|
|
160
|
+
.every(t => seenTypes.has(t) ||
|
|
160
161
|
isTypeReadonlyRecurser(checker, t, options, seenTypes) ===
|
|
161
162
|
3 /* Readonlyness.Readonly */);
|
|
162
163
|
const readonlyness = result ? 3 /* Readonlyness.Readonly */ : 2 /* Readonlyness.Mutable */;
|
|
163
164
|
return readonlyness;
|
|
164
165
|
}
|
|
165
|
-
if (
|
|
166
|
+
if (tools.isIntersectionType(type)) {
|
|
166
167
|
// Special case for handling arrays/tuples (as readonly arrays/tuples always have mutable methods).
|
|
167
168
|
if (type.types.some(t => checker.isArrayType(t) || checker.isTupleType(t))) {
|
|
168
169
|
const allReadonlyParts = type.types.every(t => seenTypes.has(t) ||
|
|
@@ -176,7 +177,7 @@ function isTypeReadonlyRecurser(checker, type, options, seenTypes) {
|
|
|
176
177
|
return isReadonlyObject;
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
|
-
if (
|
|
180
|
+
if (tools.isConditionalType(type)) {
|
|
180
181
|
const result = [type.root.node.trueType, type.root.node.falseType]
|
|
181
182
|
.map(checker.getTypeFromTypeNode)
|
|
182
183
|
.every(t => seenTypes.has(t) ||
|
|
@@ -187,7 +188,7 @@ function isTypeReadonlyRecurser(checker, type, options, seenTypes) {
|
|
|
187
188
|
}
|
|
188
189
|
// all non-object, non-intersection types are readonly.
|
|
189
190
|
// this should only be primitive types
|
|
190
|
-
if (!
|
|
191
|
+
if (!tools.isObjectType(type)) {
|
|
191
192
|
return 3 /* Readonlyness.Readonly */;
|
|
192
193
|
}
|
|
193
194
|
// pure function types are readonly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTypeReadonly.js","sourceRoot":"","sources":["../src/isTypeReadonly.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"isTypeReadonly.js","sourceRoot":"","sources":["../src/isTypeReadonly.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuD;AACvD,oDAAsC;AACtC,+CAAiC;AAEjC,mDAA0D;AAe7C,QAAA,yBAAyB,GAAG;IACvC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,sBAAsB,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I,EACJ,OAAO,EACP,SAAS,CACV,CAAC;IACF,0BAA0B,CAAC,IACzB,gBAAgB,qCAA6B,EAC7C;QACA,OAAO,gBAAgB,CAAC;KACzB;IAED,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACrB,OAAuB,EACvB,IAAa,EACb,UAA+B,mCAA2B;IAE1D,OAAO,CACL,sBAAsB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,CAAC;qCACpC,CACtB,CAAC;AACJ,CAAC;AAEQ,wCAAc"}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.isUnsafeAssignment = void 0;
|
|
4
27
|
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
-
const
|
|
28
|
+
const tools = __importStar(require("ts-api-utils"));
|
|
6
29
|
const predicates_1 = require("./predicates");
|
|
7
30
|
/**
|
|
8
31
|
* Does a simple check to see if there is an any being assigned to a non-any type.
|
|
@@ -15,7 +38,6 @@ const predicates_1 = require("./predicates");
|
|
|
15
38
|
* @returns false if it's safe, or an object with the two types if it's unsafe
|
|
16
39
|
*/
|
|
17
40
|
function isUnsafeAssignment(type, receiver, checker, senderNode) {
|
|
18
|
-
var _a, _b;
|
|
19
41
|
if ((0, predicates_1.isTypeAnyType)(type)) {
|
|
20
42
|
// Allow assignment of any ==> unknown.
|
|
21
43
|
if ((0, predicates_1.isTypeUnknownType)(receiver)) {
|
|
@@ -25,7 +47,7 @@ function isUnsafeAssignment(type, receiver, checker, senderNode) {
|
|
|
25
47
|
return { sender: type, receiver };
|
|
26
48
|
}
|
|
27
49
|
}
|
|
28
|
-
if (
|
|
50
|
+
if (tools.isTypeReference(type) && tools.isTypeReference(receiver)) {
|
|
29
51
|
// TODO - figure out how to handle cases like this,
|
|
30
52
|
// where the types are assignable, but not the same type
|
|
31
53
|
/*
|
|
@@ -43,7 +65,7 @@ function isUnsafeAssignment(type, receiver, checker, senderNode) {
|
|
|
43
65
|
// the generic positions might not be equivalent for both types
|
|
44
66
|
return false;
|
|
45
67
|
}
|
|
46
|
-
if (
|
|
68
|
+
if (senderNode?.type === utils_1.AST_NODE_TYPES.NewExpression &&
|
|
47
69
|
senderNode.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
48
70
|
senderNode.callee.name === 'Map' &&
|
|
49
71
|
senderNode.arguments.length === 0 &&
|
|
@@ -53,8 +75,8 @@ function isUnsafeAssignment(type, receiver, checker, senderNode) {
|
|
|
53
75
|
// https://github.com/typescript-eslint/typescript-eslint/issues/2109#issuecomment-634144396
|
|
54
76
|
return false;
|
|
55
77
|
}
|
|
56
|
-
const typeArguments =
|
|
57
|
-
const receiverTypeArguments =
|
|
78
|
+
const typeArguments = type.typeArguments ?? [];
|
|
79
|
+
const receiverTypeArguments = receiver.typeArguments ?? [];
|
|
58
80
|
for (let i = 0; i < typeArguments.length; i += 1) {
|
|
59
81
|
const arg = typeArguments[i];
|
|
60
82
|
const receiverArg = receiverTypeArguments[i];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnsafeAssignment.js","sourceRoot":"","sources":["../src/isUnsafeAssignment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isUnsafeAssignment.js","sourceRoot":"","sources":["../src/isUnsafeAssignment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,oDAAsC;AAGtC,6CAAgE;AAEhE;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAChC,IAAa,EACb,QAAiB,EACjB,OAAuB,EACvB,UAAgC;IAEhC,IAAI,IAAA,0BAAa,EAAC,IAAI,CAAC,EAAE;QACvB,uCAAuC;QACvC,IAAI,IAAA,8BAAiB,EAAC,QAAQ,CAAC,EAAE;YAC/B,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,IAAA,0BAAa,EAAC,QAAQ,CAAC,EAAE;YAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SACnC;KACF;IAED,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE;QAClE,mDAAmD;QACnD,wDAAwD;QACxD;;;;;;;;;UASE;QAEF,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE;YACnC,mGAAmG;YACnG,+DAA+D;YAC/D,OAAO,KAAK,CAAC;SACd;QAED,IACE,UAAU,EAAE,IAAI,KAAK,sBAAc,CAAC,aAAa;YACjD,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;YACpD,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK;YAChC,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YACjC,UAAU,CAAC,cAAc,IAAI,IAAI,EACjC;YACA,qCAAqC;YACrC,sFAAsF;YACtF,4FAA4F;YAC5F,OAAO,KAAK,CAAC;SACd;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QAC/C,MAAM,qBAAqB,GAAG,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC;QAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAChD,MAAM,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAE7C,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YACzE,IAAI,MAAM,EAAE;gBACV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;aACnC;SACF;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAnED,gDAmEC"}
|
package/dist/predicates.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.isTypeTemplateLiteralType = exports.isTypeBigIntLiteralType = exports.typeIsOrHasBaseType = exports.isAnyOrAnyArrayTypeDiscriminated = exports.AnyType = exports.isTypeUnknownArrayType = exports.isTypeAnyArrayType = exports.isTypeAnyType = exports.isTypeReferenceType = exports.isTypeUnknownType = exports.isTypeNeverType = exports.isTypeArrayTypeOrUnionOfArrayTypes = exports.isNullableType = void 0;
|
|
30
30
|
const debug_1 = __importDefault(require("debug"));
|
|
31
|
-
const
|
|
31
|
+
const tools = __importStar(require("ts-api-utils"));
|
|
32
32
|
const ts = __importStar(require("typescript"));
|
|
33
33
|
const getTypeArguments_1 = require("./getTypeArguments");
|
|
34
34
|
const typeFlagUtils_1 = require("./typeFlagUtils");
|
|
@@ -55,7 +55,7 @@ exports.isNullableType = isNullableType;
|
|
|
55
55
|
* or a union made up solely of array types.
|
|
56
56
|
*/
|
|
57
57
|
function isTypeArrayTypeOrUnionOfArrayTypes(type, checker) {
|
|
58
|
-
for (const t of
|
|
58
|
+
for (const t of tools.unionTypeParts(type)) {
|
|
59
59
|
if (!checker.isArrayType(t)) {
|
|
60
60
|
return false;
|
|
61
61
|
}
|
package/dist/predicates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"predicates.js","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,oDAAsC;AACtC,+CAAiC;AAEjC,yDAAsD;AACtD,mDAA8D;AAE9D,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,6CAA6C,CAAC,CAAC;AAEjE;;;GAGG;AACH,SAAgB,cAAc,CAC5B,IAAa,EACb,EACE,UAAU,GAAG,KAAK,EAClB,cAAc,GAAG,IAAI,MACiC,EAAE;IAE1D,MAAM,KAAK,GAAG,IAAA,4BAAY,EAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,UAAU,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QACnE,OAA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C,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AAC3D,CAAC;AAJD,8DAIC"}
|
package/dist/typeFlagUtils.js
CHANGED
|
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.isTypeFlagSet = exports.getTypeFlags = void 0;
|
|
27
|
-
const
|
|
27
|
+
const tools = __importStar(require("ts-api-utils"));
|
|
28
28
|
const ts = __importStar(require("typescript"));
|
|
29
29
|
/**
|
|
30
30
|
* Gets all of the type flags in a type, iterating through unions automatically
|
|
31
31
|
*/
|
|
32
32
|
function getTypeFlags(type) {
|
|
33
33
|
let flags = 0;
|
|
34
|
-
for (const t of
|
|
34
|
+
for (const t of tools.unionTypeParts(type)) {
|
|
35
35
|
flags |= t.flags;
|
|
36
36
|
}
|
|
37
37
|
return flags;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeFlagUtils.js","sourceRoot":"","sources":["../src/typeFlagUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"typeFlagUtils.js","sourceRoot":"","sources":["../src/typeFlagUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,+CAAiC;AAEjC;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAa;IACxC,IAAI,KAAK,GAAiB,CAAC,CAAC;IAC5B,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAC1C,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;KAClB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAND,oCAMC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAC3B,IAAa,EACb,YAA0B,EAC1B,UAAoB;IAEpB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,UAAU,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QACnE,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAZD,sCAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/type-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.58+a00d9168",
|
|
4
4
|
"description": "Type utilities for working with TypeScript + ESLint together",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"estree"
|
|
9
9
|
],
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": "^
|
|
11
|
+
"node": "^14.18.0 || ^16.0.0 || >=18.0.0"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
-
"
|
|
15
|
+
"_ts4.2",
|
|
16
16
|
"package.json",
|
|
17
17
|
"README.md",
|
|
18
18
|
"LICENSE"
|
|
@@ -30,26 +30,26 @@
|
|
|
30
30
|
"types": "dist/index.d.ts",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc -b tsconfig.build.json",
|
|
33
|
-
"postbuild": "downlevel-dts dist
|
|
33
|
+
"postbuild": "downlevel-dts dist _ts4.2/dist --to=4.2",
|
|
34
34
|
"clean": "tsc -b tsconfig.build.json --clean",
|
|
35
|
-
"postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage",
|
|
35
|
+
"postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.2 && rimraf coverage",
|
|
36
36
|
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
|
|
37
37
|
"lint": "nx lint",
|
|
38
38
|
"test": "jest --coverage",
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@typescript-eslint/typescript-estree": "
|
|
43
|
-
"@typescript-eslint/utils": "
|
|
42
|
+
"@typescript-eslint/typescript-estree": "6.0.0-alpha.58+a00d9168",
|
|
43
|
+
"@typescript-eslint/utils": "6.0.0-alpha.58+a00d9168",
|
|
44
44
|
"debug": "^4.3.4",
|
|
45
|
-
"
|
|
45
|
+
"ts-api-utils": "^0.0.22"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@typescript-eslint/parser": "
|
|
48
|
+
"@typescript-eslint/parser": "6.0.0-alpha.58+a00d9168",
|
|
49
49
|
"typescript": "*"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"eslint": "
|
|
52
|
+
"eslint": "^7.0.0 || ^8.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"typescript": {
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"url": "https://opencollective.com/typescript-eslint"
|
|
62
62
|
},
|
|
63
63
|
"typesVersions": {
|
|
64
|
-
"<
|
|
64
|
+
"<4.7": {
|
|
65
65
|
"*": [
|
|
66
|
-
"
|
|
66
|
+
"_ts4.2/*"
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "a00d916841ceb0b0620f4302185b0569de56b215"
|
|
71
71
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getConstrainedTypeAtLocation(checker: ts.TypeChecker, node: ts.Node): ts.Type;
|
|
6
|
-
//# sourceMappingURL=getConstrainedTypeAtLocation.d.ts.map
|