MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getNodeDebugDescription

Function getNodeDebugDescription

compiler/companion/src/TSUtils.ts:350–362  ·  view source on GitHub ↗
(node: ts.Node)

Source from the content-addressed store, hash-verified

348const MAX_NODE_DEBUG_LENGTH = 50;
349
350export function getNodeDebugDescription(node: ts.Node): string {
351 const sourceFile = node.getSourceFile();
352 const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());
353
354 let text = node.getText();
355 if (text.length > MAX_NODE_DEBUG_LENGTH) {
356 text = text.substr(0, MAX_NODE_DEBUG_LENGTH);
357 }
358
359 return `(node kind ${getSyntaxKindString(node.kind)}, content '${text}') at ${sourceFile.fileName}:${
360 position.line + 1
361 }:${position.character + 1}`;
362}
363
364export function resolveTypeOfExpression(expression: ts.Expression, typeChecker: ts.TypeChecker): ResolvedType {
365 let effectiveType: SymbolType | undefined;

Callers 4

resolveTypeReferenceFunction · 0.90
parseTypeFromSymbolGroupFunction · 0.90
parseTypeFunction · 0.90
parsePropertyLikeFunction · 0.90

Calls 4

getSyntaxKindStringFunction · 0.85
substrMethod · 0.80
getTextMethod · 0.65
getSourceFileMethod · 0.45

Tested by

no test coverage detected