rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Add support for Svelte

Open searleser97 opened this issue 2 years ago • 3 comments

Svelte is getting popular among front end development, I believe adding support for it in rescript would be awesome.

searleser97 avatar May 03 '22 01:05 searleser97

Could you elaborate what kind of support do you expect?

sairion avatar May 04 '22 02:05 sairion

  1. Ability to write type-safe rescript within the script tag, right now we can import the generated js but feels unatural and its also not type safe when using the functions as on:click handler.

  2. related to the first request, bindings for common HTML Events Handlers should be written so that something like <button on:click={clickHandler} /> its type safe i.e. clickHandler should have the correct type for "on:click"

  3. Svelte uses $: to identify reactive blocks of code so I guess its also necessary to add support for that syntax

Probably a .res file with the same structure as .svelte files can be compiled to a javascript .svelte file.

searleser97 avatar May 04 '22 02:05 searleser97

Save to say that this will not be on our priority list. Most focus will go towards an improved version of our JSX, including a new version of rescript-react.

ryyppy avatar May 20 '22 05:05 ryyppy