Browse Source
* fix(preferences): type custom preference updates * style(preferences): order type test importspull/8383/head
committed by
GitHub
3 changed files with 31 additions and 1 deletions
@ -0,0 +1,5 @@ |
|||||
|
--- |
||||
|
'@vben-core/preferences': patch |
||||
|
--- |
||||
|
|
||||
|
fix(@vben-core/preferences): type custom preference updates |
||||
@ -0,0 +1,21 @@ |
|||||
|
import type { DeepPartial } from '@vben-core/typings'; |
||||
|
|
||||
|
import { describe, expectTypeOf, it } from 'vitest'; |
||||
|
|
||||
|
import { updateCustomPreferences } from '../src'; |
||||
|
|
||||
|
interface ProjectPreferences { |
||||
|
defaultTableSize: number; |
||||
|
tenantMode: 'multi' | 'single'; |
||||
|
} |
||||
|
|
||||
|
describe('custom preferences types', () => { |
||||
|
it('accepts a typed partial update', () => { |
||||
|
const updateProjectPreferences = |
||||
|
updateCustomPreferences<ProjectPreferences>; |
||||
|
|
||||
|
expectTypeOf(updateProjectPreferences) |
||||
|
.parameter(0) |
||||
|
.toEqualTypeOf<DeepPartial<ProjectPreferences>>(); |
||||
|
}); |
||||
|
}); |
||||
Loading…
Reference in new issue