Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: null does not match type Pattern when scanning scope of optional catch #586

Closed
j4k0xb opened this issue Apr 19, 2024 · 0 comments
Closed

Comments

@j4k0xb
Copy link

j4k0xb commented Apr 19, 2024

Reproduction: https://stackblitz.com/edit/stackblitz-starters-btzbm6?file=index.js

const j = require('jscodeshift');

j(`try {} catch (e) { i }`)
  .find(j.Identifier)
  .forEach((p) => {
    p.scope.lookup(p.name); // works
  });

console.log('1');

j(`try {} catch { i }`)
  .find(j.Identifier)
  .forEach((p) => {
    p.scope.lookup(p.name); // errors
  });

console.log('2');
Error: null does not match type Pattern
    at BaseType.assert (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/types.js:15:19)
    at addPattern (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/scope.js:256:28)
    at scanScope (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/scope.js:136:17)
    at Sp.scan (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/scope.js:109:13)
    at Sp.declares (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/scope.js:63:14)
    at Sp.lookup (/home/projects/stackblitz-starters-btzbm6/node_modules/ast-types/lib/scope.js:337:23)
    at NodePath.eval (/home/projects/stackblitz-starters-btzbm6/index.js:14:13)
    at eval (/home/projects/stackblitz-starters-btzbm6/node_modules/jscodeshift/src/Collection.js:75:36)
    at Collection.forEach (/home/projects/stackblitz-starters-btzbm6/node_modules/jscodeshift/src/Collection.js:74:18)

nvm its a duplicate: benjamn/ast-types#944

@j4k0xb j4k0xb closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant