Kaare Hoff Skovgaard

Results 44 comments of Kaare Hoff Skovgaard

You can do it under wsl. There's a gist here from one of my colleagues that I use daily to do this (it also uses this project): https://gist.github.com/andsens/2ebd7b46c9712ac205267136dc677ac1

Thanks for pointing that out @colemickens - I might look into that as well (to get my VSCode to have gpg access to my yubikey as well)

Let's leave this issue open for now such that we can get some test coverage written and make sure we generate the same kind of errors as the relay-compiler. I'm...

The initial thoughts I had for this I've actually since found out is not ideal (from working with our own codebase using some slightly different techniques but with regards to...

Ah I see what you mean. In general I think getting variables and output type needed for a query and mutation (and subscriptions for that matter) texts would be very...

Something like this: [Typescript Playground](https://www.typescriptlang.org/play/#src=%2F%2F%20~~~~~~~~~~~~~~~~~~~~~%0D%0A%2F%2F%20commitRelayModernMutation%0D%0A%2F%2F%20~~~~~~~~~~~~~~~~~~~~~%0D%0A%2F%2F%20exposed%20through%20RelayModern%2C%20not%20Runtime%20directly%0D%0Aexport%20interface%20MutationConfig%3CTMutation%20extends%20GraphQLTaggedNode%3E%20%7B%0D%0A%20%20%20%20variables%3A%20OperationVariables%3CTMutation%3E%3B%0D%0A%20%20%20%20mutation%3A%20TMutation%3B%0D%0A%20%20%20%20onCompleted%3F(response%3A%20OperationResult%3CTMutation%3E)%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aexport%20interface%20Environment%20%7B%20%7D%0D%0Aexport%20interface%20Disposable%20%7B%0D%0A%20%20%20%20dispose()%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aexport%20type%20ConcreteFragment%20%3D%20any%3B%0D%0A%0D%0Aexport%20type%20GraphQLTaggedNode%20%3D%0D%0A%20%20%20%20%7C%20(()%20%3D%3E%20ConcreteFragment)%0D%0A%20%20%20%20%7C%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20modern()%3A%20ConcreteFragment%3B%0D%0A%20%20%20%20%20%20%7D%3B%0D%0A%0D%0Ainterface%20OperationWithVariables%3CTVars%3E%20%7B%0D%0A%20%20%20%20%22%20%24variables%22%3A%20TVars%3B%0D%0A%7D%0D%0A%0D%0Ainterface%20OperationWithResult%3CTResult%3E%20%7B%0D%0A%20%20%20%20%22%20%24result%22%3A%20TResult%3B%0D%0A%7D%0D%0A%0D%0Aexport%20type%20OperationVariables%3CTMutation%20extends%20GraphQLTaggedNode%3E%20%3D%20TMutation%20extends%20OperationWithVariables%3Cinfer%20V%3E%20%3F%20V%20%3A%20any%3B%0D%0Aexport%20type%20OperationResult%3CTMutation%20extends%20GraphQLTaggedNode%3E%20%3D%20TMutation%20extends%20OperationWithResult%3Cinfer%20R%3E%20%3F%20R%20%3A%20any%3B%20%0D%0A%0D%0Aexport%20declare%20function%20commitRelayModernMutation%3CTMutation%20extends%20GraphQLTaggedNode%3E(environment%3A%20Environment%2C%20config%3A%20MutationConfig%3CTMutation%3E)%3A%20Disposable%3B%0D%0A%0D%0A%2F%2F%20Import%20this%20from%20artifact%20file%0D%0Adeclare%20const%20MyOperation%3A%20GraphQLTaggedNode%20%26%20%7B%0D%0A%20%20%20%20%22%20%24variables%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20myVar%3A%20string%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20%22%20%24result%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20viewer%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20profile%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20string%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%7D%3B%0D%0A%0D%0Aconst%20myMutation%20%3D%20commitRelayModernMutation(%7B%7D%2C%20%7B%0D%0A%20%20%20%20mutation%3A%20MyOperation%2C%0D%0A%20%20%20%20variables%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20myVar%3A%20'test'%2C%0D%0A%20%20%20%20%7D%2C%0D%0A%20%20%20%20onCompleted(res)%20%7B%0D%0A%20%20%20%20%20%20%20%20console.log(res.viewer.profile.name)%3B%0D%0A%20%20%20%20%7D%0D%0A%7D))

I think I might have messed up some details in the link, [here's an updated version](https://www.typescriptlang.org/play/#src=%2F%2F%20~~~~~~~~~~~~~~~~~~~~~%0D%0A%2F%2F%20commitRelayModernMutation%0D%0A%2F%2F%20~~~~~~~~~~~~~~~~~~~~~%0D%0A%2F%2F%20exposed%20through%20RelayModern%2C%20not%20Runtime%20directly%0D%0Aexport%20interface%20MutationConfig%3CTMutation%20extends%20ConcreteRequest%3E%20%7B%0D%0A%20%20%20%20variables%3A%20OperationVariables%3CTMutation%3E%3B%0D%0A%20%20%20%20mutation%3A%20TMutation%3B%0D%0A%20%20%20%20onCompleted%3F(response%3A%20OperationResult%3CTMutation%3E)%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aexport%20interface%20Environment%20%7B%20%7D%0D%0Aexport%20interface%20Disposable%20%7B%0D%0A%20%20%20%20dispose()%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aexport%20type%20ConcreteFragment%20%3D%20any%3B%0D%0Aexport%20type%20ConcreteRequest%20%3D%20any%3B%0D%0A%0D%0Ainterface%20OperationWithVariables%3CTVars%3E%20%7B%0D%0A%20%20%20%20%22%20%24variables%22%3A%20TVars%3B%0D%0A%7D%0D%0A%0D%0Ainterface%20OperationWithResult%3CTResult%3E%20%7B%0D%0A%20%20%20%20%22%20%24result%22%3A%20TResult%3B%0D%0A%7D%0D%0A%0D%0Aexport%20type%20OperationVariables%3CTMutation%20extends%20ConcreteRequest%3E%20%3D%20TMutation%20extends%20OperationWithVariables%3Cinfer%20V%3E%20%3F%20V%20%3A%20any%3B%0D%0Aexport%20type%20OperationResult%3CTMutation%20extends%20ConcreteRequest%3E%20%3D%20TMutation%20extends%20OperationWithResult%3Cinfer%20R%3E%20%3F%20R%20%3A%20any%3B%20%0D%0A%0D%0Aexport%20declare%20function%20commitRelayModernMutation%3CTMutation%20extends%20ConcreteRequest%3E(environment%3A%20Environment%2C%20config%3A%20MutationConfig%3CTMutation%3E)%3A%20Disposable%3B%0D%0A%0D%0A%2F%2F%20Import%20this%20from%20artifact%20file%0D%0Aconst%20MyOperation%3A%20ConcreteRequest%20%26%20%7B%0D%0A%20%20%20%20%22%20%24variables%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20myVar%3A%20string%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20%22%20%24result%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20viewer%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20profile%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20string%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%0D%0A%7D%20%3D%20(function%20()%20%7B%0D%0A%20%20%20%20%20%20%20%20var%20v0%20%3D%20%5B%2F*...*%2F%5D%3B%0D%0A%20%20%20%20%20%20%20%20var%20v1%20%3D%20%5B%2F*...*%2F%5D%3B%0D%0A%20%20%20%20%20%20%20%20return%20%7B%20%2F*%20some%20object%20representing%20the%20actual%20mutation%20*%2F%20%7D%3B%0D%0A%7D)()%20as%20any%3B%0D%0A%0D%0Aconst%20myMutation%20%3D%20commitRelayModernMutation(%7B%7D%2C%20%7B%0D%0A%20%20%20%20mutation%3A%20MyOperation%2C%0D%0A%20%20%20%20variables%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20myVar%3A%20'test'%2C%0D%0A%20%20%20%20%7D%2C%0D%0A%20%20%20%20onCompleted(res)%20%7B%0D%0A%20%20%20%20%20%20%20%20console.log(res.viewer.profile.name)%3B%0D%0A%20%20%20%20%7D%0D%0A%7D)) that might show what I'm after. In short, the actual GraphQL document we export...

I think I know what you're getting at now. I've completely forgotten how this is supposed to work exactly, my bad. With that in mind, you're right we cannot make...

To build on the idea of creating a TypeScript plugin it should be possible to add a [Language Server Plugin](https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin) that would add linting quick fixes to add the generic...