Question: I am calling IO of socket.io-client in my angular project like below:

```
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import * as io from 'socket.io-client';
@Injectable({
  providedIn: 'root'
})
export class SocketclientService {
  socket:any;
  url:any="ws://localhost:8080"
  constructor() {
    this.socket = io(this.url);
   }

   listen(eventname:any,data:any){
     return new Observable((subscriber)=>{
       this.socket.on(eventname,(data:any)=>{
         subscriber.next(data);
       })
     })
   }
   emit(eventname:string,data:any){
     this.socket.emit(eventname,data);
   } 
}

```

But I am always getting an error like:

```
 Error: src/app/services/socketclient.service.ts:11:19 - error TS2349: This expression is not callable.
      Type 'typeof import("C:/somepathtoproject/node_modules/socket.io-client/build/index")' has no call signatures.

    11     this.socket = io(this.url);
                         ~~

```

I am not getting it why this is showing, even I have installed @types/socket.io-client

Answer: 
That may be caused by the type definitions been installed separately. But they are shipped with the `socket.io-client` package now ([see docs: "Note for TypeScript users"](https://socket.io/docs/v3/client-installation/)).

So just uninstall them and change the imports:

`npm uninstall @types/socket.io-client`

```typescript
import { io, Socket } from 'socket.io-client';

```
Here's a 2021 updated way of doing this with Typescript:

```js

import { io, Socket } from 'socket.io-client';

export default class SocketService {
  socket: Socket;

  constructor(conn) {
    this.socket = io(conn);

   (...)
  }
}

```

One should import the `io` inside the brackets and also attribute the socket with the `Socket` type also comming from `'socket.io-client'`.