From 88f8ce230145d1d54b79774e919abdbc34d263fe Mon Sep 17 00:00:00 2001 From: Tomasz Chmielnicki Date: Mon, 11 Aug 2025 11:41:00 +0200 Subject: [PATCH] test: Fetch keys parameter type inference --- test/index.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/index.test.ts b/test/index.test.ts index e6e36b1..228d6e3 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -6,7 +6,8 @@ import { PickKeys, FetchKeys, postprocessQuery, - Api + Api, + PaginatedPublicArticleList } from './generated/__generated-api' import onCreateRoute from '../src/onCreateRoute' @@ -387,4 +388,14 @@ describe('API class', () => { }[] }>() }) + + it('infers array fetchKeys parameter type as const', () => { + const testFn = >( + fetchKeys: T + ) => fetchKeys + + const returnedFetchKeys = testFn(['author']) + // check if array fetchKeys are inferred as ["key"], not "key"[] when passed into a function + expectTypeOf(returnedFetchKeys).toEqualTypeOf<['author']>() + }) })