Skip to content

Use method types for interfaces that are backed by classes #347

@jdharrisnz

Description

@jdharrisnz

If you destructure methods from get/ctx, you will unbind this unknowingly because @typescript-eslint/unbound-method only sees the interface and not the underlying class. The interfaces therefore need to use method-style and not function-style.

From

export interface Context {
  <A>(atom: Atom<A>): A
  readonly get: <A>(atom: Atom<A>) => A
  // ...
}

To

export interface Context {
  <A>(atom: Atom<A>): A
  get<A>(atom: Atom<A>): A
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions