
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
The spec-compliant & magical GraphQL query language engine in the TypeScript type system
gql.tada
is a GraphQL document authoring library, inferring the result and variables types
of GraphQL queries and fragments in the TypeScript type system. It derives the types for your
GraphQL queries on the fly allowing you to write type-safe GraphQL documents quickly.
In short, gql.tada
,
Since this is all done in the TypeScript type system and type checker, this all happens while you edit your GraphQL front-end code and is always accurate.
import { graphql } from 'gql.tada';
import { myIntrospectionQuery } from './fixtures/introspection';
// We can declare our introspected schema once globally
declare module 'gql.tada' {
interface setupSchema {
introspection: typeof myIntrospectionQuery;
}
}
// Creates fragment documents
const fragment = graphql(`
fragment HelloWorld extends Query {
hello
world
}
`);
// Creates queries, optionally accepting a list of fragments for fragment spreads
const query = graphql(
`
{
hello
...HelloWorld
}
`,
[fragment]
);
Install gql.tada
using your project’s package manager,
npm i gql.tada
pnpm add graphql
yarn add gql.tada
bun add graphql
gql.tada
infers the types of your queries. However, it can’t provide you with editor feedback,
like autocompletion, diagnostics & errors, and hover information inside GraphQL queries.
For the best experience, it’s recommended to install GraphQLSP
to supplement these features.
Install @0no-co/graphqlsp
as a dev dependency,
npm i -D gql.tada
pnpm add -D graphql
yarn add --dev gql.tada
bun add --dev graphql
Then, update your tsconfig.json
to enable the graphqlsp
plugin in your TypeScript server,
tsconfig.json
{
"compilerOptions": {
+ "plugins": [
+ {
+ "name": "@0no-co/graphqlsp",
+ "schema": "./schema.graphql"
+ }
+ ]
}
}
Note: If you are using VSCode, you may want to update your
.vscode/config.json
file to use the use the workspace version of TypeScript automatically..vscode/config.json
{ + "typescript.tsdk": "node_modules/typescript/lib", + "typescript.enablePromptUseWorkspaceTsdk": true }
FAQs
The spec-compliant & magical GraphQL query language engine in the TypeScript type system
The npm package gql.tada receives a total of 207,227 weekly downloads. As such, gql.tada popularity was classified as popular.
We found that gql.tada demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.