From ca0afc0fbdd420c3330c669ea6a24512e1087cd9 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Tue, 26 Mar 2019 12:05:39 +1000 Subject: [PATCH] chore: use literal union and keep enum The enum is kept, but it is no longer a const enum. It cannot be exported as a const enum without effecting an error if isolated modules are used. --- src/internal/Notification.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/internal/Notification.ts b/src/internal/Notification.ts index a2b7ff0916..f65f70cd64 100644 --- a/src/internal/Notification.ts +++ b/src/internal/Notification.ts @@ -3,8 +3,17 @@ import { Observable } from './Observable'; import { empty } from './observable/empty'; import { of } from './observable/of'; import { throwError } from './observable/throwError'; +import { deprecate } from 'util'; -export type NotificationKind = 'N' | 'E' | 'C'; +// TODO: When this enum is removed, replace it with a type alias. See #4556. +/** + * @deprecated NotificationKind is deprecated as const enums are not compatible with isolated modules. Use a string literal instead. + */ +export enum NotificationKind { + NEXT = 'N', + ERROR = 'E', + COMPLETE = 'C', +} /** * Represents a push-based event or value that an {@link Observable} can emit. @@ -23,7 +32,7 @@ export type NotificationKind = 'N' | 'E' | 'C'; export class Notification { hasValue: boolean; - constructor(public kind: NotificationKind, public value?: T, public error?: any) { + constructor(public kind: 'N' | 'E' | 'C', public value?: T, public error?: any) { this.hasValue = kind === 'N'; }