absinthe-socket icon indicating copy to clipboard operation
absinthe-socket copied to clipboard

Provide TS typedefs

Open slorber opened this issue 6 years ago • 9 comments

Hi,

It would be convenient for TS users have type definitions shipped with the packages

slorber avatar Nov 12 '19 12:11 slorber

Yeah, it'll be so helpful.

So far, only this JS dependencies have no typedefs in my project. And now I'm forced to spend hours to realize how to provide minimal type definitions to make TS compile again.

Maybe I'm missing some easy ways. If so - it will be convenient to have small section in documentation dedicated to TypeScript users.

I'm constantly trying to propagate Elixir/Phoenix to my colleagues and such time wasting points makes evangelism harder.

ffloyd avatar Jan 06 '20 10:01 ffloyd

I am also stuck with typescript errors. Any thoughts about how to get this working with Typescript or any references?

kurund avatar Jun 15 '20 11:06 kurund

Quick fix:

// @ts-ignore
import X from "y";

It will consider X as any.

slorber avatar Jun 16 '20 13:06 slorber

I started to integrate subscriptions in a React/TypeScript app and besides the needed packages I installed the types like this:

npm install -D @types/absinthe__socket @types/absinthe__socket-apollo-link @types/phoenix

eisnstein avatar Aug 10 '20 17:08 eisnstein

@eisnstein Those typedefs are flawed. In particular, toObservable has the wrong return type. The typedef says it returns withAbsintheSocket.Observer, but the actual implementation returns a zen-observable.Observable

jamestalmage avatar Oct 30 '20 13:10 jamestalmage

I'm starting the engines again, the idea is to move forward with the following:

  1. Automate release process
  2. Migrate to TS / Upgrade deps

Once we get here, it will be easier for people to contribute (TS vs Flow, and PR merged => released).

I will close this issue once we have finished the migration to TS, thanks for the patience.

mgtitimoli avatar Jun 05 '22 23:06 mgtitimoli

Asking not out of impatience (really, open source work is hard and I'm very grateful) but for timing – should someone implementing today wait on this (and be okay without types) vs using a fork with types right now?

joshsmith avatar Aug 09 '22 03:08 joshsmith

I'm just looking into setting up semantic release for a forked version we have of this repo and was also thinking it might make sense to migrate to typescript. Using semantic release alongside Renovate should make it pretty low maintenance to keep it up to date.

@mgtitimoli Would you be open to a contribution to set this up?

davidspek avatar Nov 10 '22 18:11 davidspek

@joshsmith The repo is still a bit messy from me trying to get the release process working but in this fork I've setup Semantic Release and NX so that new release are created for every PR.

davidspek avatar Jun 26 '23 11:06 davidspek