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

Type error on Switch #240

Closed
Sebastien-Ahkrin opened this issue Feb 16, 2021 · 7 comments
Closed

Type error on Switch #240

Sebastien-Ahkrin opened this issue Feb 16, 2021 · 7 comments

Comments

@Sebastien-Ahkrin
Copy link

Hello 👋
I'm using the @headlessui/react in 0.3.1 package with typescript 4.1.5
And when i'm trying to use the application with "tsc --noEmit" i have the following error:

Error: node_modules/@headlessui/react/dist/components/switch/switch.d.ts(16,32): error TS1335: 'unique symbol' types are not allowed here.

This is the output in my node_modules ...

export declare namespace Switch {
    var Group: <TTag extends React.ElementType<any> = React.ExoticComponent<{
        children?: React.ReactNode;
    }>>(props: Props<TTag, {}, unique symbol>) => JSX.Element;
    var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}

i can help you if you have any questions
Have a nice day :) 👋

@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

Is this only happening while using tsc --noEmit or in all use cases?
Can you create a reproduction repository that showcases this issue?

@targos
Copy link

targos commented Feb 19, 2021

Hello, here's a reproduction: https://github.com/targos/headlessui-switch-bug
It happens also without --noEmit.

@RobinMalfait
Copy link
Member

@targos thanks for the repro! I'll take a look now!

@Sebastien-Ahkrin
Copy link
Author

Thanks @targos :)

RobinMalfait added a commit that referenced this issue Feb 19, 2021
Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!
RobinMalfait added a commit that referenced this issue Feb 19, 2021
* replace unique symbol with uuid v4

Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!

* update changelog
@RobinMalfait
Copy link
Member

This should be fixed, and will be available in the next release.
You can already try it using npm install @headlessui/react@dev or yarn add @headlessui/react@dev.

@Sebastien-Ahkrin
Copy link
Author

i will try that thanks :)

@Toub
Copy link

Toub commented Mar 10, 2021

Thanks @RobinMalfait

Do you consider to release a patch to have a clean fix before the next version is released?

Or should we install an older version of headlessui ?

RobinMalfait added a commit that referenced this issue Mar 22, 2021
* replace unique symbol with uuid v4

Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!

* update changelog
RobinMalfait added a commit that referenced this issue Mar 26, 2021
* replace unique symbol with uuid v4

Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!

* update changelog
RobinMalfait added a commit that referenced this issue Apr 2, 2021
* replace unique symbol with uuid v4

Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!

* update changelog
RobinMalfait added a commit that referenced this issue Apr 2, 2021
* replace unique symbol with uuid v4

Ideally we can use a Symbol, however it seems that TypeScript or TSDX,
inlines the `unique symbol`, instead of referencing the actual __
placeholder type.

Ideally we add this back in the future, but the odds that somebody has
this specific uuid in production is close to 0. (Unless they
specifically use this uuid).

Fixes: #240

Thanks to =?UTF-8?q?Micha=C3=ABl=20Zasso?= <[email protected]> for
providing a reproduction repository!

* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants