diff --git a/bun.lockb b/bun.lockb index 29e5c7d..e4d23a2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index c9c8001..193644b 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@tscircuit/3d-viewer": "^0.0.32", "@tscircuit/pcb-viewer": "^1.10.5", "@types/ms": "^0.7.34", + "@typescript/ata": "^0.9.7", "@valtown/codemirror-ts": "^2.2.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", diff --git a/src/components/CodeEditor.tsx b/src/components/CodeEditor.tsx index 2c0366e..f407ff6 100644 --- a/src/components/CodeEditor.tsx +++ b/src/components/CodeEditor.tsx @@ -33,19 +33,44 @@ export const CodeEditor = ({ if (!editorRef.current) return const fsMap = new Map() - fsMap.set("index.ts", code) + fsMap.set("index.tsx", code) + + // fsMap.set( + // "tscircuit-core.d.ts", + // ` + + // declare global { + // namespace JSX { + // interface IntrinsicElements { + // board: any + // } + // } + // } + + // `.trim(), + // ) const system = createSystem(fsMap) - const env = createVirtualTypeScriptEnvironment(system, [], ts, {}) + const env = createVirtualTypeScriptEnvironment(system, [], ts, { + jsx: ts.JsxEmit.ReactJSX, + // jsxFactory: "React.createElement", + }) + + // const program = ts.createProgram({ + // rootNames: ["index.tsx"], + // options: { + // jsx: ts.JsxEmit.ReactJSX, + // }, + // }) - const path = "index.ts" + // program.emit() const state = EditorState.create({ doc: code, extensions: [ basicSetup, javascript({ typescript: true, jsx: true }), - tsFacet.of({ env, path }), + tsFacet.of({ env, path: "index.tsx" }), tsSync(), tsLinter(), autocompletion({ override: [tsAutocomplete()] }),