Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mmadson opened this issue Apr 25, 2024 · 1 comment

Comments

@mmadson
Copy link

mmadson commented Apr 25, 2024

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.

@mmadson mmadson added the bug Something isn't working label Apr 25, 2024
@tim-smart
Copy link
Member

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.

@tim-smart tim-smart added working as intended and removed bug Something isn't working labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants