Schema Validation with Branded Types and Nominal Function in TypeScript
Hi, I tried the following code:
The output is
Of course, 5 is not a TenFromSelf. But I would expect the TenFromSelf schema not to check this. It gets a TenFromSelf as input and, in my opinion, it should trust the input to be what it pretends to be. Or am I missing something?
Of course, this example is a bit stupid. But I am working on a time consuming schema and realized that what I think are unnecessary tests were carried out. Hence this example.
The output is
false. If I replace 5 by 10, I get a true.Of course, 5 is not a TenFromSelf. But I would expect the TenFromSelf schema not to check this. It gets a TenFromSelf as input and, in my opinion, it should trust the input to be what it pretends to be. Or am I missing something?
Of course, this example is a bit stupid. But I am working on a time consuming schema and realized that what I think are unnecessary tests were carried out. Hence this example.
