Adding annotation examples for a branded type in Effect Typescript library
What's the best way of adding annotation
In the screenshot you will see the 2 TS errors:
-
-
A couple of ideas/options I have are:
Option 1: Assign the branded
Option 2: Create the branded type using
...but I prefer inferring the branded type from the schema in option 1.
Are there any other approaches that I'm missing?
examples for a branded type?In the screenshot you will see the 2 TS errors:
-
Block-scoped variable 'UserId' used before its declaration.ts(2448)-
Type 'string' is not assignable to type 'Brand<"UserId">'.ts(2322)A couple of ideas/options I have are:
Option 1: Assign the branded
UUID schema to a variable first and then add the annotations:Option 2: Create the branded type using
Brand ...and then use Schema.fromBrand ...but I prefer inferring the branded type from the schema in option 1.
Are there any other approaches that I'm missing?

