From 3c49429fadc31ebaddd143d4412907edc50e32be Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Thu, 15 Apr 2021 08:31:31 -0700 Subject: [PATCH] fix(symbol): revert unique symbol in #5874 (#6224) * fix(symbol): revert unique symbol in #5874 - closes #5919 * fix(types): move Symbol.observable into types.ts (#6178) Closes #6175 Co-authored-by: Nicholas Jamieson --- api_guard/dist/types/index.d.ts | 2 +- src/internal/types.ts | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/api_guard/dist/types/index.d.ts b/api_guard/dist/types/index.d.ts index 9667748ba4..e8a7d05400 100644 --- a/api_guard/dist/types/index.d.ts +++ b/api_guard/dist/types/index.d.ts @@ -240,7 +240,7 @@ export interface ObjectUnsubscribedError extends Error { export declare const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor; -export declare const observable: string | SymbolConstructor["observable"]; +export declare const observable: string | symbol; export declare class Observable implements Subscribable { protected operator: Operator | undefined; diff --git a/src/internal/types.ts b/src/internal/types.ts index 5d3f8b9881..8b94b4f748 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -5,18 +5,12 @@ import { Observable } from './Observable'; import { Subscription } from './Subscription'; /** - * NOTE: This will add Symbol.observable globally for all TypeScript users, - * however, we are no longer polyfilling Symbol.observable. Note that this will be at - * odds with older version of @types/node and symbol-observable which incorrectly define - * `Symbol.observable` as `symbol` rather than `unique symbol`. "What about not defining - * this non-standard symbol at all?" you might ask... Well, that ship has sailed. There are - * dozens of libraries using this symbol now and many of them are quite popular. - * So here we are, and it's probably my fault. Sorry, "the web", if I have hurt you, - * the world just needed a standard way to provide interop for these types. -Ben + * Note: This will add Symbol.observable globally for all TypeScript users, + * however, we are no longer polyfilling Symbol.observable */ declare global { interface SymbolConstructor { - readonly observable: unique symbol; + readonly observable: symbol; } }