Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript

Home Page:https://effect.website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mmadson opened this issue · comments

What version of Effect is running?

3.0.5

What steps can reproduce the bug?

  • Create a new node project my-types
  • add dependency on effect@3.0.4
  • export a branded type for Unsigned Integers
  • build and publish my-types v1.0.0 to a registry
  • Create a new project, proj-a and add dependency to my-types@1.0.0
  • export a function from proj-a which uses the unsigned integer effect branded type in a function declaration
  • build and publish proj-a v1.0.0
  • Create a new project, proj-b and add a dependency on my-types@1.0.0 and proj-a@1.0.0
  • import the function from proj-a and call it in a new src file, supply the argument effect branded type from my-types
  • update effect to 3.0.5 in my-types
  • publish a new version of my-types v1.0.1
  • update proj-b's my-types dependency to v1.0.1
  • attempt to build and run proj-b

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.

commented

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.