From 40b735f84378ac4c5129211ce3e3c64b82b98710 Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Sun, 18 Aug 2024 16:54:18 +0100 Subject: [PATCH] Expand test for invalid inclusion --- src/__tests__/api.test-d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/__tests__/api.test-d.ts b/src/__tests__/api.test-d.ts index 41c42589..2b2eee9c 100644 --- a/src/__tests__/api.test-d.ts +++ b/src/__tests__/api.test-d.ts @@ -178,6 +178,19 @@ describe('graphql()', () => { } `); + // NOTE: BigTodo's fields shouldn't be included here + const nestedFragment = graphql(` + fragment Object on SmallTodo @_unmask { + maxLength + ... on ITodo { + id + ... on BigTodo { + wallOfText + } + } + } + `); + expectTypeOf>().toEqualTypeOf<{ __typename: 'SmallTodo'; id: string; @@ -189,6 +202,11 @@ describe('graphql()', () => { id: string; maxLength: number | null; }>(); + + expectTypeOf>().toEqualTypeOf<{ + id: string; + maxLength: number | null; + }>(); }); it('should preserve object literal types for variables', () => {