@@ -67,12 +67,14 @@ import type {
6767 AssertsThisTypePredicate ,
6868 ConditionalType ,
6969 Diagnostic ,
70+ FreshableType ,
7071 IdentifierTypePredicate ,
7172 IndexedAccessType ,
7273 IndexInfo ,
7374 IndexType ,
7475 InterfaceType ,
7576 IntersectionType ,
77+ IntrinsicType ,
7678 LiteralType ,
7779 ObjectType ,
7880 StringMappingType ,
@@ -91,7 +93,7 @@ import type {
9193
9294export { DiagnosticCategory , ElementFlags , ModifierFlags , NodeBuilderFlags , ObjectFlags , SignatureFlags , SignatureKind , SymbolFlags , TypeFlags , TypePredicateKind } ;
9395export type { APIOptions , ClientSocketOptions , ClientSpawnOptions , DocumentIdentifier , DocumentPosition , LSPConnectionOptions } ;
94- export type { AssertsIdentifierTypePredicate , AssertsThisTypePredicate , ConditionalType , Diagnostic , IdentifierTypePredicate , IndexedAccessType , IndexInfo , IndexType , InterfaceType , IntersectionType , LiteralType , ObjectType , StringMappingType , SubstitutionType , TemplateLiteralType , ThisTypePredicate , TupleType , Type , TypeParameter , TypePredicate , TypePredicateBase , TypeReference , UnionOrIntersectionType , UnionType } ;
96+ export type { AssertsIdentifierTypePredicate , AssertsThisTypePredicate , ConditionalType , Diagnostic , FreshableType , IdentifierTypePredicate , IndexedAccessType , IndexInfo , IndexType , InterfaceType , IntersectionType , IntrinsicType , LiteralType , ObjectType , StringMappingType , SubstitutionType , TemplateLiteralType , ThisTypePredicate , TupleType , Type , TypeParameter , TypePredicate , TypePredicateBase , TypeReference , UnionOrIntersectionType , UnionType } ;
9597export { documentURIToFileName , fileNameToDocumentURI } from "../path.ts" ;
9698
9799/** Type alias for the snapshot-scoped object registry */
@@ -689,6 +691,15 @@ export class Checker {
689691 } ) ;
690692 }
691693
694+ async isTypeAssignableTo ( source : Type , target : Type ) : Promise < boolean > {
695+ return this . client . apiRequest < boolean > ( "isTypeAssignableTo" , {
696+ snapshot : this . snapshotId ,
697+ project : this . projectId ,
698+ source : source . id ,
699+ target : target . id ,
700+ } ) ;
701+ }
702+
692703 async getShorthandAssignmentValueSymbol ( node : Node ) : Promise < Symbol | undefined > {
693704 const data = await this . client . apiRequest < SymbolResponse | null > ( "getShorthandAssignmentValueSymbol" , {
694705 snapshot : this . snapshotId ,
@@ -980,10 +991,16 @@ class TypeObject implements Type {
980991 readonly flags : TypeFlags ;
981992 readonly objectFlags ! : ObjectFlags ;
982993 readonly value ! : string | number | boolean ;
994+ readonly intrinsicName ! : string ;
995+ readonly isThisType ! : boolean ;
996+ readonly freshType ! : number ;
997+ readonly regularType ! : number ;
983998 readonly target ! : number ;
984999 readonly typeParameters ! : readonly number [ ] ;
9851000 readonly outerTypeParameters ! : readonly number [ ] ;
9861001 readonly localTypeParameters ! : readonly number [ ] ;
1002+ readonly aliasTypeArguments ! : readonly number [ ] ;
1003+ readonly aliasSymbol ! : number ;
9871004 readonly elementFlags ! : readonly ElementFlags [ ] ;
9881005 readonly fixedLength ! : number ;
9891006 readonly readonly ! : boolean ;
@@ -1004,10 +1021,16 @@ class TypeObject implements Type {
10041021 this . flags = data . flags ;
10051022 if ( data . objectFlags !== undefined ) this . objectFlags = data . objectFlags ;
10061023 if ( data . value !== undefined ) this . value = data . value ;
1024+ if ( data . intrinsicName !== undefined ) this . intrinsicName = data . intrinsicName ;
1025+ if ( data . isThisType !== undefined ) this . isThisType = data . isThisType ;
1026+ if ( data . freshType !== undefined ) this . freshType = data . freshType ;
1027+ if ( data . regularType !== undefined ) this . regularType = data . regularType ;
10071028 if ( data . target !== undefined ) this . target = data . target ;
10081029 if ( data . typeParameters !== undefined ) this . typeParameters = data . typeParameters ;
10091030 if ( data . outerTypeParameters !== undefined ) this . outerTypeParameters = data . outerTypeParameters ;
10101031 if ( data . localTypeParameters !== undefined ) this . localTypeParameters = data . localTypeParameters ;
1032+ if ( data . aliasTypeArguments !== undefined ) this . aliasTypeArguments = data . aliasTypeArguments ;
1033+ if ( data . aliasSymbol !== undefined ) this . aliasSymbol = data . aliasSymbol ;
10111034 if ( data . elementFlags !== undefined ) this . elementFlags = data . elementFlags ;
10121035 if ( data . fixedLength !== undefined ) this . fixedLength = data . fixedLength ;
10131036 if ( data . readonly !== undefined ) this . readonly = data . readonly ;
@@ -1025,6 +1048,14 @@ class TypeObject implements Type {
10251048 return data ? this . objectRegistry . getOrCreateSymbol ( data ) : undefined ;
10261049 }
10271050
1051+ async getAliasSymbol ( ) : Promise < Symbol | undefined > {
1052+ if ( ! this . aliasSymbol ) return undefined ;
1053+ const cached = this . objectRegistry . getSymbol ( this . aliasSymbol ) ;
1054+ if ( cached ) return cached ;
1055+ const data = await this . client . apiRequest < SymbolResponse | null > ( "getAliasSymbolOfType" , { snapshot : this . snapshotId , type : this . id } ) ;
1056+ return data ? this . objectRegistry . getOrCreateSymbol ( data ) : undefined ;
1057+ }
1058+
10281059 private async fetchType ( handle : number | undefined , method : string ) : Promise < Type > {
10291060 const cached = handle !== undefined ? this . objectRegistry . getType ( handle ) : undefined ;
10301061 if ( cached ) return cached as Type ;
@@ -1042,6 +1073,22 @@ class TypeObject implements Type {
10421073 return this . fetchType ( this . target , "getTargetOfType" ) ;
10431074 }
10441075
1076+ async getFreshType ( ) : Promise < FreshableType | undefined > {
1077+ if ( ! this . freshType ) return undefined ;
1078+ const cached = this . objectRegistry . getType ( this . freshType ) ;
1079+ if ( cached ) return cached as FreshableType ;
1080+ const data = await this . client . apiRequest < TypeResponse | null > ( "getFreshTypeOfType" , { snapshot : this . snapshotId , type : this . id } ) ;
1081+ return data ? this . objectRegistry . getOrCreateType ( data ) as FreshableType : undefined ;
1082+ }
1083+
1084+ async getRegularType ( ) : Promise < FreshableType | undefined > {
1085+ if ( ! this . regularType ) return undefined ;
1086+ const cached = this . objectRegistry . getType ( this . regularType ) ;
1087+ if ( cached ) return cached as FreshableType ;
1088+ const data = await this . client . apiRequest < TypeResponse | null > ( "getRegularTypeOfType" , { snapshot : this . snapshotId , type : this . id } ) ;
1089+ return data ? this . objectRegistry . getOrCreateType ( data ) as FreshableType : undefined ;
1090+ }
1091+
10451092 async getTypes ( ) : Promise < readonly Type [ ] > {
10461093 return this . fetchTypes ( "getTypesOfType" ) ;
10471094 }
@@ -1058,6 +1105,10 @@ class TypeObject implements Type {
10581105 return this . fetchTypes ( "getLocalTypeParametersOfType" ) ;
10591106 }
10601107
1108+ async getAliasTypeArguments ( ) : Promise < readonly Type [ ] > {
1109+ return this . fetchTypes ( "getAliasTypeArgumentsOfType" ) ;
1110+ }
1111+
10611112 async getObjectType ( ) : Promise < Type > {
10621113 return this . fetchType ( this . objectType , "getObjectTypeOfType" ) ;
10631114 }
0 commit comments