Я столкнулся с проблемой при использовании трафарета с rxjs 6
Просто создал компонент трафарета, выполнив npm init stencil
и выбрал component
из списка.
Добавил rxjs
в package.json
и обновлен трафарет до последней версии:
"devDependencies": {
"@stencil/core": "^0.18.0",
"rxjs": "^6.4.0"
}
Создан простой компонент:
import { Component, Element } from '@stencil/core';
import { fromEvent } from 'rxjs';
import { throttleTime } from 'rxjs/operators';
@Component({
tag: 'my-component',
shadow: true
})
export class MyComponent {
@Element() el: HTMLElement;
componenDidLoad() {
const btn = this.el.shadowRoot.getElementById('btn');
const clicks = fromEvent(btn, 'click');
const result = clicks.pipe(throttleTime(1000));
result.subscribe(x => console.log(x));
}
render() {
return <button id="btn">click me</button>;
}
}
и на npm run start
появилась пустая страница со следующей ошибкой в консоли браузера:
TypeError: Cannot read property 'h' of undefined