Which makes `(GraphQLField<any, any>?) | NULL a valid type. Luau also agrees that this is correct syntax, as it accepts this type declaration:
type _fieldDefStack = (GraphQLField<any, any>?) | NULL
It seems like the fix for this would be to wrap the type params values in a parenthese when they contain a type union or intersection where the left side type is a parenthese type. Weirdly specific thing to add, but I think it'll do it.
Another fix for this is also to not add parentheses around the left side of the union, but this only works if the inner type is compatible with the union (or intersection).
When processing a type like this:
Darklua currently adds parentheses around
GraphQLField<any, any>?
which creates invalid syntax:This is odd because the syntax defines type params as:
Which makes
`(GraphQLField<any, any>?) | NULL
a valid type. Luau also agrees that this is correct syntax, as it accepts this type declaration:It seems like the fix for this would be to wrap the type params values in a parenthese when they contain a type union or intersection where the left side type is a parenthese type. Weirdly specific thing to add, but I think it'll do it.