Skip to content

Commit 6403757

Browse files
committed
fix: broken types with defineConfig
1 parent aea271a commit 6403757

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

packages/core/src/types.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ export interface ResolvedUserConfig {
354354
* Provide a budget for each page as a numeric total score, or an object mapping the category to the score. Should be
355355
* a number between 1-100.
356356
*/
357-
budget: number | Record<Partial<LighthouseCategories>, number>
357+
budget: number | Partial<Record<LighthouseCategories, number>>
358358
/**
359359
* Injects the required data into the client files, so it can be hosted statically.
360360
*/
@@ -521,7 +521,11 @@ export interface ResolvedUserConfig {
521521
export type ClientOptionsPayload = Pick<ResolvedUserConfig, 'client' | 'site' | 'lighthouseOptions' | 'scanner' | 'routerPrefix'>
522522
& Pick<RuntimeSettings, 'websocketUrl' | 'apiUrl'>
523523

524-
export type UserConfig = Partial<ResolvedUserConfig>
524+
type DeepPartial<T> = {
525+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K]
526+
}
527+
528+
export type UserConfig = DeepPartial<ResolvedUserConfig>
525529

526530
export interface RuntimeSettings {
527531
/**

test/types.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { describe, it } from 'vitest'
2+
import { defineConfig } from '../packages/core/src'
3+
4+
describe('types', () => {
5+
it('cache on', async () => {
6+
defineConfig({
7+
site: 'https://unlighthouse.dev',
8+
ci: {
9+
budget: {
10+
seo: 60,
11+
}
12+
}
13+
})
14+
})
15+
})

0 commit comments

Comments
 (0)