Wie verwende ich die (mqtt) js Bibliothek in der App Angular 2 Typescript?

Ich habe den Ansatz von @ sehr ähnlich geseh How-to-Use-Moment-Js-Bibliothek-in-Winkel-2-typescript-App aber immer nocherror TS2307: Cannot find module 'mqtt'.

npm install --save mqtt
<s>typings install --save mqtt</s

das hat die Eingaben nicht gefunden, aber das hat ...

typings install mqtt --save --ambient 

mein tsconfig.conf sieht so aus

{
    "compilerOptions": {
        "noImplicitAny": true,
        "module": "commonjs",
        "target": "ES5",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "sourceMap": true,
        "declaration": true
    },
    "files": [
        "ng2-mqtt.ts"
    ],
    "exclude": [
        "node_modules"
    ]
}

undng2-mqtt.ts hat nur diese ...

export * from './src/mqtt.service'

und./src/mqtt.service.ts hat.

import {Injectable} from 'angular2/core';
import * as mqtt from 'mqtt';
@Injectable() 
export class MqttService {
  constructor() {
     //mqtt.connect('ws://10.0.1.100:3333')
     // ...
  }
}

tsc -version 1.8.10, [email protected], Typisierung 0.8.1, npm 2.14.20, Knoten v4.4.1, Windows 7

Ist es einfach zu schwierig, Angular 2 mit Elementen außerhalb seiner typisierten Welt zu verwenden?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage