jorgebucaran/hyperapp

hyperapp type defintions for TypeScript 3.6+

fibbo opened this issue · 7 comments

fibbo commented

I was wondering if there are type definitions for newer versions of TypeScript. We are still using hyperapp 1.x and with newer versions of TypeScript there are typing errors.

Yes, there is a PR to add first-class TypeScript support to Hyperapp here: #969. Feedback welcome! 🙏

fibbo commented

I guess this is for version 2 (as the title indicates). As mentioned in my post above I'm still on 1.2.8.

How time consuming would be a migration to v2?

Hard to say without more information. How are you using V1?

If the bulk of your app consists of views and reducer-like actions, it will be pretty easy to migrate. For actions that do side effects, direct DOM manipulation, adding or removing event listeners, you'll need to leverage V2 effects and subscriptions.

You are welcome to join our Slack too if you want.

fibbo commented

It concerns this repo: https://github.com/pdf-tools/PdfWebViewerTS - actions are mostly only updating the state. If that is what you are asking

  • Actions only updating the state require virtually no changes unless you were using the "slices" feature.
  • JSX syntax is no longer supported out of the box, but it's easy to "polyfill". I advocate for writing views using Hyperscript, @hyperapp/html or a tagged literal function like @zaceno's Hyperlit now.
  • Lifecycle events were deprecated as well, so if you were heavily using those, a direct V1 to V2 migration might not be worth it if you're running behind schedule.
fibbo commented

Just for my understanding: what are lifecycle events?

Those were oncreate, onupdate, and onremove. I saw you were using an oncreate as part of your Tooltip implementation (which is understandable), so at least that would need to be completely refactored. In V2, DOM mutations need to be encapsulated in generic effects.