-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Summary
@effect-atom/atom-react declares @effect-atom/atom as a direct dependency rather than a peer dependency. This causes duplicate installations when consumers use a different (but compatible) version, leading to TypeScript type mismatches.
Environment
@effect-atom/atom:^0.4.9@effect-atom/atom-react:^0.4.3- Package manager: bun
- TypeScript: 5.9
Problem
When @effect-atom/[email protected] is installed at root and @effect-atom/[email protected] has @effect-atom/atom: "^0.4.8" as a direct dependency, bun installs a nested copy:
node_modules/@effect-atom/atom (0.4.9)
node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom (0.4.8)
This creates two different Atom types at runtime and compile time, causing type errors like:
Argument of type 'Atom<boolean>' from node_modules/@effect-atom/atom is not assignable to
parameter of type 'Atom<boolean>' from node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom
Full TypeScript error output
lib/providers/AnalyticsProvider.tsx(20,38): error TS2345: Argument of type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<boolean>' is not assignable to parameter of type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<boolean>'.
Types of property 'read' are incompatible.
Type '(get: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Context) => boolean' is not assignable to type '(get: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Context) => boolean'.
Types of parameters 'get' and 'get' are incompatible.
Type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Context' is not assignable to type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Context'.
Types of property 'get' are incompatible.
Type '<A>(this: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Context, atom: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<A>) => A' is not assignable to type '<A>(this: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Context, atom: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<A>) => A'.
The 'this' types of each signature are incompatible.
Type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Context' is not assignable to type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Context'.
Types of property 'result' are incompatible.
Type '<A, E>(this: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Context, atom: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Result").Result<A, E>>, options?: { ...; } | und...' is not assignable to type '<A, E>(this: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Context, atom: import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<import("/Users/prb/sablier/new-ui/node_modules/@...'.
Types of parameters 'atom' and 'atom' are incompatible.
Type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Result").Result<A, E>>' is not assignable to type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Atom").Atom<import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Result").Result<A, E>>'.
The types returned by 'read(...)' are incompatible between these types.
Type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Result").Result<A, E>' is not assignable to type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Result").Result<A, E>'.
Type 'Failure<A, E>' is not assignable to type 'Result<A, E>'.
Property '[TypeId]' is missing in type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom-react/node_modules/@effect-atom/atom/dist/dts/Result").Failure<A, E>' but required in type 'import("/Users/prb/sablier/new-ui/node_modules/@effect-atom/atom/dist/dts/Result").Failure<A, E>'.
Suggested Fix
Change @effect-atom/atom from dependencies to peerDependencies in @effect-atom/atom-react:
// package.json of @effect-atom/atom-react
{
- "dependencies": {
- "@effect-atom/atom": "^0.4.8"
- },
"peerDependencies": {
"effect": "^3.19",
+ "@effect-atom/atom": "^0.4.0",
"react": ">=18 <20",
"scheduler": "*"
}
}Workaround
Add an override in the consumer's package.json:
{
"overrides": {
"@effect-atom/atom": "0.4.9"
}
}Metadata
Metadata
Assignees
Labels
No labels