question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Constructing ReconnectingWebsocket error in TypeScript

See original GitHub issue

Code: new ReconnectingWebSocket(url)

Error: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
pre-martincommented, Oct 5, 2017

I get an error message, when using "strict": true in the compiler options:

test.ts:

import * as ReconnectingWebsocket from 'reconnecting-websocket';

const websocket: WebSocket = new ReconnectingWebsocket('url', undefined, {constructor: WebSocket});

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2015",
    "module": "es2015",
    "moduleResolution": "node",
    "strict": true,
    "allowSyntheticDefaultImports": true
  }
}

Compile error:

node node_modules/typescript/lib/tsc.js -p tsconfig.json

test.ts(3,30): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.

If I remove "strict": true from tsconfig.json, the code compiles fine. But I want this option to be true.

tsc: 2.4.2 reconnecting-websocket: 3.2.2

0reactions
kalmicommented, Feb 28, 2018

My understanding is that changing noImplicitAny in the library’s tsconfig will have no effect whatsoever when importing as only the importer project’s tsconfig will be in effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reconnecting-websocket - npm
Start using reconnecting-websocket in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >
Reconnecting a websocket in Angular and rxjs? - Stack Overflow
catch is doing is picking up any error produced in the block where the stream actually does receive some data. So adding the...
Read more >
Reconnecting Websockets | Mike Polinowski
ReconnectingWebSocket : A small JavaScript library that decorates the WebSocket API to provide a WebSocket connection that will automatically reconnect if ...
Read more >
Typescript (forked) - StackBlitz
Blank starter project for building TypeScript apps. ... import ReconnectingWebSocket from. 'reconnecting-websocket';. console.error(ReconnectingWebSocket).
Read more >
'new' expression, whose target lacks a construct signature ...
I am using a bigint in my typescript package, however I can't seem to get typescript to recognise Bigint. The following code throws...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found