Skip to content
Discussion options

You must be logged in to vote

Hey @cdietrich,

well, kind of. Currently, we always assign [] to any array to ensure that the property exists. This in turn led us to the decision to always generate array types to be non-optional, as they have at least an empty array assigned to them.

I'm not sure whether it's worth to revisit that decision, since you can assume that if an array is empty, that the respective property has not been visited by the parser, as otherwise there would be at least one element in there. Effectively, there's no difference between [] and undefined for the value of an array in the AST, except for the fact that handling empty arrays is much easier compared additionally handling undefined as a value.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cdietrich
Comment options

cdietrich Mar 12, 2025
Collaborator Author

Answer selected by cdietrich
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