Phoenix channel lib in typescript?

Hi all

Can I use phoenix channel in combination with typescript or it exits already a library?

Thanks

2 Likes

Typescript can already use javascript libraries, you just need to define the interface of what of it that you want to use within typescript itself.

1 Like

You could roll your own typing or use it as-is by using require.

const { Socket } = require('phoenix'); // no typing available
const socket:any = new Socket(...)

This will at least get you going and you can always come back later to optimize the typing.

3 Likes

ok, so I can’t help myself: here is an initial definition to play around with https://github.com/akeating/typed-phoenix

3 Likes