MCPcopy Index your code
hub / github.com/microsoft/typescript-go / typePredicateToStringEx

Method typePredicateToStringEx

internal/checker/printer.go:363–377  ·  view source on GitHub ↗
(typePredicate *TypePredicate, enclosingDeclaration *ast.Node, flags TypeFormatFlags)

Source from the content-addressed store, hash-verified

361}
362
363func (c *Checker) typePredicateToStringEx(typePredicate *TypePredicate, enclosingDeclaration *ast.Node, flags TypeFormatFlags) string {
364 writer, putWriter := printer.GetSingleLineStringWriter()
365 defer putWriter()
366 nodeBuilder, release := c.getNodeBuilder()
367 defer release()
368 combinedFlags := toNodeBuilderFlags(flags) | nodebuilder.FlagsIgnoreErrors | nodebuilder.FlagsWriteTypeParametersInQualifiedName
369 predicate := nodeBuilder.TypePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, combinedFlags, nodebuilder.InternalFlagsNone, nil) // TODO: GH#18217
370 printer_ := createPrinterWithRemoveComments(nodeBuilder.EmitContext())
371 var sourceFile *ast.SourceFile
372 if enclosingDeclaration != nil {
373 sourceFile = ast.GetSourceFileOfNode(enclosingDeclaration)
374 }
375 printer_.Write(predicate /*sourceFile*/, sourceFile, writer, nil)
376 return writer.String()
377}
378
379func (c *Checker) valueToString(value any) string {
380 return ValueToString(value)

Callers 1

typePredicateToStringMethod · 0.95

Calls 9

getNodeBuilderMethod · 0.95
GetSourceFileOfNodeFunction · 0.92
toNodeBuilderFlagsFunction · 0.85
WriteMethod · 0.65
StringMethod · 0.65
EmitContextMethod · 0.45

Tested by

no test coverage detected