Skip to content

Question regarding self referencing types #740

Answered by ssalbdivad
Raiden1411 asked this question in Q&A
Discussion options

You must be logged in to vote

Ahh, that is probably due to this, which I forgot to test as I only checked on my branch where it has been resolved!

#693

This would also affect the intersection case for cyclic references and will be resolved with the next release. In the meantime, if you run into something like this, you can always cast the type using your existing test type like this:

const types = scope({
    ab: {
        a: "string",
        b: "string"
    },
    c: { c: "number" },
    cd: { c: "number", d: "test[]" },
    cOrCd: "c|cd",
    test: "ab&cOrCd" as Infer<test>
}).compile()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Raiden1411
Comment options

@ssalbdivad
Comment options

Answer selected by Raiden1411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants