Skip to content

fix: default untyped elements as non-arrays#94

Open
43081j wants to merge 1 commit intomainfrom
fix-up-typed-chaos
Open

fix: default untyped elements as non-arrays#94
43081j wants to merge 1 commit intomainfrom
fix-up-typed-chaos

Conversation

@43081j
Copy link
Copy Markdown
Contributor

@43081j 43081j commented Mar 25, 2026

This changes the array helper to return boolean | undefined, so when
we have no type information, we return undefined.

On top of this, the spread rule then treats untyped elements as
non-spreadable.

This means arr.concat(a, b) becomes [...arr, a, b] instead of
[...arr, ...a, ...b].

Similarly, arr.concat(a, [1, 2]) becomes [...arr, a, 1, 2].

Fixes #90.

cc @oBusk

This changes the array helper to return `boolean | undefined`, so when
we have no type information, we return `undefined`.

On top of this, the spread rule then treats untyped elements as
non-spreadable.

This means `arr.concat(a, b)` becomes `[...arr, a, b]` instead of
`[...arr, ...a, ...b]`.

Similarly, `arr.concat(a, [1, 2])` becomes `[...arr, a, 1, 2]`.
@43081j 43081j changed the title fix: default untyped elements as non-aarays fix: default untyped elements as non-arrays Mar 25, 2026
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.

bug(prefer-spread-syntax): Struggles with [].concat() array/element syntax

1 participant