Skip to content

Creating an interface with a symbol? #8099

Closed
@benlesh

Description

@benlesh

TypeScript Version:

1.7.5 / 1.8.0-beta / nightly (1.9.0-dev.20160217)

Code

// try augmenting the SymbolContructor to have some expected symbol on it.
// in RxJS5's case, it'll be the Symbol.observable symbol from the es-observable spec.
interface SymbolConstructor {
  observable: symbol;
}

interface Observablesque<T> {
  [Symbol.observable]: () => Subscribable<T>
}

or

// try importing some symbol reference (I get why this might not work)
import {$$observable} from './symbol/observable';

interface Observablesque<T> {
  [$$observable]: () => Subscribable<T>
}

Expected behavior:

I should be able to enforce types that have symbols on them, custom or otherwise.

Actual behavior:

I get really confused and go get myself a coffee.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions