How to use the forEachChild function from typescript
Find comprehensive JavaScript typescript.forEachChild code examples handpicked from public code repositorys.
475 476 477 478 479 480 481 482 483 484var isOptions = curClass.name.indexOf("IOn") === 0; if (!isOptions) { outputClasses.push(curClass); } curJsonName = null; ts.forEachChild(node, visitClassNode); if (isOptions) return; if (!curJsonName) return;
+ 35 other calls in file
154 155 156 157 158 159 160 161 162 163const dependencies = []; const sourceFile = program.getSourceFile(filePath); if (sourceFile) { ts.forEachChild(sourceFile, (node) => { if ( ts.isImportDeclaration(node) || ts.isExportDeclaration(node) || ts.isImportEqualsDeclaration(node) ||
+ 18 other calls in file
115 116 117 118 119 120 121 122 123 124break; } case ts.SyntaxKind.VariableDeclaration: _this.checkVariableDeclaration(node); } return ts.forEachChild(node, cb); }; return ts.forEachChild(sourceFile, cb); }; TypedefWalker.prototype.checkArrowFunction = function (_a) {
+ 5 other calls in file
104 105 106 107 108 109 110 111 112 113return ruleArguments.indexOf(name) !== -1; } } function walk(ctx) { var options = ctx.options, sourceFile = ctx.sourceFile; return ts.forEachChild(sourceFile, function cb(node) { switch (node.kind) { case ts.SyntaxKind.BindingElement: { var _a = node, initializer = _a.initializer, name = _a.name, propertyName = _a.propertyName; if (name.kind === ts.SyntaxKind.Identifier) {
+ 5 other calls in file
65 66 67 68 69 70 71 72 73 74!functionBlockHasAwait(node.body) && !functionBlockHasReturn(node.body)) { reportFailureIfAsyncFunction(node); } }; return ts.forEachChild(context.sourceFile, function visitNode(node) { if (tsutils.isArrowFunction(node) || tsutils.isFunctionDeclaration(node) || tsutils.isFunctionExpression(node) || tsutils.isMethodDeclaration(node)) {
+ 1021 other calls in file
257 258 259 260 261 262 263 264 265 266this.checkContextualType(node.expression)); } if (tsutils_1.isTypeNodeKind(node.kind) || tsutils_1.isTokenKind(node.kind)) { return false; } return ts.forEachChild(node, this.visitNodeCallback); }; NoUnsafeAnyWalker.prototype.check = function (node) { if (!isNodeAny(node, this.checker)) { return false;
+ 525 other calls in file
57 58 59 60 61 62 63 64 65 66hasChildCall(node.expression)) { _this.addFailure(node.expression.name.pos - 1, node.expression.name.end, Rule.FAILURE_STRING); } return ts.forEachChild(node, checkForSameLine); }; return ts.forEachChild(sourceFile, checkForSameLine); }; return NewlinePerChainedCallWalker; }(Lint.AbstractWalker)); function hasChildCall(node) {
+ 1795 other calls in file
42 43 44 45 46 47 48 49 50 51Rule.FAILURE_STRING = "Parentheses are required when invoking a constructor"; return Rule; }(Lint.Rules.AbstractRule)); exports.Rule = Rule; function walk(ctx) { return ts.forEachChild(ctx.sourceFile, function cb(node) { if (node.kind === ts.SyntaxKind.NewExpression && node.arguments === undefined) { ctx.addFailureAtNode(node, Rule.FAILURE_STRING); }
+ 1833 other calls in file
215 216 217 218 219 220 221 222 223 224// prettier-ignore if (ignoredBarrelModules.includes(OsPaths.normalize(importedModule.fileName))) return; let containsReExport = false; ts.forEachChild(importedModule, (child) => { const potentialReExport = ts.isExportDeclaration(child) && child.moduleSpecifier !== undefined && !child.isTypeOnly;
+ 19 other calls in file
67 68 69 70 71 72 73 74 75 76var sourceFile = ctx.sourceFile, options = ctx.options; ts.forEachChild(sourceFile, function cb(node) { if (tsutils_1.isTypeLiteralNode(node)) { check(node); } ts.forEachChild(node, cb); }); function check(node) { node.members.forEach(function (member, idx) { var end = member.end - 1;
125 126 127 128 129 130 131 132} else { ts.forEachChild(node, callback); } }; return ts.forEachChild(context.sourceFile, callback); } var templateObject_1, templateObject_2;
+ 199 other calls in file
47 48 49 50 51 52 53 54 55 56return Rule; }(Lint.Rules.TypedRule)); exports.Rule = Rule; function walk(ctx, checker) { var namespacesInScope = []; ts.forEachChild(ctx.sourceFile, cb); function cb(node) { switch (node.kind) { case ts.SyntaxKind.ModuleDeclaration: case ts.SyntaxKind.EnumDeclaration:
+ 1043 other calls in file
150 151 152 153 154 155 156 157 158} return ts.forEachChild(node, cb) } return ts.forEachChild(ctx.sourceFile, cb) }
+ 2193 other calls in file
47 48 49 50 51 52 53 54 55 56const importPaths = extractImportPaths(sourceFile); await addLinks(box, importPaths); } function extractImportPaths(sourceFile) { const importPaths = []; ts.forEachChild(sourceFile, node => { if (ts.isImportDeclaration(node)) { let importPath = node.moduleSpecifier.getText(sourceFile); importPaths.push(importPath); }
+ 3 other calls in file
44 45 46 47 48 49 50 51 52 53Rule.FAILURE_STRING = "Literal expression should be on the right-hand side of a binary expression."; return Rule; }(Lint.Rules.AbstractRule)); exports.Rule = Rule; function walk(ctx) { ts.forEachChild(ctx.sourceFile, function cb(node) { if (tsutils_1.isBinaryExpression(node) && isLiteral(node.left) && !isLiteral(node.right) && !isAllowedOrderedOperator(node)) {
77 78 79 80 81 82 83 84 85 86]); } } return ts.forEachChild(node, cb); } return ts.forEachChild(ctx.sourceFile, cb); } function parensAreOptional(node) { return (node.parameters.length === 1 && node.typeParameters === undefined &&
256 257 258 259 260 261 262 263 264 265exports.Rule = Rule; var modifierAliases = { export: "exported", }; function walk(context) { return ts.forEachChild(context.sourceFile, cb); function cb(node) { switch (node.kind) { case ts.SyntaxKind.ClassDeclaration: checkNode(node, exports.ARGUMENT_CLASSES);
213 214 215 216 217 218 219 220 221 222}; var walk = function (walkContext) { var sourceFile = walkContext.sourceFile; var callback = function (node) { callbackHandler(walkContext, node); typescript_1.forEachChild(node, callback); }; typescript_1.forEachChild(sourceFile, callback); }; var templateObject_1;
80 81 82 83 84 85 86 87var sourceFile = walkContext.sourceFile; var callback = function (node) { callbackHandler(walkContext, node); typescript_1.forEachChild(node, callback); }; typescript_1.forEachChild(sourceFile, callback); }; var templateObject_1;
80 81 82 83 84 85 86var _a; if (((_a = node.decorators) === null || _a === void 0 ? void 0 : _a.length) === 0) { // tslint:disable-next-line:no-any node.decorators = undefined; } ts.forEachChild(node, node => cleanupDecorators(node)); }
typescript.SyntaxKind is the most popular function in typescript (82777 examples)