@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.
@typespec/playground@0.17.1declaresreact/react-dom(^19.2.8) and exact@fluentui/react-components@9.74.3/@fluentui/react-icons@2.0.333as regulardependenciesand has nopeerDependenciesat all (@typespec/html-program-viewer@0.86.0does the same).
If a consuming app pins a different exact version — e.g.
react@19.2.7or@fluentui/react-components@~9.73.8— npm installs a nested second copy undernode_modules/@typespec/playground/node_modules/. The app then renders nothing and the consoleshows:
Declaring react, react-dom and the Fluent UI packages as
peerDependencies(with a permissiverange) would make a duplicate installation impossible and let consumers control the versions.