How to use the updateVariableStatement function from typescript

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

208
209
210
211
212
213
214
215
216
217
} else {
    return s;
}

if (ts.isVariableStatement(s)) {
    return ts.updateVariableStatement(s, modifiers, s.declarationList);
} else if (ts.isTypeAliasDeclaration(s)) {
    return ts.updateTypeAliasDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.type);
} else if (ts.isInterfaceDeclaration(s)) {
    return ts.updateInterfaceDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
fork icon116
star icon294
watch icon29

+ 3 other calls in file

290
291
292
293
294
295
296
297
298
299
    }
    return [updateHostNode(hostNode, value)];
}
function createWrappedEnum(name, hostNode, statements, literalInitializer = ts.createObjectLiteral(), addExportModifier = false) {
    const node = addExportModifier
        ? ts.updateVariableStatement(hostNode, [ts.createToken(ts.SyntaxKind.ExportKeyword)], hostNode.declarationList)
        : hostNode;
    const innerVarStmt = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
        ts.createVariableDeclaration(name, undefined, literalInitializer),
    ]));
fork icon0
star icon0
watch icon1

+ 3 other calls in file

42
43
44
45
46
47
48
49
50
51
// Add pure comment to downleveled classes.
if (ts.isVariableStatement(node) && isDownleveledClass(node)) {
    const varDecl = node.declarationList.declarations[0];
    const varInitializer = varDecl.initializer;
    // Update node with the pure comment before the variable declaration initializer.
    const newNode = ts.updateVariableStatement(node, node.modifiers, ts.updateVariableDeclarationList(node.declarationList, [
        ts.updateVariableDeclaration(varDecl, varDecl.name, varDecl.type, ast_utils_1.addPureComment(varInitializer)),
    ]));
    // Replace node with modified one.
    return ts.visitEachChild(newNode, visitor, context);
fork icon0
star icon0
watch icon1

Other functions in typescript

Sorted by popularity

function icon

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