Skip to content

Matching generics #19

Description

@gillchristian

This is part of the search algorithm (#14) but is worth to include it in a separated issue I believe.

There are a few consideration about matching generics that we should keep in mind

  • Shouldn't be matched by name. The following two signatures should be considered the same. De Bruijn index can help here (I guess 🤔)
<T, U>(f: (t: T) => U) => (ts: T[]) => U[]

<A, B>(f: (a: A) => B) => (as: A[]) => B[]
  • To simplify the queries I'd like to have the convention of considering single capital letters to be generics. E.g. the previous signatures should be searched by these queries:
(A => B) => A[] => B[]

(X => Y) => X[] => Y[]
  • Default values of generics can be ignored (at least in the v1)
  • Constraints of generics (i.e. T extends Y) can be part of a latter iteration (ideally in v1 but not necessarily).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtractExtracting function types from TS modulesSearchAll search things

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions