Skip to content

Commit bab6338

Browse files
committed
Workaround to prevent deeply inferring with skipLibCheck on
1 parent 1b8d265 commit bab6338

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/checker/nodebuilderimpl.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,12 @@ func (b *nodeBuilderImpl) symbolToTypeNode(symbol *ast.Symbol, mask ast.SymbolFl
568568
}
569569

570570
if attributes == nil {
571+
// This avoids TS2742 errors for internal library types when skipLibCheck is enabled.
572+
// TODO: Remove this workaround once syntacticNodeBuilder is implemented. The root cause is that
573+
// tsgo deeply infers types while upstream reuses existing type nodes, avoiding internal library types.
574+
if b.ch.compilerOptions.SkipLibCheck.IsTrue() && targetFile != nil && targetFile.IsDeclarationFile {
575+
return nil
576+
}
571577
// If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error
572578
// since declaration files with these kinds of references are liable to fail when published :(
573579
b.ctx.encounteredError = true

0 commit comments

Comments
 (0)