How to use the visitNodes function from typescript

Find comprehensive JavaScript typescript.visitNodes code examples handpicked from public code repositorys.

370
371
372
373
374
375
376
377
378
379
const wrappedStatements = hasTLA ? nonAugmentations.filter(s => !mustBeHoisted(s, isGlobal)) : [];

// When transforming global scripts, we need to do a couple of things
if (isGlobal) {
    // 1. We need to add an export modifier to everything on the top level that can be exported
    hoistedStatements = ts.visitNodes(
        hoistedStatements,
        // @ts-expect-error s is definitely a statement
        s => canBeExported(s) ? addExportModifier(s) : s,
    );
fork icon116
star icon294
watch icon29

13
14
15
16
17
18
19
20
21
22
const typeChecker = getTypeChecker();
const resourceImportDeclarations = [];
const moduleKind = context.getCompilerOptions().module;
const visitNode = (node) => {
    if (ts.isClassDeclaration(node)) {
        const decorators = ts.visitNodes(node.decorators, node => ts.isDecorator(node)
            ? visitDecorator(node, typeChecker, directTemplateLoading, resourceImportDeclarations, moduleKind)
            : node);
        return ts.updateClassDeclaration(node, decorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses, node.members);
    }
fork icon0
star icon0
watch icon1

+ 5 other calls in file

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)