when installing the package @aws-cdk/cdk, there is also a JSX file exported, which contains the type definition:
declare global {
namespace JSX {
/**
* Declare JSX.Element to be the lazy specification of a Construct
*/
interface Element {
type: ConstructConstructor
props: any
children: JSX.Element[]
}
interface ElementAttributesProperty {
jsxProps: any
}
interface IntrinsicAttributes {
id: string
}
}
}
this breaks all *.tsx files containing react components, like simple renderToString(<div />). I assume this is because the global namespace declaration above replaces react's types completely. This means I can not use this package in any app that uses both, aws-cdk and react. Is there any workaround to make things work again? In my tsconfig.json there is "jsx": "react" already set with no effect.
I am okay with removing our JSX support. It was an old experiment and eventually doesn't seem like something people desire, especially given Applets. @RomainMuller @rix0rrr what do you think?
Having said that, @Anonyfox, I am curious about your use case to mix React and CDK code in the same package...
I'm okay scrapping it.
I'm okay scrapping as well.
Thanks for the fast responses! :)
@eladb i am building a express.js app which does SSR on react pages and is running on AWS lambda via serverless-http. Call it isomorphic web app if you like, plus it must be able to bootstrap itself from github (codepipeline/codebuild).
Most helpful comment
I am okay with removing our JSX support. It was an old experiment and eventually doesn't seem like something people desire, especially given Applets. @RomainMuller @rix0rrr what do you think?
Having said that, @Anonyfox, I am curious about your use case to mix React and CDK code in the same package...