Skip to content

[playground] react, react-dom and @fluentui/* should be peerDependencies #11992

Description

@dalbrx-nitrobox

@typespec/playground@0.17.1 declares react/react-dom (^19.2.8) and exact
@fluentui/react-components@9.74.3 / @fluentui/react-icons@2.0.333 as regular
dependencies and has no peerDependencies at all (@typespec/html-program-viewer@0.86.0
does the same).

If a consuming app pins a different exact version — e.g. react@19.2.7 or
@fluentui/react-components@~9.73.8 — npm installs a nested second copy under
node_modules/@typespec/playground/node_modules/. The app then renders nothing and the console
shows:

Invalid hook call. Hooks can only be called inside of the body of a function component.
...
3. You might have more than one copy of React in the same app
Uncaught TypeError: Cannot read properties of null (reading 'useState')

Declaring react, react-dom and the Fluent UI packages as peerDependencies (with a permissive
range) would make a duplicate installation impossible and let consumers control the versions.


### Checklist

- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [docs](https://typespec.io/docs/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions