mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

Fiddle: add TS Support

Open samijaber opened this issue 2 years ago • 1 comments

Our Fiddle still does not support TS, even though Mitosis itself knows how to handle it!

image

This is weird because we set language="typescript":

https://github.com/BuilderIO/mitosis/blob/7bc921c4ef53fdaf1b902618aab34f8398c1ad93/packages/fiddle/src/components/Fiddle.tsx#L800 https://github.com/BuilderIO/mitosis/blob/7bc921c4ef53fdaf1b902618aab34f8398c1ad93/packages/fiddle/src/components/CodeEditor.tsx#L146

Not sure where the bug is, but would be neat to get type coverage in the fiddle!

samijaber avatar Jun 30 '22 00:06 samijaber

Ideas from other issue:

https://github.com/BuilderIO/mitosis/issues/183#issuecomment-1050129752

samijaber avatar Jul 21 '22 20:07 samijaber

Passing path="mitosis-file.tsx" as a prop to <MonacoEditor might bring us one step closer.

Screenshot 2022-08-19 at 16 02 16

Getting other errors now though Screenshot 2022-08-19 at 15 42 26

Screenshot 2022-08-19 at 15 41 28 Screenshot 2022-08-19 at 16 01 02

.

Missing types.

raymondmuller avatar Aug 19 '22 14:08 raymondmuller

My thoughts:

  • From my NextJS memories, we'd have to add the raw-loader config to nextjs's webpack config to extend it and from there try to do the raw-loader import

  • alternatively, looks like the string might be able to be a relative path to the node modules as well: https://stackoverflow.com/questions/43058191/how-to-use-addextralib-in-monaco-with-an-external-type-definition

  • also since we have @builder.io imports 🤔, we might need to update to a new version of Monaco Editor if ours is before this fix was pushed https://github.com/microsoft/monaco-editor/issues/2295

samijaber avatar Aug 19 '22 14:08 samijaber

That seems to work :)

raymondmuller avatar Aug 25 '22 21:08 raymondmuller

Closed by #673!

samijaber avatar Aug 29 '22 16:08 samijaber