fix: support @knighted/jsx type-only imports in DOM mode. - #39
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the DOM render/typecheck pipeline to handle import type from @knighted/jsx without causing either TypeScript “module not found” diagnostics or runtime export {} syntax errors when code is executed via new Function(...).
Changes:
- Add an ambient
declare module '@knighted/jsx'to the DOM-mode JSX type stubs so type-only imports resolve during diagnostics. - Sanitize transpiled runtime code by stripping empty
export {}statements before executing it in the Function-based runtime. - Add Playwright coverage for both DOM-mode rendering and DOM-mode typechecking with
@knighted/jsxtype-only imports.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/modules/type-diagnostics.js |
Adds an ambient @knighted/jsx module declaration and wires JSX.Element / children typing through it for DOM-mode diagnostics. |
src/modules/render-runtime.js |
Strips empty export {} statements from transpiled code to avoid Function-runtime syntax errors. |
playwright/rendering-modes.spec.ts |
Adds a DOM-mode runtime regression test for import type (ensures no preview error output + content renders). |
playwright/diagnostics.spec.ts |
Adds a DOM-mode typecheck regression test ensuring @knighted/jsx type-only imports resolve cleanly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.