Skip to content

Commit

Permalink
Smaller bundle for gql
Browse files Browse the repository at this point in the history
Casting, instead of wrapping, the existing `gql` function, save ~60
bytes, and avoid an extra function call at runtime
  • Loading branch information
PowerKiKi committed Oct 17, 2024
1 parent dd651af commit 5cf81c2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/apollo-angular/src/gql.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { gql as gqlTag, TypedDocumentNode } from '@apollo/client/core';

function typedGQLTag<Result, Variables>(
literals: ReadonlyArray<string> | Readonly<string>,
...placeholders: any[]
): TypedDocumentNode<Result, Variables> {
return gqlTag(literals, ...placeholders);
}
const typedGQLTag: <Result, Variables>(
literals: ReadonlyArray<string> | Readonly<string>,
...placeholders: any[]
) => TypedDocumentNode<Result, Variables> = gqlTag;

export const gql = typedGQLTag;
export const graphql = typedGQLTag;

0 comments on commit 5cf81c2

Please sign in to comment.