relay-compiler-language-typescript icon indicating copy to clipboard operation
relay-compiler-language-typescript copied to clipboard

Boolean types in arguments doesnt generate boolean variables

Open maraisr opened this issue 4 years ago • 3 comments

Logging here so I don't forget.


for the query:

query BlogArticleQuery($isAmp: Boolean!) {
    article(slug: "example") {
        title(amp: $isAmp) { value }
    }
}

should ideally generate as at Relay v9.x:

export type BlogArticleQueryVariables = { 
    isAmp: boolean;
}

but as at v10

export type BlogArticleQueryVariables = { 
    isAmp: string;
}

worth also noting that the gql query Relay spits out in ast form is accurate, so this is definitely a bug with the ts langauge.

maraisr avatar Jul 24 '20 03:07 maraisr

can you send a fix and add a failing test for this?

sibelius avatar Jul 24 '20 11:07 sibelius

I think this is actually blocked by #199 and #196

Once those 2 land, I'll re visit this. Or perhaps, put this issue in as a requirement to land those 2 PR's. Thoughts @sibelius?

maraisr avatar Jul 27 '20 07:07 maraisr

Update here, looks like it's actually a bug with our server's (HotChocolate)'s schema generation that is including the built-in scalar types.

So if the schema provided contains scalar Boolean for example, should the type's generated still be correct? Or is that wrong based on the spec—if im reading it correctly: https://spec.graphql.org/draft/#sec-Scalars.Built-in-Scalars

maraisr avatar Oct 19 '20 06:10 maraisr