Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (TypeScriptESTree) {
// Extend `walk` to skip over most TS-specific nodes.
for (const type of Object.keys(TypeScriptESTree.AST_NODE_TYPES)) {
// Ensure `value` of `ClassProperty` instances is walked.
if (type === 'ClassProperty') {
base[type] = (node: any, st: any, c: any) => {
if (node.value) {
c(node.value, st);
}
};
}
// Just ignore anything else
if (!base[type]) {
base[type] = base.Identifier;
}
}
}
export default class TypeScriptParser extends Parser {
public constructor(engine: Engine) {
super(engine, 'typescript');
engine.on('fetch::end::unknown', async ({ resource, response }) => {
if (!resource.endsWith('.ts') && !resource.endsWith('.tsx')) {
return;
}
if (!TypeScriptESTree) {
return;