Comments (2)
@fabian-hiller Ah, I see.
I will use Input
instead of Output
.
Thank you :)
from valibot.
As written here, is
has some limitations. One of them is that it can only secure the input type, but not the output type. Therefore you need to change Output
to Input
. With the current implementation, only the output type is branded. Therefore is
does not work with brand
. If there are good reasons to also brand the input type, I will be happy to take a closer look at the implementation.
import * as v from 'valibot';
const UserIDSchema = v.brand(v.string([v.length(12)]), 'UserID');
type UserID = v.Input<typeof UserIDSchema>; // <-- Change here
const logUserID = (uid: UserID) => {
console.log(uid);
};
const foo = '123456789012';
if (v.is(UserIDSchema, foo)) {
logUserID(foo);
}
from valibot.
Related Issues (20)
- TypeScript: InferInput always infers intersect as 'never' HOT 3
- [v0.31.0-rc.5] `Invalid type: Expected Object but received Object` because of `edge` runtime HOT 3
- abortPipeEarly influnces on abortEarly HOT 2
- Compiled type for actions missing typing for 'requirement' in ErrorMessage HOT 2
- [v0.31.0-rc.5] The internal function `_stringify` has a problem HOT 23
- cannot pipe a pipe HOT 2
- Enum error with React Hook Form HOT 14
- Reduce boilerplate for custom actions HOT 4
- Forward is changing the issues paths on flatten with an error in the forwarded property HOT 4
- @valibot/i18n could not be installed HOT 4
- Pipe to emit a single issue HOT 3
- Predefined keys for `ObjectSchema` HOT 4
- Automatic upgrade to v0.31.0 with Grit only works for certain patterns HOT 7
- Codemod skipping certain schema HOT 5
- Codemod - missing comma before `v.check` on `v.intersect` HOT 1
- Error while downloading codemod HOT 2
- Form submission proceeds despite validation errors using check in Valibot, causing formValue to be lost HOT 4
- Codemod using `unknown()` schema HOT 3
- Unable to enter multiple paths to forward method HOT 2
- "Unsafe assignment of an `any` value" for pipe method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from valibot.