Skip to content
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

How to use from typescript? #503

Closed
hhanh00 opened this issue Sep 16, 2019 · 4 comments
Closed

How to use from typescript? #503

hhanh00 opened this issue Sep 16, 2019 · 4 comments
Milestone

Comments

@hhanh00
Copy link

hhanh00 commented Sep 16, 2019

I tried importing as

import * as deepstream from '@deepstream/client'
const client = deepstream('localhost:6020')

or as

import * as deepstream from '@deepstream/client'
const client = new deepstream.Client('localhost:6020')

and as

import deepstream = require('@deepstream/client')
const client = new deepstream.Client('localhost:6020')

I either get a compilation error

This expression is not callable
or a runtime error deepstream.Client is not a constructor

Only way that works is the old fashioned js

const deepstream = require('@deepstream/client')
const client = deepstream('localhost:6020')

Is it the recommended way?

@yasserf
Copy link
Contributor

yasserf commented Sep 16, 2019

hey! Yeah sorry this is an actual issue.

What I do for now is:

const deepstream = require('@deepstream/client')
import { Client as DeepstreamClient } from '@deepstream/client'

Need to figure out how to fix it in the SDK. Thanks for raising!

@yasserf
Copy link
Contributor

yasserf commented Sep 19, 2019

This is fixed in V5 (to be released), since it is a minor breaking change. Thanks for raising!

@yasserf yasserf added this to the 5.0 milestone Sep 23, 2019
@hhanh00
Copy link
Author

hhanh00 commented Oct 30, 2019 via email

@yasserf
Copy link
Contributor

yasserf commented Oct 31, 2019

👍

Fixed in 5.0

@yasserf yasserf closed this as completed Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants