pladaria / reconnecting-websocket

Reconnecting WebSocket. For Web, React Native, cli (Node.js)
MIT License
1.22k stars 197 forks source link

Event types conflict with DOM types in TypeScript 3.7.2 #115

Closed Yserz closed 4 years ago

Yserz commented 4 years ago

Hi,

It looks like the event types of reconnecting-websocket v4.2.0 conflict with the built in types DOM types in TypeScript v3.7.2.

node_modules/reconnecting-websocket/dist/reconnecting-websocket.d.ts:7:10 - error TS2440: Import declaration conflicts with local declaration of 'CloseEvent'.

7 import { CloseEvent, ErrorEvent, Event, WebSocketEventListenerMap } from './events';
           ~~~~~~~~~~

node_modules/reconnecting-websocket/dist/reconnecting-websocket.d.ts:7:22 - error TS2440: Import declaration conflicts with local declaration of 'ErrorEvent'.

7 import { CloseEvent, ErrorEvent, Event, WebSocketEventListenerMap } from './events';
                       ~~~~~~~~~~

node_modules/reconnecting-websocket/dist/reconnecting-websocket.d.ts:7:34 - error TS2440: Import declaration conflicts with local declaration of 'Event'.

7 import { CloseEvent, ErrorEvent, Event, WebSocketEventListenerMap } from './events';

tsconfig

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "baseUrl": ".",
    "declaration": false,
    "downlevelIteration": true,
    "forceConsistentCasingInFileNames": true,
    "jsx": "react",
    "lib": ["dom", "es2017"],
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "sourceMap": true,
    "target": "es6"
  },
}
ffflorian commented 4 years ago

See https://github.com/pladaria/reconnecting-websocket/pull/113 and https://github.com/pladaria/reconnecting-websocket/pull/114 :wink:

pladaria commented 4 years ago

fixed by #113