Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript
https://effect.website
MIT License
6.3k stars 200 forks source link

Property '[BrandTypeId]' is missing in type 'Number & Brand<"UnsignedInteger">' but required in type 'Brand<"UnsignedInteger">'. #2617

Open mmadson opened 2 months ago

mmadson commented 2 months ago

What version of Effect is running?

3.0.5

What steps can reproduce the bug?

What is the expected behavior?

Expect that a branded type built with effect 3.0.5 can be supplied to a function declaration that expects a branded type argument build with effect 3.0.4

What do you see instead?

src/index.ts:4:16 - error TS2345: Argument of type 'import("/home/mmadson/dev/public/branded-types/projB/node_modules/@temp/ts-branded-types/dist/types/unsigned-integer", { with: { "resolution-mode": "import" } }).UnsignedInteger' is not assignable to parameter of type 'import("/home/mmadson/dev/public/branded-types/projB/node_modules/@temp/proj-a/node_modules/@temp/ts-branded-types/dist/types/unsigned-integer", { with: { "resolution-mode": "import" } }).UnsignedInteger'.
  Property '[BrandTypeId]' is missing in type 'Number & Brand<"UnsignedInteger">' but required in type 'Brand<"UnsignedInteger">'.

4 myCoolFunction(UnsignedInteger(42));

Additional information

We use rennovate to control our dependency versions and version upgrades and wherever we use these effect branded types, we run into build compatibility issues.

tim-smart commented 2 months ago

Brands (as well as a lot of other things in effect) work with unique symbol's, so if you have two versions of Effect they are going to be completely different.

So this is working as expected from my point of view.