Skip to content

Commit

Permalink
fix(symbol): revert unique symbol in #5874 (#6224)
Browse files Browse the repository at this point in the history
* 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 <nicholas@cartant.com>
  • Loading branch information
kwonoj and cartant committed Apr 15, 2021
1 parent ce0a2fa commit 3c49429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api_guard/dist/types/index.d.ts
Expand Up @@ -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<T> implements Subscribable<T> {
protected operator: Operator<any, T> | undefined;
Expand Down
12 changes: 3 additions & 9 deletions src/internal/types.ts
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 3c49429

Please sign in to comment.