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: Getting compile time error with generated react output from Stencil Component #472

Open
3 tasks done
ranjanakash166 opened this issue Sep 6, 2024 · 5 comments
Open
3 tasks done
Labels
help wanted a good issue for the community type: bug Something isn't working

Comments

@ranjanakash166
Copy link

Prerequisites

Stencil Version

4.20.0

Stencil Framework Output Target

React

Stencil Framework Output Target Version

0.5.3

Current Behavior

when generated react output from Stencil is compiled then we get an error

Implementation:
import { Config } from '@stencil/core';
import { reactOutputTarget } from '@stencil/react-output-target';

export const config: Config = {
namespace: 'demo',
{ type: 'dist-hydrate-script' },
outputTargets: [
reactOutputTarget({
componentCorePackage: pkg. name,
proxiesFile: '../packages/react-components/src/components.ts',
includeDefineCustomElements: true,
}),
{
type: 'dist',
esmLoaderPath: '../loader',
},
],
};

Error:
src/react-component-lib/createOverlayComponent.tsx(140,13): error TS2322: Type 'PropsWithoutRef & { forwardedRef: ForwardedRef; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.

Type 'PropsWithoutRef & { forwardedRef: ForwardedRef; }' is not assignable to type 'Readonly'.

src/react-component-lib/utils/index.tsx(40,27): error TS2345: Argument of type '{ (props: StencilReactExternalProps<PropType, ElementType>, ref: StencilReactForwardedRef): React.JSX.Element; displayName: string; }' is not assignable to parameter of type 'ForwardRefRenderFunction<ElementType, PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>>>'.

Types of parameters 'props' and 'props' are incompatible.
Type 'PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>>' is not assignable to type 'StencilReactExternalProps<PropType, ElementType>'.
Type 'Omit<HTMLAttributes, "style"> & StyleReactProps' is not assignable to type 'StencilReactExternalProps<PropType, ElementType>'.
Type 'Omit<HTMLAttributes, "style"> & StyleReactProps' is not assignable to type 'PropType'.
PropType' could be instantiated with an arbitrary type which could be unrelated to 'Omit<HTMLAttributes, "style"> & StyleReactProps'.

Expected Behavior

There should not be any compile time error when generated react (typescript) code is compiled

Steps to Reproduce

The generated wrapper for React generated from @stencil/react-output-target is giving compile time error while compiling in typescript

Code Reproduction URL

https://codesandbox.io/p/devbox/stencil-example-forked-m77dwl?workspaceId=64835305-1189-4848-9da8-81051e0ecc3d

Additional Information

Trying to create exact scenario as codebase the typescript version tried so far are 4.9.5 and 5.4.2

@ionitron-bot ionitron-bot bot added the triage label Sep 6, 2024
Copy link

ionitron-bot bot commented Sep 6, 2024

Thanks for the issue!

This project is currently maintained for the purposes of supporting Ionic Framework. At this time, only new issues & pull requests that support Ionic Framework will be prioritized. For the latest updates regarding the maintenance status of this project, please see this section of the project's README

@ranjanakash166 ranjanakash166 changed the title bug: bug: Getting compile time error with generated react output from Stencil Component Sep 6, 2024
@artursopelnik
Copy link

artursopelnik commented Oct 2, 2024

@christian-bromann christian-bromann added type: bug Something isn't working help wanted a good issue for the community and removed triage labels Oct 14, 2024
Copy link

ionitron-bot bot commented Oct 14, 2024

This issue has been labeled as help wanted. This label is added to issues that we believe would be good for contributors.

If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
Thank you!

@imndaiga
Copy link

+1 our current stencilJS component library build breaks with this error too. Seems like a breaking api change that should have been gated for the 5.0 release.

@dgibson666
Copy link

+1. I upgraded Stencil to 4.22 (from 4.15) and got this. My react output target package was way behind, so I updated it and no change. Does anyone know where/when the breakage occurred? Are Stencil projects who use the react output target essentially stuck on a specific version because of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted a good issue for the community type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants