Skip to content

Commit b7313ac

Browse files
committed
fix(docs-infra): workaround for broken 'import as'
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212
1 parent 345bc65 commit b7313ac

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

aio/src/app/custom-elements/code/pretty-printer.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
22

3-
import { from as fromPromise, Observable } from 'rxjs';
3+
import { from, Observable } from 'rxjs';
44
import { first, map, share } from 'rxjs/operators';
55

66
import { Logger } from 'app/shared/logger.service';
@@ -20,7 +20,7 @@ export class PrettyPrinter {
2020
private prettyPrintOne: Observable<PrettyPrintOne>;
2121

2222
constructor(private logger: Logger) {
23-
this.prettyPrintOne = fromPromise(this.getPrettyPrintOne()).pipe(share());
23+
this.prettyPrintOne = from(this.getPrettyPrintOne()).pipe(share());
2424
}
2525

2626
private getPrettyPrintOne(): Promise<PrettyPrintOne> {

aio/src/app/custom-elements/elements-loader.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import {
55
NgModuleRef,
66
} from '@angular/core';
77
import { ELEMENT_MODULE_PATHS_TOKEN } from './element-registry';
8-
import { from as fromPromise, Observable, of } from 'rxjs';
8+
import { from, Observable, of } from 'rxjs';
99
import { createCustomElement } from '@angular/elements';
1010

11+
1112
@Injectable()
1213
export class ElementsLoader {
1314
/** Map of unregistered custom elements and their respective module paths to load. */
@@ -34,7 +35,7 @@ export class ElementsLoader {
3435

3536
// Returns observable that completes when all discovered elements have been registered.
3637
const allRegistered = Promise.all(unregisteredSelectors.map(s => this.loadCustomElement(s)));
37-
return fromPromise(allRegistered.then(() => undefined));
38+
return from(allRegistered.then(() => undefined));
3839
}
3940

4041
/** Loads and registers the custom element defined on the `WithCustomElement` module factory. */

aio/src/app/custom-elements/toc/toc.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';
2-
import { asapScheduler as asap, combineLatest, Subject } from 'rxjs';
2+
import { asapScheduler, combineLatest, Subject } from 'rxjs';
33
import { startWith, subscribeOn, takeUntil } from 'rxjs/operators';
44

55
import { ScrollService } from 'app/shared/scroll.service';
@@ -52,7 +52,7 @@ export class TocComponent implements OnInit, AfterViewInit, OnDestroy {
5252
// We use the `asap` scheduler because updates to `activeItemIndex` are triggered by DOM changes,
5353
// which, in turn, are caused by the rendering that happened due to a ChangeDetection.
5454
// Without asap, we would be updating the model while still in a ChangeDetection handler, which is disallowed by Angular.
55-
combineLatest(this.tocService.activeItemIndex.pipe(subscribeOn(asap)), this.items.changes.pipe(startWith(this.items)))
55+
combineLatest(this.tocService.activeItemIndex.pipe(subscribeOn(asapScheduler)), this.items.changes.pipe(startWith(this.items)))
5656
.pipe(takeUntil(this.onDestroy))
5757
.subscribe(([index, items]) => {
5858
this.activeIndex = index;

0 commit comments

Comments
 (0)