Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
PickKeys,
FetchKeys,
postprocessQuery,
Api
Api,
PaginatedPublicArticleList
} from './generated/__generated-api'
import onCreateRoute from '../src/onCreateRoute'

Expand Down Expand Up @@ -387,4 +388,14 @@ describe('API class', () => {
}[]
}>()
})

it('infers array fetchKeys parameter type as const', () => {
const testFn = <T extends FetchKeys<PaginatedPublicArticleList>>(
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']>()
})
})