@@ -147,6 +147,7 @@ import type {
147147 TemplateLiteralType ,
148148 ThisTypePredicate ,
149149 TupleType ,
150+ TupleTypeReference ,
150151 Type ,
151152 TypeParameter ,
152153 TypePredicate ,
@@ -211,6 +212,7 @@ export type {
211212 TimingAccumulators ,
212213 TimingInfo ,
213214 TupleType ,
215+ TupleTypeReference ,
214216 Type ,
215217 TypeAcquisition ,
216218 TypeParameter ,
@@ -4038,18 +4040,27 @@ export class Checker {
40384040 owner ,
40394041 "isTupleType" ,
40404042 function ( type : Type ) : boolean {
4041- return owner . client . apiRequest ( "isTupleType" , {
4042- snapshot : owner . snapshotId ,
4043- project : owner . project . id ,
4044- type : type . id ,
4045- } ) ;
4043+ return type . isTupleType ( ) ;
40464044 } ,
40474045 function * ( type : Type ) : Generator < ProtocolRequest , boolean , ProtocolResponse [ "result" ] > {
4048- return yield * apiRequest ( "isTupleType" , {
4049- snapshot : owner . snapshotId ,
4050- project : owner . project . id ,
4051- type : type . id ,
4052- } ) ;
4046+ return type . isTupleType ( ) ;
4047+ } ,
4048+ ) ;
4049+ }
4050+
4051+ get isTupleTypeTarget ( ) : {
4052+ ( type : Type ) : boolean ;
4053+ gen ( type : Type ) : Generator < ProtocolRequest , boolean , ProtocolResponse [ "result" ] > ;
4054+ } {
4055+ const owner = this ;
4056+ return cacheGeneratorMethod (
4057+ owner ,
4058+ "isTupleTypeTarget" ,
4059+ function ( type : Type ) : boolean {
4060+ return type . isTupleTypeTarget ( ) ;
4061+ } ,
4062+ function * ( type : Type ) : Generator < ProtocolRequest , boolean , ProtocolResponse [ "result" ] > {
4063+ return type . isTupleTypeTarget ( ) ;
40534064 } ,
40544065 ) ;
40554066 }
@@ -5225,6 +5236,7 @@ class TypeObject implements Type {
52255236 readonly freshType ! : number ;
52265237 readonly regularType ! : number ;
52275238 readonly target ! : number ;
5239+ private readonly tupleType : boolean ;
52285240 readonly typeParameters ! : readonly number [ ] ;
52295241 readonly outerTypeParameters ! : readonly number [ ] ;
52305242 readonly localTypeParameters ! : readonly number [ ] ;
@@ -5280,13 +5292,16 @@ class TypeObject implements Type {
52805292 if ( data . freshType !== undefined ) this . freshType = data . freshType ;
52815293 if ( data . regularType !== undefined ) this . regularType = data . regularType ;
52825294 if ( data . target !== undefined ) this . target = data . target ;
5295+ this . tupleType = data . isTupleType ?? false ;
52835296 this . typeParameters = data . typeParameters ?? [ ] ;
52845297 this . outerTypeParameters = data . outerTypeParameters ?? [ ] ;
52855298 this . localTypeParameters = data . localTypeParameters ?? [ ] ;
52865299 this . aliasTypeArguments = data . aliasTypeArguments ?? [ ] ;
52875300 if ( data . aliasSymbol !== undefined ) this . aliasSymbol = data . aliasSymbol ;
5288- if ( data . elementFlags !== undefined ) this . elementFlags = data . elementFlags ;
5289- if ( data . fixedLength !== undefined ) this . fixedLength = data . fixedLength ;
5301+ if ( data . fixedLength !== undefined ) {
5302+ this . elementFlags = data . elementFlags ?? [ ] ;
5303+ this . fixedLength = data . fixedLength ;
5304+ }
52905305 if ( data . readonly !== undefined ) this . readonly = data . readonly ;
52915306 if ( data . texts !== undefined ) this . texts = data . texts ;
52925307 if ( data . objectType !== undefined ) this . objectType = data . objectType ;
@@ -6034,8 +6049,12 @@ class TypeObject implements Type {
60346049 return isTypeReference ( this ) ;
60356050 }
60366051
6037- isTupleType ( ) : this is TupleType {
6038- return isTupleType ( this ) ;
6052+ isTupleType ( ) : this is TupleTypeReference {
6053+ return this . tupleType ;
6054+ }
6055+
6056+ isTupleTypeTarget ( ) : this is TupleType {
6057+ return this . fixedLength !== undefined ;
60396058 }
60406059
60416060 isIndexType ( ) : this is IndexType {
@@ -6121,8 +6140,12 @@ export function isTypeReference(type: Type): type is TypeReference {
61216140 return isObjectType ( type ) && ( type . objectFlags & ObjectFlags . Reference ) !== 0 ;
61226141}
61236142
6124- export function isTupleType ( type : Type ) : type is TupleType {
6125- return isObjectType ( type ) && ( type . objectFlags & ObjectFlags . Tuple ) !== 0 ;
6143+ export function isTupleType ( type : Type ) : type is TupleTypeReference {
6144+ return type . isTupleType ( ) ;
6145+ }
6146+
6147+ export function isTupleTypeTarget ( type : Type ) : type is TupleType {
6148+ return type . isTupleTypeTarget ( ) ;
61266149}
61276150
61286151export function isIndexType ( type : Type ) : type is IndexType {
0 commit comments