📄 predicates.ts
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 11 |
📦 Imports | 2 |
📊 Variables & Constants | 4 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/type-utils/src/predicates.ts
📦 Imports¶
Name | Source |
---|---|
debug |
debug |
isTypeFlagSet |
./typeFlagUtils |
Variables & Constants¶
Name | Type | Kind | Value | Exported |
---|---|---|---|---|
Nullable |
number |
const | ts.TypeFlags.Undefined | ts.TypeFlags.Null |
✗ |
ObjectFlagsType |
number |
const | `ts.TypeFlags.Any | |
Nullable | ||||
ts.TypeFlags.Never | ||||
ts.TypeFlags.Object | ||||
ts.TypeFlags.Union | ||||
ts.TypeFlags.Intersection` | ✗ | |||
objectTypeFlags |
any |
const | (type as ts.ObjectType).objectFlags |
✗ |
typeAndBaseTypes |
ts.Type[] |
const | [type] |
✗ |
Functions¶
isNullableType(type: ts.Type): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
- Return Type:
boolean
- Calls:
isTypeFlagSet (from ./typeFlagUtils)
isTypeArrayTypeOrUnionOfArrayTypes(type: ts.Type, checker: ts.TypeChecker): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
checker: ts.TypeChecker
- Return Type:
boolean
- Calls:
tsutils.unionConstituents
checker.isArrayType
isTypeNeverType(type: ts.Type): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
- Return Type:
boolean
- Calls:
isTypeFlagSet (from ./typeFlagUtils)
isTypeUnknownType(type: ts.Type): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
- Return Type:
boolean
- Calls:
isTypeFlagSet (from ./typeFlagUtils)
isTypeReferenceType(type: ts.Type): type is ts.TypeReference
¶
Code
- Parameters:
type: ts.Type
- Return Type:
type is ts.TypeReference
isTypeAnyType(type: ts.Type): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
- Return Type:
boolean
- Calls:
isTypeFlagSet (from ./typeFlagUtils)
log
isTypeAnyArrayType(type: ts.Type, checker: ts.TypeChecker): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
checker: ts.TypeChecker
- Return Type:
boolean
- Calls:
checker.isArrayType
isTypeAnyType
checker.getTypeArguments
isTypeUnknownArrayType(type: ts.Type, checker: ts.TypeChecker): boolean
¶
Code
-
JSDoc:
-
Parameters:
type: ts.Type
checker: ts.TypeChecker
- Return Type:
boolean
- Calls:
checker.isArrayType
isTypeUnknownType
checker.getTypeArguments
typeIsOrHasBaseType(type: ts.Type, parentType: ts.Type): boolean
¶
Code
export function typeIsOrHasBaseType(
type: ts.Type,
parentType: ts.Type,
): boolean {
const parentSymbol = parentType.getSymbol();
if (!type.getSymbol() || !parentSymbol) {
return false;
}
const typeAndBaseTypes = [type];
const ancestorTypes = type.getBaseTypes();
if (ancestorTypes) {
typeAndBaseTypes.push(...ancestorTypes);
}
for (const baseType of typeAndBaseTypes) {
const baseSymbol = baseType.getSymbol();
if (baseSymbol && baseSymbol.name === parentSymbol.name) {
return true;
}
}
return false;
}
-
JSDoc:
-
Parameters:
type: ts.Type
parentType: ts.Type
- Return Type:
boolean
- Calls:
parentType.getSymbol
type.getSymbol
type.getBaseTypes
typeAndBaseTypes.push
baseType.getSymbol
isTypeBigIntLiteralType(type: ts.Type): type is ts.BigIntLiteralType
¶
Code
- Parameters:
type: ts.Type
- Return Type:
type is ts.BigIntLiteralType
- Calls:
isTypeFlagSet (from ./typeFlagUtils)
isTypeTemplateLiteralType(type: ts.Type): type is ts.TemplateLiteralType
¶
Code
- Parameters:
type: ts.Type
- Return Type:
type is ts.TemplateLiteralType
- Calls:
isTypeFlagSet (from ./typeFlagUtils)