How to use the updateSourceFileNode function from typescript
Find comprehensive JavaScript typescript.updateSourceFileNode code examples handpicked from public code repositorys.
387 388 389 390 391 392 393 394 395 396
!(isGlobal && hoistedStatements.some(s => s.modifiers && s.modifiers.some(m => m.kind === ts.SyntaxKind.ExportKeyword))) // Or if there is a `declare global` statement || !!augmentations ); return ts.updateSourceFileNode(node, [ // Put the hoisted statements at the top (or all of them if there's no top level await) ...hoistedStatements, // Then add everything that augments the global scope ...(augmentations && augmentations.length ? [wrapInDeclareGlobal(augmentations)] : []),
116
294
29
+ 3 other calls in file
27 28 29 30 31 32 33 34 35 36
return sourceFile; } const updatedSourceFile = ts.visitNode(sourceFile, visitNode); if (resourceImportDeclarations.length) { // Add resource imports return ts.updateSourceFileNode(updatedSourceFile, ts.setTextRange(ts.createNodeArray([ ...resourceImportDeclarations, ...updatedSourceFile.statements, ]), updatedSourceFile.statements)); }
0
0
1
18 19 20 21 22 23 24 25 26 27
} function getWrapEnumsTransformer() { return (context) => { const transformer = sf => { const result = visitBlockStatements(sf.statements, context); return ts.updateSourceFileNode(sf, ts.setTextRange(result, sf.statements)); }; return transformer; }; }
0
0
1
typescript.SyntaxKind is the most popular function in typescript (82777 examples)