Module sockjs-client has no exported member "SockJS"
Asked Answered
G

3

5

I am trying to import SockJS from the sockjs-client library. I am using Aurelia and typescript, but when trying to import that with

import { SockJS } from 'sockjs-client';

it says in VS2015: "Module sockjs-client has no exported member "SockJS""

package.json looks like this:

 "jspm": {
    "dependencies": {
     //......
  "sockjs": "npm:sockjs@^0.3.17",
  "sockjs-client": "npm:sockjs-client@^1.1.1",
  "stompjs": "npm:stompjs@^2.3.3",
},
"devDependencies": {}
}

Can anyone help?

Gauche answered 20/9, 2016 at 14:5 Comment(0)
A
4

Try:

import SockJS = require('sockjs-client');
Asperse answered 20/9, 2016 at 16:44 Comment(1)
this doesn't add typings though.Stillborn
S
4

Try to install sockjs-client typings npm install --save @types/sockjs-client and then import import * as SockJS from 'sockjs-client';

Spindling answered 22/8, 2018 at 10:25 Comment(0)
C
1

this alone should do the trick: npm install --save-dev @types/sockjs-client no need for the import as. It comes from TS

Chlamydate answered 9/5, 2019 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.