Skip to content

Commit

Permalink
chore: use literal union and keep enum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cartant committed Mar 26, 2019
1 parent b28521d commit ca0afc0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/internal/Notification.ts
Expand Up @@ -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.
Expand All @@ -23,7 +32,7 @@ export type NotificationKind = 'N' | 'E' | 'C';
export class Notification<T> {
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';
}

Expand Down

0 comments on commit ca0afc0

Please sign in to comment.