Skip to content

[Bug]: fluentui/react-component types break with TS exactOptionalPropertyTypes #25993

Closed

Description

@JasonGore

Library

React Components / v9 (@fluentui/react-components)

System Info

CodeSandbox (link provided)

Are you reporting Accessibility issue?

no

Reproduction

https://codesandbox.io/s/exactoptionalpropertytypes-y22yr1?file=/src/index.tsx

Bug Description

Actual Behavior

Using exactOptionalPropertyTypes breaks fluentui component types with error TS2604: JSX element type 'Button' does not have any construct or call signatures. errors. It appears to be because this type resolves to never:

export declare type ForwardRefComponent<Props> = ObscureEventName extends keyof Props ? Required<Props>[ObscureEventName] extends React_2.PointerEventHandler<infer Element> ? React_2.ForwardRefExoticComponent<Props & React_2.RefAttributes<Element>> : never : never;

From CodeSandbox:

image

If you change exactOptionalPropertyTypes to false in this CodeSandbox and reload, it will resolve the type error.

Expected Behavior

Can render fluentui components with exactOptionalPropertyTypes enabled. This issue is preventing us from adopting exactOptionalPropertyTypes for improved typing.

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no (this type is pretty core to fluentui and I wouldn't want to break other uses, but I'm willing to try and help narrow this as a fluentui vs. TS issue, if needed)

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

  1. changed the title [-][Bug]: fluentui component types break with TS exactOptionalPropertyTypes[/-] [+][Bug]: fluentui/react-component types break with TS exactOptionalPropertyTypes[/+] on Dec 14, 2022
  2. MatthewSkingley commented on Jan 13, 2023

    @MatthewSkingley

    This issue, specifically JSX element type ... does not have any construct or call signatures is present in my project without exactOptionalPropertyTypes with react-components version 9.9.1. I locked my dependency to 9.6.1 where the issue is not present. In both configurations, react-utilities is at version 9.4.0.

  3. msft-fluent-ui-bot commented on Jun 23, 2023

    @msft-fluent-ui-bot

    Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

    Still require assistance? Please, create a new issue with up-to date details.

  4. added
    Resolution: Soft Close
    on Jun 23, 2023
  5. yuhr commented on Jun 24, 2023

    @yuhr

    Can't use this library due to this problem.

  6. removed
    Resolution: Soft Close
    on Jun 26, 2023
  7. dahagag commented on Aug 15, 2023

    @dahagag

    Same

  8. microsoft-github-policy-service commented on Jan 12, 2024

    @microsoft-github-policy-service

    Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

    Still require assistance? Please, create a new issue with up-to date details.

  9. added
    Resolution: Soft Close
    on Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Fluent UI react-components (v9)Resolution: Soft CloseType: Bug 🐛

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions