rxjs: Missing Definition file for UMD module
I’ve downloaded and compiled the project building for all targets, and noticed that the umd/global distribution is missing the .d.ts definition files.
I’ve played around a little, and the closest I got was to compile to amd using outFile instead of outDir, that generates a single .d.ts, but its missing the Global name “Rx”, for example, its generating
declare module "Subscription" {
export class Subscription {
static EMPTY: Subscription;
isUnsubscribed: boolean;
constructor(_unsubscribe?: () => void);
unsubscribe(): void;
add(subscription: Subscription | Function | void): void;
remove(subscription: Subscription): void;
}
export class UnsubscriptionError extends Error {
errors: any[];
constructor(errors: any[]);
}
}
Where I think it should create
declare module "Rx.Subscription" {
Sadly the project Im building now needs the umd version and I can’t get typings 😦
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 22 (12 by maintainers)
For anyone still trying to get RxJS 5 to load with typings in an AMD / RequireJS environment, you must do the following:
npm install core-js @reactivex/rxjs --save
<script src="//unpkg.com/core-js/client/shim.js"></script>
<script src="//unpkg.com/@reactivex/rxjs/dist/global/Rx.js"></script>
/// <reference path='../node_modules/@types/core-js/index.d.ts' />
/// <reference path='../node_modules/@reactivex/rxjs/dist/cjs/Rx.d.ts' />
Now you can
import * as Rx from '@reactivex/rxjs'
from any .ts file in your project.