diff --git a/.dependency-cruiser.json b/.dependency-cruiser.json index 56d0cf216a..84ac44ea1b 100644 --- a/.dependency-cruiser.json +++ b/.dependency-cruiser.json @@ -97,7 +97,7 @@ "severity": "error", "comment": "Error in case we have circular dependencies", "from": { - "path": "^src" + "path": "^dist/esm5" }, "to": { "circular": true diff --git a/compat/add/observable/if.ts b/compat/add/observable/if.ts index 9314971233..d25dc79639 100644 --- a/compat/add/observable/if.ts +++ b/compat/add/observable/if.ts @@ -1,4 +1,3 @@ import { Observable, iif } from 'rxjs'; -//tslint:disable-next-line:no-any TypeScript doesn't like `if` -(Observable as any).if = iif; +Observable.if = iif; diff --git a/compat/add/observable/throw.ts b/compat/add/observable/throw.ts index e7008425bb..2393210b8e 100644 --- a/compat/add/observable/throw.ts +++ b/compat/add/observable/throw.ts @@ -1,6 +1,6 @@ import { Observable, throwError as staticThrowError } from 'rxjs'; -(Observable as any).throw = staticThrowError; +Observable.throw = staticThrowError; Observable.throwError = staticThrowError; declare module 'rxjs/internal/Observable' { diff --git a/package.json b/package.json index 81d1da4de4..4e640e7a0a 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "test_browser": "npm-run-all build_spec_browser && opn spec/support/mocha-browser-runner.html", "test": "mocha --require ts-node/register --opts spec-build/support/coverage.opts \"spec-build/**/*-spec.ts\"", "test:cover": "cross-env TS_NODE_FAST=true nyc npm test", - "test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" src", + "test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" dist/esm5", "test:systemjs": "node integration/systemjs/systemjs-compatibility-spec.js", "tests2png": "mkdirp tmp/docs/img && cross-env TS_NODE_FAST=true mocha --compilers ts:ts-node/register --opts spec/support/tests2png.opts \"spec/**/*-spec.ts\"", "watch": "watch \"echo triggering build && npm run build_spec && npm run test && echo build completed\" src -d -u -w=15", diff --git a/src/internal/Observable.ts b/src/internal/Observable.ts index 0b467b27ae..1620e8bf03 100644 --- a/src/internal/Observable.ts +++ b/src/internal/Observable.ts @@ -4,6 +4,7 @@ import { Subscription } from './Subscription'; import { TeardownLogic } from './types'; import { toSubscriber } from './util/toSubscriber'; import { iif } from './observable/iif'; +import { throwError } from './observable/throwError'; import { observable as Symbol_observable } from '../internal/symbol/observable'; import { OperatorFunction, PartialObserver, Subscribable } from '../internal/types'; import { pipeFromArray } from './util/pipe'; @@ -252,10 +253,18 @@ export class Observable implements Subscribable { return source && source.subscribe(subscriber); } - // TODO(benlesh): determine if this is still necessary - // `if` and `throw` are special snow flakes, the compiler sees them as reserved words - /** @nocollapse */ + // `if` and `throw` are special snow flakes, the compiler sees them as reserved words. Deprecated in + // favor of iif and throwError functions. + /** + * @nocollapse + * @deprecated In favor of iif creation function: import { iif } from 'rxjs'; + */ static if: typeof iif; + /** + * @nocollapse + * @deprecated In favor of throwError creation function: import { throwError } from 'rxjs'; + */ + static throw: typeof throwError; /** * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable