Skip to content

Fix project-wide JSX type errors#88

Open
yumin-chen wants to merge 1 commit into
mainfrom
fix-jsx-types-15557381483055699204
Open

Fix project-wide JSX type errors#88
yumin-chen wants to merge 1 commit into
mainfrom
fix-jsx-types-15557381483055699204

Conversation

@yumin-chen

Copy link
Copy Markdown

I have fixed the project-wide JSX type errors by adding a global JSX namespace definition to types/perry/ui/index.d.ts.

When developers use .tsx files with the Perry compiler, tsc expects a global JSX.Element type to be defined. Since Perry's native type stubs lacked this definition, tsc would report errors even if the build (using esbuild) succeeded.

The fix:

  1. Updated types/perry/ui/index.d.ts: Added a declare global block containing the JSX namespace.
  2. Mapped JSX.Element to Widget: This tells TypeScript that JSX expressions evaluate to Perry's native widget handles.
  3. Defined IntrinsicElements: Added a string indexer to allow any tag name, which is necessary for Perry's component model where constructors like <VStack> are used directly.
  4. Added standard attributes: Included IntrinsicAttributes and IntrinsicClassAttributes to support standard props like key and ref.

I verified the fix by creating a test .tsx file and running tsc with a configuration that uses the modified Perry types. All JSX-related namespace errors were resolved. I also ran existing perry-hir tests to ensure no regressions in the compiler's lowering logic.


PR created automatically by Jules for task 15557381483055699204 started by @yumin-chen

Adds a global JSX namespace definition to types/perry/ui/index.d.ts.
This resolves project-wide TypeScript errors where tsc reports that
'JSX' has no exported member 'Element' when using .tsx files.

- Maps JSX.Element to the Widget type.
- Adds IntrinsicElements catch-all for flexible tag names.
- Adds IntrinsicAttributes and IntrinsicClassAttributes for standard props.

Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant