We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi :)
Is there a way to support branded types?
branded
declare const __brand: unique symbol type Branded<TBrand extends string, TType = string> = TType & { [__brand]: TBrand } type Foo = { id: Branded<'foo'> ... }
The above code outputs something like that:
"Branded_Foo": { "allOf": [ { "type": "string" }, { "properties": { "undefined": { "type": "string", "enum": [ "foo" ], "nullable": false } }, "required": [ null ], "type": "object" } ] },
I also tried replacing Branded types by doing:
Branded
type ReplaceBranded<T> = { [K in keyof T]: T[K] extends Branded<any> ? string : T[K] } ReplaceBranded<Foo>
This works fine with the IDE, but the generated specs convert all properties to string instead of replacing only Branded properties.
string
EDIT: I was able to work around the issue by fixing my ReplaceBranded type:
ReplaceBranded
type ReplaceBranded<T> = { [K in keyof T]: T[K] extends Branded<string> | undefined ? string | undefined : T[K] extends Branded<string>[] ? string[] : T[K] extends Branded<string> ? string : T[K] }
The text was updated successfully, but these errors were encountered:
Hello there MathieuRA 👋
Thank you for opening your very first issue in this project.
We will try to get back to you as soon as we can.👀
Sorry, something went wrong.
No branches or pull requests
Hi :)
Is there a way to support
branded
types?The above code outputs something like that:
I also tried replacing
Branded
types by doing:This works fine with the IDE, but the generated specs convert all properties to
string
instead of replacing onlyBranded
properties.EDIT:
I was able to work around the issue by fixing my
ReplaceBranded
type:The text was updated successfully, but these errors were encountered: