@typescript-eslint/type-utils 6.0.0 → 7.0.0-alpha.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/type-utils",
3
- "version": "6.0.0",
3
+ "version": "7.0.0-alpha.0+6ae1fa74b",
4
4
  "description": "Type utilities for working with TypeScript + ESLint together",
5
5
  "files": [
6
6
  "dist",
@@ -45,13 +45,13 @@
45
45
  "typecheck": "tsc -p tsconfig.json --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@typescript-eslint/typescript-estree": "6.0.0",
49
- "@typescript-eslint/utils": "6.0.0",
48
+ "@typescript-eslint/typescript-estree": "7.0.0-alpha.0+6ae1fa74b",
49
+ "@typescript-eslint/utils": "7.0.0-alpha.0+6ae1fa74b",
50
50
  "debug": "^4.3.4",
51
51
  "ts-api-utils": "^1.0.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@typescript-eslint/parser": "6.0.0",
54
+ "@typescript-eslint/parser": "7.0.0-alpha.0+6ae1fa74b",
55
55
  "ajv": "^8.12.0",
56
56
  "typescript": "*"
57
57
  },
@@ -1,21 +0,0 @@
1
- import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema';
2
- import type * as ts from 'typescript';
3
- interface FileSpecifier {
4
- from: 'file';
5
- name: string[] | string;
6
- path?: string;
7
- }
8
- interface LibSpecifier {
9
- from: 'lib';
10
- name: string[] | string;
11
- }
12
- interface PackageSpecifier {
13
- from: 'package';
14
- name: string[] | string;
15
- package: string;
16
- }
17
- export type TypeOrValueSpecifier = FileSpecifier | LibSpecifier | PackageSpecifier | string;
18
- export declare const typeOrValueSpecifierSchema: JSONSchema4;
19
- export declare function typeMatchesSpecifier(type: ts.Type, specifier: TypeOrValueSpecifier, program: ts.Program): boolean;
20
- export {};
21
- //# sourceMappingURL=TypeOrValueSpecifier.d.ts.map
@@ -1,10 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * @param type Type being checked by name.
4
- * @param allowAny Whether to consider `any` and `unknown` to match.
5
- * @param allowedNames Symbol names checking on the type.
6
- * @param matchAnyInstead Whether to instead just check if any parts match, rather than all parts.
7
- * @returns Whether the type is, extends, or contains the allowed names (or all matches the allowed names, if mustMatchAll is true).
8
- */
9
- export declare function containsAllTypesByName(type: ts.Type, allowAny: boolean, allowedNames: Set<string>, matchAnyInstead?: boolean): boolean;
10
- //# sourceMappingURL=containsAllTypesByName.d.ts.map
@@ -1,7 +0,0 @@
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
@@ -1,8 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * Returns the contextual type of a given node.
4
- * Contextual type is the type of the target the node is going into.
5
- * i.e. the type of a called function's parameter, or the defined type of a variable declaration
6
- */
7
- export declare function getContextualType(checker: ts.TypeChecker, node: ts.Expression): ts.Type | undefined;
8
- //# sourceMappingURL=getContextualType.d.ts.map
@@ -1,7 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * Gets the source file for a given node
4
- */
5
- export declare function getSourceFileOfNode(node: ts.Node): ts.SourceFile;
6
- //# sourceMappingURL=getSourceFileOfNode.d.ts.map
@@ -1,3 +0,0 @@
1
- import * as ts from 'typescript';
2
- export declare function getTokenAtPosition(sourceFile: ts.SourceFile, position: number): ts.Node;
3
- //# sourceMappingURL=getTokenAtPosition.d.ts.map
@@ -1,3 +0,0 @@
1
- import type * as ts from 'typescript';
2
- export declare function getTypeArguments(type: ts.TypeReference, checker: ts.TypeChecker): readonly ts.Type[];
3
- //# sourceMappingURL=getTypeArguments.d.ts.map
@@ -1,8 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * Get the type name of a given type.
4
- * @param typeChecker The context sensitive TypeScript TypeChecker.
5
- * @param type The type to get the name of.
6
- */
7
- export declare function getTypeName(typeChecker: ts.TypeChecker, type: ts.Type): string;
8
- //# sourceMappingURL=getTypeName.d.ts.map
@@ -1,17 +0,0 @@
1
- export * from './containsAllTypesByName';
2
- export * from './getConstrainedTypeAtLocation';
3
- export * from './getContextualType';
4
- export * from './getDeclaration';
5
- export * from './getSourceFileOfNode';
6
- export * from './getTokenAtPosition';
7
- export * from './getTypeArguments';
8
- export * from './getTypeName';
9
- export * from './isTypeReadonly';
10
- export * from './isUnsafeAssignment';
11
- export * from './predicates';
12
- export * from './propertyTypes';
13
- export * from './requiresQuoting';
14
- export * from './TypeOrValueSpecifier';
15
- export * from './typeFlagUtils';
16
- export { getDecorators, getModifiers, typescriptVersionIsAtLeast, } from '@typescript-eslint/typescript-estree';
17
- //# sourceMappingURL=index.d.ts.map
@@ -1,27 +0,0 @@
1
- import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema';
2
- import * as ts from 'typescript';
3
- import type { TypeOrValueSpecifier } from './TypeOrValueSpecifier';
4
- export interface ReadonlynessOptions {
5
- readonly treatMethodsAsReadonly?: boolean;
6
- readonly allow?: TypeOrValueSpecifier[];
7
- }
8
- export declare const readonlynessOptionsSchema: {
9
- type: "object";
10
- additionalProperties: false;
11
- properties: {
12
- treatMethodsAsReadonly: {
13
- type: "boolean";
14
- };
15
- allow: {
16
- type: "array";
17
- items: JSONSchema4;
18
- };
19
- };
20
- };
21
- export declare const readonlynessOptionsDefaults: ReadonlynessOptions;
22
- /**
23
- * Checks if the given type is readonly
24
- */
25
- declare function isTypeReadonly(program: ts.Program, type: ts.Type, options?: ReadonlynessOptions): boolean;
26
- export { isTypeReadonly };
27
- //# sourceMappingURL=isTypeReadonly.d.ts.map
@@ -1,17 +0,0 @@
1
- import type { TSESTree } from '@typescript-eslint/utils';
2
- import type * as ts from 'typescript';
3
- /**
4
- * Does a simple check to see if there is an any being assigned to a non-any type.
5
- *
6
- * This also checks generic positions to ensure there's no unsafe sub-assignments.
7
- * Note: in the case of generic positions, it makes the assumption that the two types are the same.
8
- *
9
- * @example See tests for examples
10
- *
11
- * @returns false if it's safe, or an object with the two types if it's unsafe
12
- */
13
- export declare function isUnsafeAssignment(type: ts.Type, receiver: ts.Type, checker: ts.TypeChecker, senderNode: TSESTree.Node | null): false | {
14
- sender: ts.Type;
15
- receiver: ts.Type;
16
- };
17
- //# sourceMappingURL=isUnsafeAssignment.d.ts.map
@@ -1,52 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * Checks if the given type is (or accepts) nullable
4
- * @param isReceiver true if the type is a receiving type (i.e. the type of a called function's parameter)
5
- */
6
- export declare function isNullableType(type: ts.Type, { isReceiver, allowUndefined, }?: {
7
- isReceiver?: boolean;
8
- allowUndefined?: boolean;
9
- }): boolean;
10
- /**
11
- * Checks if the given type is either an array type,
12
- * or a union made up solely of array types.
13
- */
14
- export declare function isTypeArrayTypeOrUnionOfArrayTypes(type: ts.Type, checker: ts.TypeChecker): boolean;
15
- /**
16
- * @returns true if the type is `never`
17
- */
18
- export declare function isTypeNeverType(type: ts.Type): boolean;
19
- /**
20
- * @returns true if the type is `unknown`
21
- */
22
- export declare function isTypeUnknownType(type: ts.Type): boolean;
23
- export declare function isTypeReferenceType(type: ts.Type): type is ts.TypeReference;
24
- /**
25
- * @returns true if the type is `any`
26
- */
27
- export declare function isTypeAnyType(type: ts.Type): boolean;
28
- /**
29
- * @returns true if the type is `any[]`
30
- */
31
- export declare function isTypeAnyArrayType(type: ts.Type, checker: ts.TypeChecker): boolean;
32
- /**
33
- * @returns true if the type is `unknown[]`
34
- */
35
- export declare function isTypeUnknownArrayType(type: ts.Type, checker: ts.TypeChecker): boolean;
36
- export declare enum AnyType {
37
- Any = 0,
38
- AnyArray = 1,
39
- Safe = 2
40
- }
41
- /**
42
- * @returns `AnyType.Any` if the type is `any`, `AnyType.AnyArray` if the type is `any[]` or `readonly any[]`,
43
- * otherwise it returns `AnyType.Safe`.
44
- */
45
- export declare function isAnyOrAnyArrayTypeDiscriminated(node: ts.Node, checker: ts.TypeChecker): AnyType;
46
- /**
47
- * @returns Whether a type is an instance of the parent type, including for the parent's base types.
48
- */
49
- export declare function typeIsOrHasBaseType(type: ts.Type, parentType: ts.Type): boolean;
50
- export declare function isTypeBigIntLiteralType(type: ts.Type): type is ts.BigIntLiteralType;
51
- export declare function isTypeTemplateLiteralType(type: ts.Type): type is ts.TemplateLiteralType;
52
- //# sourceMappingURL=predicates.d.ts.map
@@ -1,4 +0,0 @@
1
- import type * as ts from 'typescript';
2
- export declare function getTypeOfPropertyOfName(checker: ts.TypeChecker, type: ts.Type, name: string, escapedName?: ts.__String): ts.Type | undefined;
3
- export declare function getTypeOfPropertyOfType(checker: ts.TypeChecker, type: ts.Type, property: ts.Symbol): ts.Type | undefined;
4
- //# sourceMappingURL=propertyTypes.d.ts.map
@@ -1,4 +0,0 @@
1
- import * as ts from 'typescript';
2
- declare function requiresQuoting(name: string, target?: ts.ScriptTarget): boolean;
3
- export { requiresQuoting };
4
- //# sourceMappingURL=requiresQuoting.d.ts.map
@@ -1,16 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * Gets all of the type flags in a type, iterating through unions automatically.
4
- */
5
- export declare function getTypeFlags(type: ts.Type): ts.TypeFlags;
6
- /**
7
- * @param flagsToCheck The composition of one or more `ts.TypeFlags`.
8
- * @param isReceiver Whether the type is a receiving type (e.g. the type of a
9
- * called function's parameter).
10
- * @remarks
11
- * Note that if the type is a union, this function will decompose it into the
12
- * parts and get the flags of every union constituent. If this is not desired,
13
- * use the `isTypeFlag` function from tsutils.
14
- */
15
- export declare function isTypeFlagSet(type: ts.Type, flagsToCheck: ts.TypeFlags, isReceiver?: boolean): boolean;
16
- //# sourceMappingURL=typeFlagUtils.d.ts.map