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

[Feature]: Support for React 19 #33482

Open
1 task done
electrocnic opened this issue Dec 17, 2024 · 2 comments
Open
1 task done

[Feature]: Support for React 19 #33482

electrocnic opened this issue Dec 17, 2024 · 2 comments
Labels
Fluent UI react-components (v9) Needs: PM Incoming shield issues that are feature type which require PM to review. React 19 Type: Feature

Comments

@electrocnic
Copy link

Area

React Components (@fluentui/react-components)

Describe the feature that you would like added

Please add support for React versions >= 19.0.0 for react-components.

We want to upgrade to react 19 and this library still has < 19.0.0 in its package.json.
React 19 is out for over half a year already.

Thank you so much!

Additional context

No response

Have you discussed this feature with our team

No response

Validations

  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Priority

None

@layershifter layershifter added Needs: PM Incoming shield issues that are feature type which require PM to review. React 19 and removed Needs: Triage 🔍 labels Dec 17, 2024
@layershifter
Copy link
Member

FYI it's not only about relaxing peerDependencies. There is a set of issues related to React 19 (use a tag to filter).

@electrocnic
Copy link
Author

electrocnic commented Dec 18, 2024

FYI it's not only about relaxing peerDependencies. There is a set of issues related to React 19 (use a tag to filter).

Got it.

Maybe I should open a new issue for that, but for now I first want to understand these symptoms, because maybe it is not necessary to open a new issue:

Once I update my @types/react package from 18.3.17 to 19.0.1 I can no longer use fluentUi's Components with automatic type inference:

Image
Image
(Parameter '_ev' implicitly has an 'any' type.)

As you can see, the Component will automatically resolve to <any> and all callback parameters will also resolve to any, even tho they are defined as

export declare const TagGroup: ForwardRefComponent<TagGroupProps>;
export declare type TagValue = string;
export declare type TagGroupProps<Value = TagValue> = ComponentProps<TagGroupSlots> & {
    onDismiss?: TagDismissHandler<Value>;
    ...
}

when I control+click into them.

Here is the correct resolution of the types in the previous version (18.3.17) of @types/react:
(And I know that the types for fluentUi should not come from this package but are already included in fluentUi, right?)

Image
Image

Do you know why this happens, or how I could possibly workaround this issue?

Or should I remain on React 18 for the time being and not upgrade to React 19 at all for now?

Thanks in advance.

EDIT: On a second glance, this might be related to the now deprecated forwardRef from React 19, and if this was removed in the types as well, it could explain why the type inference does not work any longer if fluentUi's current version still uses forwardRefs (as is visible in my screenshots above)?

@layershifter layershifter marked this as a duplicate of #33485 Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-components (v9) Needs: PM Incoming shield issues that are feature type which require PM to review. React 19 Type: Feature
Projects
None yet
Development

No branches or pull requests

2 participants