mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Add support for walking IndexTypes, IndexedAccessTypes, and MappedTypes.
This commit is contained in:
@@ -53,6 +53,9 @@ namespace ts {
|
||||
if (objectFlags & ObjectFlags.Reference) {
|
||||
visitTypeReference(type as TypeReference);
|
||||
}
|
||||
if (objectFlags & ObjectFlags.Mapped) {
|
||||
visitMappedType(type as MappedType);
|
||||
}
|
||||
if (objectFlags & (ObjectFlags.Class | ObjectFlags.Interface)) {
|
||||
visitInterfaceType(type as InterfaceType);
|
||||
}
|
||||
@@ -66,6 +69,12 @@ namespace ts {
|
||||
if (type.flags & TypeFlags.UnionOrIntersection) {
|
||||
visitUnionOrIntersectionType(type as UnionOrIntersectionType);
|
||||
}
|
||||
if (type.flags & TypeFlags.Index) {
|
||||
visitIndexType(type as IndexType);
|
||||
}
|
||||
if (type.flags & TypeFlags.IndexedAccess) {
|
||||
visitIndexedAccessType(type as IndexedAccessType);
|
||||
}
|
||||
}
|
||||
|
||||
function visitTypeList(types: Type[]): void {
|
||||
@@ -90,6 +99,23 @@ namespace ts {
|
||||
visitTypeList(type.types);
|
||||
}
|
||||
|
||||
function visitIndexType(type: IndexType): void {
|
||||
visitType(type.type);
|
||||
}
|
||||
|
||||
function visitIndexedAccessType(type: IndexedAccessType): void {
|
||||
visitType(type.objectType);
|
||||
visitType(type.indexType);
|
||||
visitType(type.constraint);
|
||||
}
|
||||
|
||||
function visitMappedType(type: MappedType): void {
|
||||
visitType(type.typeParameter);
|
||||
visitType(type.constraintType);
|
||||
visitType(type.templateType);
|
||||
visitType(type.modifiersType);
|
||||
}
|
||||
|
||||
function visitSignature(signature: Signature): void {
|
||||
if (signature.typePredicate) {
|
||||
visitType(signature.typePredicate.type);
|
||||
|
||||
Reference in New Issue
Block a user