Skip to content
Discussion options

You must be logged in to vote

The error here is essentially because if we get data that is a valid file and module like:

const data = {
  name: "foo",
  files: []
}

If you add something to one of the types so there's no way they could overlap, it should work, e.g.:

file: {
	name: "string",
	"opts?": "opts",
	"files?": "never"
},

That said, we should actually allow this case because its the same morph being applied in each branch. There's an open issue #1375 tracking an array edge case that would allow your original implementation to work.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by FrancescoLuzzi
Comment options

You must be logged in to vote
0 replies
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