fkling / fkling/astexplorer

jscodeshift + typescript parser do not match or have the same AST

Open
#628 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.5k
Forks
772
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
This came out of trying to force jscodeshift to work with property decorators somehow.
The gist is that when selecting typescript for the AST debugger (top half), and setting `ts` to the parser to jscodeshift, the AST doesn't match.

For example, properties in the top half are called `PropertyDeclaration`s, yet when you `.find(j.PropertyDeclaration)`, nothing is found in jscodeshift.

**To Reproduce**
https://astexplorer.net/#/gist/a8ffcb056b86f73e6b23bd8a8b08e69e/094a53e0abbfb27ae0e4ceae6577e01776584fdb
open console to see that properties and methods are not found

**Expected behavior**
I feel like certain combinations of parsers / transformers shouldn't be allowed? maybe/

**Browser (please complete the following information):**
n/a

**astexplorer settings:**
- Selected parser: typescript
- Selected transformer (if applicable): jscodeshift + `ts` setting
```
// jscodeshift can take a parser, like "babel", "babylon", "flow", "ts", or "tsx"
// Read more: https://github.com/facebook/jscodeshift#parser
export const parser = 'ts'
```

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.