From 60c4409e39ce30e271e80e327898390b9cf20b17 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 17 Oct 2024 12:41:53 +0200 Subject: [PATCH] Smaller bundle for `gql` Casting, instead of wrapping, the existing `gql` function, save ~60 bytes, and avoid an extra function call at runtime --- .changeset/dirty-seals-heal.md | 5 +++++ packages/apollo-angular/src/gql.ts | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/dirty-seals-heal.md diff --git a/.changeset/dirty-seals-heal.md b/.changeset/dirty-seals-heal.md new file mode 100644 index 000000000..73f5a63c7 --- /dev/null +++ b/.changeset/dirty-seals-heal.md @@ -0,0 +1,5 @@ +--- +'apollo-angular': patch +--- + +Smaller bundle for `gql` diff --git a/packages/apollo-angular/src/gql.ts b/packages/apollo-angular/src/gql.ts index 8a318531c..33b2a1775 100644 --- a/packages/apollo-angular/src/gql.ts +++ b/packages/apollo-angular/src/gql.ts @@ -1,11 +1,9 @@ import { gql as gqlTag, TypedDocumentNode } from '@apollo/client/core'; -function typedGQLTag( +const typedGQLTag: ( literals: ReadonlyArray | Readonly, ...placeholders: any[] -): TypedDocumentNode { - return gqlTag(literals, ...placeholders); -} +) => TypedDocumentNode = gqlTag; export const gql = typedGQLTag; export const graphql = typedGQLTag;