Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] (type-safe-api) src/apis/DefaultApiClientProvider.tsx(37,36): error TS2503: Cannot find namespace 'JSX' #895

Closed
cogwirrel opened this issue Dec 18, 2024 · 0 comments · Fixed by #898
Labels
bug Something isn't working needs-triage

Comments

@cogwirrel
Copy link
Member

Describe the bug

Generated typescript hooks library fails to compile

src/apis/DefaultApiClientProvider.tsx(37,36): error TS2503: Cannot find namespace 'JSX'

Expected Behavior

Should compile

Current Behavior

Fails to compile

Reproduction Steps

Follow getting started guide https://aws.github.io/aws-pdk/getting_started/your_first_aws_pdk_project.html#creating-our-aws-infrastructure

Possible Solution

React 19 was released recently and the hooks library doesn't pin the version. React 19 removes the global JSX namespace: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript

We can either pin to react 18 or investigate if React.JSX works in both 18 and 19.

Additional Information/Context

Current workaround in pin react at version 18 in your .projenrc.ts:

api.library.typescriptReactQueryHooks!.addPeerDeps("react@^18");
api.library.typescriptReactQueryHooks!.addDevDeps("@types/react@^18");

PDK version used

0.25.14

What languages are you seeing this issue on?

Typescript

Environment details (OS name and version, etc.)

osx

@cogwirrel cogwirrel added bug Something isn't working needs-triage labels Dec 18, 2024
cogwirrel added a commit that referenced this issue Dec 19, 2024
React 19 removes the global JSX namespace - replace with React.JSX which works with both React 19
and 18. Additionally address type error with new versions of react-router-dom's `navigate` function
returning a promise.

Fixes #895
Fixes #896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant