language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

show type definitions in vscode

Open jelmd opened this issue 1 year ago • 0 comments

Problem

If one tries to write down a prisma query in vscode and gets an error, it is pretty hard to find the real problem, especially when the documentation is as shallow/incomplete as or partially simply wrong as the prisma documentation (see query examples for n-m-relationship).

E.g. for:

var clause = {
  events: {
    some: {
      event: { xeid: id }
    }
  }
};
return prisma.season.findMany({ where: clause });

vscode moans:

Type '{ event: { some: { event: { xeid: number; }; }; }; }' is not assignable to type 'SeasonWhereInput'.
  The types of 'event.some.event' are incompatible between these types.
    Type '{ xeid: number; }' is not assignable to type '(Without<EventRelationFilter, EventWhereInput> & EventWhereInput) | (Without<EventWhereInput, EventRelationFilter> & EventRelationFilter) | undefined'.ts(2322)
(property) where?: Prisma.SeasonWhereInput | undefined
Filter, which Seasons to fetch.

View Problem (Alt+F8)
No quick fixes available

If one right clicks on it or copies the term into the code, auto completion try says Cannot find name 'SeasonWhereInput'.ts(2304) (and thus one wonders, how it can know, what's wrong, if it does not know the definitions ...).

Suggested solution

Would be nice, if one could right click on SeasonWhereInput and get a "Go to Type" or "Go to Definition" or "Go to Implementation" as for other JS functions/vars/types within the project source code.

env

vscode 1.88.1
PrismaExtension v5.12.1
node v18.17.1
prisma 5.12.1
@prisma/client 5.12.1
OS: Ubuntu 20.04.6 LTS

jelmd avatar Apr 21 '24 05:04 jelmd