1

I'm creating an Electron app with Typescript support. I want to use RxJS library in the Renderer process with nodeIntegration set to false.

In the specific window I include the RxJS by

<script type="text/javascript" src="../node_modules/rxjs/bundles/rxjs.umd.min.js"></script>

In the Renderer Process I import specific observables and operators by

const { fromEvent } = (window as any).rxjs;//require('rxjs');
const { tap } = (window as any).rxjs.operators;//require("rxjs/operators");

Application works correctly but I have no support for types definitions from RxJS. How can I bring the support back? How to import correctly the *.d.ts for RxJS?

lkurylo
  • 1,621
  • 33
  • 59

1 Answers1

1

You can create your own .d.ts file like this:

export * from 'rxjs'
export * as operators from 'rxjs/operators'
export * as testing from 'rxjs/testing'
export * as ajax from 'rxjs/ajax'
export * as webSocket from 'rxjs/webSocket'
export * as fetch from 'rxjs/fetch'

export as namespace rxjs

This way was suggested in this answer to a similar question.

Yevgeny Terov
  • 36
  • 1
  • 5