File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -335,9 +335,11 @@ function isPartialReplacement(
335
335
const rhc = replacementDecl . heritageClauses ;
336
336
if (
337
337
interfaceDecl . heritageClauses . some ( ( heritageClause , index ) => {
338
- return (
339
- heritageClause . getFullText ( originalFile ) !==
340
- rhc [ index ] . getFullText ( betterFile )
338
+ return ! heritageClauseEquals (
339
+ heritageClause ,
340
+ rhc [ index ] ,
341
+ originalFile ,
342
+ betterFile ,
341
343
) ;
342
344
} )
343
345
) {
@@ -352,6 +354,29 @@ function isPartialReplacement(
352
354
return true ;
353
355
}
354
356
357
+ function heritageClauseEquals (
358
+ left : ts . HeritageClause ,
359
+ right : ts . HeritageClause ,
360
+ leftSourceFile : ts . SourceFile ,
361
+ rightSourceFile : ts . SourceFile ,
362
+ ) : boolean {
363
+ if ( left . token !== right . token ) {
364
+ return false ;
365
+ }
366
+ if ( left . types . length !== right . types . length ) {
367
+ return false ;
368
+ }
369
+ for ( let i = 0 ; i < left . types . length ; i ++ ) {
370
+ if (
371
+ left . types [ i ] . getFullText ( leftSourceFile ) . trim ( ) !==
372
+ right . types [ i ] . getFullText ( rightSourceFile ) . trim ( )
373
+ ) {
374
+ return false ;
375
+ }
376
+ }
377
+ return true ;
378
+ }
379
+
355
380
/**
356
381
* Print an interface declaration where members may be from
357
382
* mixed source files.
You can’t perform that action at this time.
0 commit comments