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

Method emitPostfixTypeOperand

internal/printer/printer.go:1991–1997  ·  view source on GitHub ↗

emitPostfixTypeOperand emits the operand of a postfix type (ArrayType, IndexedAccessType, OptionalType). It is equivalent to `emitTypeNode(operand, TypePrecedencePostfix)` except that it preserves a parsed `typeof X` operand without adding parentheses (e.g., `typeof C[K]` instead of `(typeof C)[K]`)

(operand *ast.TypeNode, parent *ast.Node)

Source from the content-addressed store, hash-verified

1989// via the factory, so parsed postfix types preserve the source as written during round-trip
1990// emit while synthesized postfix types (e.g., from declaration emit) still get the parentheses.
1991func (p *Printer) emitPostfixTypeOperand(operand *ast.TypeNode, parent *ast.Node) {
1992 if ast.IsParseTreeNode(parent) && operand.Kind == ast.KindTypeQuery {
1993 p.emitTypeNode(operand, ast.TypePrecedenceTypeOperator)
1994 return
1995 }
1996 p.emitTypeNode(operand, ast.TypePrecedencePostfix)
1997}
1998
1999func (p *Printer) emitTupleElementType(node *ast.Node) {
2000 p.emitTypeNodeOutsideExtends(node)

Callers 3

emitArrayTypeMethod · 0.95
emitOptionalTypeMethod · 0.95
emitIndexedAccessTypeMethod · 0.95

Calls 2

emitTypeNodeMethod · 0.95
IsParseTreeNodeFunction · 0.92

Tested by

no test coverage detected