Build Typed GraphQL Queries in TypeScript without the code generation
MIT License
Published by acro5piano over 2 years ago
Full Changelog: https://github.com/acro5piano/typed-graphqlify/compare/v3.1.4...v3.1.5
⚠ Breaking: query
, mutation
, subscription
now returns CompiledResult
(not returns GraphQL string).
interface CompiledResult<D, V> {
toString: () => string
data: D
variable: V
result: { data: D }
}
2.x
const queryObject = {
user: {
id: types.number,
name: types.string,
bankAccount: {
id: types.number,
branch: types.string,
},
},
}
const queryString = query('GetUser', queryObject)
type Result = typeof queryObject
3.x
const q = query('GetUser', {
user: {
id: types.number,
name: types.string,
bankAccount: {
id: types.number,
branch: types.string,
},
},
})
const queryString = q.toString()
type Result = typeof q.data
https://github.com/acro5piano/typed-graphqlify/compare/v2.4.0...v2.4.1
Published by acro5piano over 5 years ago