// @target: ES6 // @declaration: true declare global { interface SymbolConstructor { readonly obs: symbol } } const observable: typeof Symbol.obs = Symbol.obs export class MyObservable { constructor(private _val: T) {} subscribe(next: (val: T) => void) { next(this._val) } [observable]() { return this } } type InteropObservable = { [Symbol.obs]: () => { subscribe(next: (val: T) => void): void } } function from(obs: InteropObservable) { return obs[Symbol.obs]() } from(new MyObservable(42))