Comments (10)
Since you are installing ws anyway, you can use the following code:
import { ClientOptions } from 'ws'
from isomorphic-ws.
Isn't it necessary to add more lines like..
import type { ClientOptions } from 'ws'
export { ClientOptions }
export default WebSocket
from isomorphic-ws.
It seems like a problem with:
Line 8 in e7d264a
It should be
Line 8 in 551ed56
@paralin Which version of isomorphic-ws
did you used?
from isomorphic-ws.
@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.
@paralin I didn't get errors with 4.0.1
:
https://codesandbox.io/s/nervous-fire-9hnffn?file=/src/App.tsx
from isomorphic-ws.
I guess it's expected now to use export = WebSocket
instead of export default WebSocket
?
from isomorphic-ws.
I guess it's expected now to use
export = WebSocket
instead ofexport default WebSocket
?
Yes. I'm going to revert the commit which did not published actually.
from isomorphic-ws.
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;
from isomorphic-ws.
@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.
@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)
- ws should be a peer dependency HOT 2
- Doesn't work in a react development environment HOT 3
- Can't construct WebSocket HOT 5
- Error: 'WebSocket': The subprotocol '[object Object]' is invalid.\n at RPC.createSocket HOT 1
- Export ES modules HOT 2
- plans for ws 8.x? HOT 2
- Add support for normal "ws" events HOT 1
- Make export interface for NodeJS and browser the same HOT 2
- It's alive? 😟 HOT 2
- The `ws` module no longer exposes the standard API for onmessage/onclose events HOT 2
- ESM Import Error HOT 7
- Version 5.0.0 fails when used with typescript and karma
- Please export Websocket
- Consider marking the `ws` peer dependency as optional
- Way to compile without error HOT 4
- LICENSE HOT 1
- TypeScript supporting? HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isomorphic-ws.