You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CSF support (#1497) is being implemented as part of switching internals to Mdx (#1712) in #1720.
This issue is my quick research on how to support TypeScript and ECMAScript Next (optional chaining and that kind of stuff) in CSF files.
Here are the options I can think of so far:
Acorn (current option but updated to the latest version): solves ECMAScript Next but no TS support.
Sucrase + Acorn: nope, Sucrase supports TS but transpiles too much (JSX and new syntax, for example), so we can't use its output in the examples.
Acorn-loose: it's parsing the code but the AST is all wrong.
Babel (I haven’t tried it yet): should be the most bulletproof way but we’ll need to migrate all the code to it, and we use Acorn on the client because of its small size and probably should continue doing so.
The last option seems to be the only solution.
The text was updated successfully, but these errors were encountered:
@babel/parser works too but we need to enable typescript plugin (and disable flow plugin since they don't work together). I don't think we need data about types in the AST but @babel/parser has that too.
😴 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Consider opening a pull request if you still have this issue or want this feature.
CSF support (#1497) is being implemented as part of switching internals to Mdx (#1712) in #1720.
This issue is my quick research on how to support TypeScript and ECMAScript Next (optional chaining and that kind of stuff) in CSF files.
Here are the options I can think of so far:
The last option seems to be the only solution.
The text was updated successfully, but these errors were encountered: