Skip to content

Prevent null values from reaching quote() and causing a TypeError#169

Open
PenguinNexus wants to merge 1 commit intolaravel:nextfrom
PenguinNexus:next
Open

Prevent null values from reaching quote() and causing a TypeError#169
PenguinNexus wants to merge 1 commit intolaravel:nextfrom
PenguinNexus:next

Conversation

@PenguinNexus
Copy link

@PenguinNexus PenguinNexus commented Feb 10, 2026

This PR hardens TypeScript generation by filtering out null and empty string values before invoking quote() on literal-union members. This prevents the following TypeError:

TypeError: TypeScript::quote(): Argument #1 ($string) must be of type string, null given

This is achieved by converting the arrays in TypeScript::literalUnion() to a Collection then apply the filter to strip if is_null or an empty string. The same filter is then applied in Validation\Rules::resolveBaseType().

There is an associated PR for Surveyor: laravel/surveyor#20

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

Successfully merging this pull request may close these issues.

1 participant