mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

Core: strip away types for JS Output

Open samijaber opened this issue 3 years ago • 1 comments

As per #511, we want to support 2 approaches:

  • allow mitosis build to output plain JS files
  • allow mitosis build to output TS files

As part of getting TS support working, we started adding type outputs to various generators. Our generated code is somewhat in-between plain JS and TS, depending on the generator.

Currently, the MitosisComponent JSON generated by our JSX parser holds on to type information in all code blocks. To successfully implement a "js-only" mode, we'd need to:

  • make sure that interfaces/types are not injected
  • run every code block through a babel/esbuild transform that strips away any typescript code

samijaber avatar Aug 31 '22 13:08 samijaber

yeah this is a good idea. in the generators the code would be simpler if we knew the output should be js or ts. I don't think Mitosis needs to generate the .d.ts for now and rely on the typescript compiler to figure that out

PatrickJS avatar Sep 13 '22 18:09 PatrickJS