Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript interface augmentation for SymbolConstructor conflicts with symbol-observable #3697

Closed
aikoven opened this issue May 15, 2018 · 2 comments · Fixed by #3773
Closed
Labels
bug Confirmed bug help wanted Issues we wouldn't mind assistance with.

Comments

@aikoven
Copy link

aikoven commented May 15, 2018

RxJS version:

6.1.0

Code to reproduce:

Include [email protected] and [email protected] into compilation

Expected behavior:

No TypeScript errors

Actual behavior:

TypeScript error

node_modules/rxjs/internal/symbol/observable.d.ts(4,9): error TS2687: 
    All declarations of 'observable' must have identical modifiers.

Additional information:

Type definition from symbol-observable:

declare global {
  export interface SymbolConstructor {
    readonly observable: symbol;
  }
}

Type definition from rxjs:

declare global {
  interface SymbolConstructor {
    observable: symbol;
  }
}

Note the difference in readonly.

@jichang
Copy link

jichang commented May 19, 2018

I don't know whether this will help. But this error happens when compiling code below

import { ajax } from "rxjs/ajax";

export function get() {
  return ajax("/api/v1/books");
}

get().subscribe(() => console.log('done'))

but when adding import "rxjs"; It works

import "rxjs"
import { ajax } from "rxjs/ajax";

export function get() {
  return ajax("/api/v1/books");
}

get().subscribe(() => console.log('done'))

I guess this happens when you don't import corresponding type definitions

@benlesh
Copy link
Member

benlesh commented May 21, 2018

We should be defining it as readonly as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug help wanted Issues we wouldn't mind assistance with.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants