-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couple of issues with new typings in @horizon/client #834
Comments
@mrapogee thanks, |
Hey, Couple more things.
This is because of the way typescript resolves imports. Typescript basically compiles |
@mrapogee is this still true in the latest versions of Typescript? In the project I was working on (using |
I think microsoft/TypeScript#5285 may be related (fixed in v1.8). |
@mrapogee also, |
* fix return types for `.fetch()` and `.watch()`, export additional types Fixes #834 * add `.hasAuthToken()` and `.authEndpoint()`
I'm using |
@mrapogee if you're not using [edit]: also, did you try using the |
Checkout https://www.typescriptlang.org/docs/handbook/modules.html Doing But, I can do |
Is it possible to include the Horizon Client with type definitions right now? I'm still pretty new to Horizon and TypeScript, but shouldn't this be close? import * as Horizon from '@horizon/client'; // [ts] Cannot find module '@horizon/client' Also it appears the NPM version doesn't have the definition file yet, so I copied it into my project manually. Can't get it to recognize the name of the module for the life of me. |
It's working with this
You can import it like |
Thanks for the help. I still can't seem to get it to recognize the import path. I added the
and my
I do have Still getting the error |
@abecks the typings I've added have been merged into |
Nevermind, I was missing the index.d.ts file still. I copied it over from the master here and now the import is recognized. Thanks @marshall007 I'll switch to |
Hey @marshall007, getting the following npm error when trying to install the
|
Hey All,
Thanks for adding typings to the horizon client! Really helps with my workflow.
I noticed a couple of issues, though. First,
fetch()
andwatch()
are incorrectly typed to returnTermBase
when the should return a observable. Like thisI imagine this is a mistake, but possibly it's an API change?
Also, if I want to create a function that explicitly accepts a
HorizonInstance
, like(hz: HorizonInstance) => TermBase
you need to add these 2 lines to your typings so I can access the types.Thanks!
The text was updated successfully, but these errors were encountered: