Skip to content

fix: splice() return type now correctly tracked as array#397

Merged
cs01 merged 1 commit intomainfrom
fix/splice-return-type
Mar 14, 2026
Merged

fix: splice() return type now correctly tracked as array#397
cs01 merged 1 commit intomainfrom
fix/splice-return-type

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 14, 2026

Summary

  • arr.splice(start, count) return value can now be used as an array (.length, indexing, etc.)
  • Previously, the type inference didn't recognize splice as returning the same array type as its source, causing removed.length to fail with ".length is not available on type 'number'"
  • Added splice alongside slice/concat in all 4 type inference paths: expression type resolution, number array detection, string array detection, and object array detection

Test plan

  • New fixture splice-return-type.ts tests both number and string array splice return values
  • All tests pass (739 total)
  • Self-hosting Stage 0 + Stage 1 pass

🤖 Generated with Claude Code

@cs01 cs01 merged commit 9bc2990 into main Mar 14, 2026
12 checks passed
@cs01 cs01 deleted the fix/splice-return-type branch March 14, 2026 13:40
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