Typescript types not accurate
See original GitHub issueHi, I’m trying to use stream in a Typescript application and have found several issues with the types.
First, when creating a client (server-side) with this call:
const client = connect(apiKey, secret, appId);
The client is created as an “any” object. If I remove “stream.” from the returned object type on the connect function in the stream-js index.d.ts file (making it just “StreamClient” instead of “stream.StreamClient”), the client is correctly typed.
I’m currently working around this by explicitly declaring the type of the object, but it’s obviously preferable to just have the types working:
const client = connect(apiKey, secret, appId) as StreamClient;
Second, I’m creating a client-side connection to a particular feed with a server-generated read only token, as below:
const client = connect( apiKey, null, appId, ) as StreamClient; const readOnlyFeed = client.feed( feedGroupName, feedName, readOnlyToken, );
This is working as expected, but I’m receiving a typescript error on the feed function, which only has 2 arguments in the stream-js index.d.ts file: feedSlug and userId. An optional token argument should be added to the feed function definition.
Thanks!
gz#4555
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
We’re working on it 😉
hi all! sorry I wasn’t able to try out the beta, I got pulled onto another feature that we just wrapped up this week. I’m coming back to this now and am THRILLED at the new release!