Describe the bug
Hi,
getChildrenOfKind returns nothing for SyntaxKind.StringLiteral because useParseTreeSearchForKind returns false which should be true.
Version: 25.0.1
To Reproduce
import { Project, SyntaxKind } from 'ts-morph';
const src = '["abc", "def"];';
const project = new Project();
const source = project.createSourceFile('dummy.js', src);
for (const es of source.getChildrenOfKind(SyntaxKind.ExpressionStatement)) {
for (const ale of es.getChildrenOfKind(SyntaxKind.ArrayLiteralExpression)) {
for (const sl of ale.getChildrenOfKind(SyntaxKind.StringLiteral)) {
console.log(sl); // not found
}
for (const sl of ale._getCompilerForEachChildren().filter((c) => c.kind === SyntaxKind.StringLiteral)) {
console.log(sl); // found
}
}
}
Expected behavior
getChildrenOfKind returns the children of StringLiteral.
Describe the bug
Hi,
getChildrenOfKindreturns nothing forSyntaxKind.StringLiteralbecauseuseParseTreeSearchForKindreturnsfalsewhich should betrue.Version: 25.0.1
To Reproduce
Expected behavior
getChildrenOfKindreturns the children ofStringLiteral.