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

Brands in recursive types result in interface being misplaced #40

Open
mikesol opened this issue Jun 23, 2019 · 1 comment
Open

Brands in recursive types result in interface being misplaced #40

mikesol opened this issue Jun 23, 2019 · 1 comment

Comments

@mikesol
Copy link

mikesol commented Jun 23, 2019

Calling t.brandCombinator on a recursive feild results in something like this:

const Schema: t.RecursiveType<t.Type<Schema>> = t.recursion('Schema', () => t.brand(_Schema, (x): x is t.Branded<_Schema, XPropertiesBrand> => true, 'XProperties')
interface XPropertiesBrand {
  readonly XProperties: unique symbol
})

The interface is placed within the recurisve expression.

That happens because of this line:

s += `\ninterface ${bc.name}Brand {

One idea for a fix: another function instead of printRuntime (ie printDefinitions) could be used to print this sort of thing.

@gcanti
Copy link
Owner

gcanti commented Jun 23, 2019

Calling t.brandCombinator on a recursive feild

@mikesol could you please post a small repro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants