镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Creating an interface with a symbol? #8099

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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