0
votes

I am trying to run the first example here. Rx.Observable.fromEvent(element, eventName, [selector])

But when compiling, the compiler throws me the following error.

Uncaught exception: { [TypeScript error: index.ts(44,38): Error TS2345: Argument of type 'JQuery' is not assignable to parameter of type 'Node'. Property 'attributes' is missing in type 'JQuery'.]
message: 'index.ts(44,38): Error TS2345: Argument of type \'JQuery\' is not assignable to parameter of type \'Node\'.\n Property \'attributes\' is missing in type \'JQuery\'.'

at

var source = Rx.Observable.fromEvent(input, 'click');

The input is

var input = $('#input');

The following is my imports:

/// <reference path="./typings/rx/rx.d.ts" />
/// <reference path="./typings/rx/rx.async.d.ts" />
/// <reference path="./typings/jquery/jquery.d.ts" />

import Rx = require('rx');
import $ = require('jquery');
1
so where is your input ?Leo Silence

1 Answers

1
votes

Argument of type 'JQuery' is not assignable to parameter of type 'Node'

You need to access the underlying DOM element. One way is to use the string indexer [0] :

var source = Rx.Observable.fromEvent(input[0], 'click');