Giter VIP home page Giter VIP logo

Comments (10)

JoCat avatar JoCat commented on May 14, 2024 1

Since you are installing ws anyway, you can use the following code:

import { ClientOptions } from 'ws'

from isomorphic-ws.

paralin avatar paralin commented on May 14, 2024 1

Isn't it necessary to add more lines like..

import type { ClientOptions } from 'ws'

export { ClientOptions }
export default WebSocket

from isomorphic-ws.

heineiuo avatar heineiuo commented on May 14, 2024

It seems like a problem with:

export default WebSocket;

It should be

export = WebSocket

@paralin Which version of isomorphic-ws did you used?

from isomorphic-ws.

paralin avatar paralin commented on May 14, 2024

@heineiuo currently using 4.0.1 in https://github.com/aperturerobotics/starpc -

I tried importing as import { ClientOptions } from 'isomorphic-ws' since the same works with 'ws' - but of course, that's not exported currently.

from isomorphic-ws.

heineiuo avatar heineiuo commented on May 14, 2024

@paralin I didn't get errors with 4.0.1:
Screen Shot 2022-06-23 at 13 22 38

https://codesandbox.io/s/nervous-fire-9hnffn?file=/src/App.tsx

from isomorphic-ws.

paralin avatar paralin commented on May 14, 2024

@heineiuo

image

I guess it's expected now to use export = WebSocket instead of export default WebSocket ?

from isomorphic-ws.

heineiuo avatar heineiuo commented on May 14, 2024

@heineiuo

image

I guess it's expected now to use export = WebSocket instead of export default WebSocket ?

Yes. I'm going to revert the commit which did not published actually.

from isomorphic-ws.

heineiuo avatar heineiuo commented on May 14, 2024

Isn't it necessary to add more lines like..

import type { ClientOptions } from 'ws'

export { ClientOptions }
export default WebSocket

No, it's unnecessary because @types/ws did export = WebSocket;

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ea4d4e50e11788ef0a8094d7de564ad2f01dfedd/types/ws/index.d.ts#L377

from isomorphic-ws.

paralin avatar paralin commented on May 14, 2024

@JoCat @heineiuo I guess there's some confusion here on what I'm asking...

If I try to do this, it doesn't work:

import { ClientOptions } from 'isomorphic-ws'

Is there something that I'm doing wrong here?

from isomorphic-ws.

heineiuo avatar heineiuo commented on May 14, 2024

@JoCat @heineiuo I guess there's some confusion here on what I'm asking...

If I try to do this, it doesn't work:


import { ClientOptions } from 'isomorphic-ws'

Is there something that I'm doing wrong here?

Could you provide a minimal project or a codesandbox link (just like I submitted above)?

from isomorphic-ws.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.