thoughtbot / superglue

A productive library for Classic Rails, React and Redux
https://thoughtbot.github.io/superglue/
MIT License
326 stars 8 forks source link

Add typescript support - Part II #43

Open jho406 opened 2 months ago

jho406 commented 2 months ago

All of superglue is written in ES6. For developers working with React, typescript has been a valuable tool to have. It would improve the developer experience if superglue was converted to Typescript.

In this story, we should add type annotations to every function in superglue and move from gradual typing to something a bit more strict.

Thoughts

Not all features of superglue can be converted to typescript.

  1. digging is a feature that make it easy to create medium effort interactivity, but it works off of key paths (http://xyz.com/posts/?props_at=header.notifications)
  2. Superglue also comes with UJS helpers, for example: using placeholders. Not sure what the best way to type this is.

Regardless, typing what we can is still a great step forward.

stefannibrasil commented 1 month ago

This task can be broken down into:

1 - add TypeScript first 2 - then we should be good to work on the other tasks mentioned here

johncardiologs commented 1 month ago

Hi! I prototyped adding Typescript at RailsConf 2024, PR here: https://github.com/thoughtbot/superglue/pull/60

I've mostly been trying to follow this JS -> TS Migration guide -- still new to this!