Skip to content

Commit

Permalink
allow passing single generic argument to mergeConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Aug 20, 2023
1 parent ea367b4 commit ca450e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/merge-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConfigExtension, GenericConfig } from './types'
* @param baseConfig Config where other config will be merged into. This object will be mutated.
* @param configExtension Partial config to merge into the `baseConfig`.
*/
export function mergeConfigs<ClassGroupIds extends string, ThemeGroupIds extends string>(
export function mergeConfigs<ClassGroupIds extends string, ThemeGroupIds extends string = never>(
baseConfig: GenericConfig,
{
cacheSize,
Expand Down
4 changes: 4 additions & 0 deletions tests/type-generics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,8 @@ test('mergeConfigs type generics work correctly', () => {
const config2 = mergeConfigs<'very', 'strict'>(getDefaultConfig(), {})

expect(config2).toEqual(expect.any(Object))

const config3 = mergeConfigs<'single-arg'>(getDefaultConfig(), {})

expect(config3).toEqual(expect.any(Object))
})

0 comments on commit ca450e4

Please sign in to comment.