solidjs / solidjs/solid-vite-plugin

Proxied Functions Do Not Handle Spreading

Open
#214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
520
Forks
70
Avg merge
23h 35m
Merged PRs (30d)
39

Description

The Spreading syntax does not work the same way as it does in normal javascript. The spreading (...) syntax of an array into a function gives the wrong value. When imported from a .js file, the function behaves as expected, however when imported from a .jsx file, the function only puts the first value of the array into a new array.

How To Reproduce
-> Create a new vanilla Solid-js application.
-> Create a new jsx file, and make a function that uses the spread
-> call the spreaded function from any other file I.E(the default app)
-> Changing the file extension back to js, changes the behavior.

Minimum Reproduction


//In a File, the source function
function GlobalTest(...arr){
 console.log(...arr);
}

//Inside of app.jsx
import {GlobalTest} from 'otherfile'

GlobalTest(1,2,3); //  should see a '1' in the log when the source function is in a .jsx
GlobalTest(1,2,3); //  should see a '1 2 3' in the log when the source function is in a .js

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction, comparing how the source function is processed when it is in a .jsx file versus a .js file. Trace the plugin's handling of the spread syntax and verify the fix by running the reproduction: GlobalTest(1,2,3) should preserve and log all three arguments from either extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.