js-graphql-intellij-plugin icon indicating copy to clipboard operation
js-graphql-intellij-plugin copied to clipboard

Plugin doesn't properly recognize injected values as non-null

Open csj opened this issue 1 year ago • 0 comments

The GraphQL plugin does fantastic work checking that the queries that I write on the client-side are correct as per my GraphQL spec. I've directed the plugin to where my GraphQL endpoint is located, it generates a bunch of code, and can do in-IDE syntax checks to keep me in line. Terrific.

There's one glitch: when I inject values from outside the gql`...` literal, it can't seem to guarantee that the value will not be null, even though I'm using typescript and am asserting that a value will not be null. A picture, worth 1024 words:

image

This is a contrived example; in practice, I'm using this in a React project and will use path parameters to fetch data from different rails. Yes it's possible for this page to be visited without a railId, but this is guarded against in the component so the variable really can be reduced to type number instead of for example number | undefined (in which case I would gladly accept the IDE error as given!)

WS-213.6461.79, JRE 11.0.13+7-b1751.21x64 JetBrains s.r.o., OS Windows 10(amd64) v10.0 , screens 2880.0x1620.0, 1920.0x1080.0

csj avatar Oct 14 '22 12:10 csj