Skip to content

Commit

Permalink
fix(start): correct input config types (#2690)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekochan0122 authored Nov 1, 2024
1 parent ab3f744 commit 4b6dc21
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/start/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,10 @@ const inlineConfigSchema = z.object({
server: serverSchema.optional(),
})

export type TanStackStartDefineConfigOptions = z.infer<
typeof inlineConfigSchema
>
export type TanStackStartInputConfig = z.input<typeof inlineConfigSchema>
export type TanStackStartOutputConfig = z.infer<typeof inlineConfigSchema>

function setTsrDefaults(config: TanStackStartDefineConfigOptions['tsr']) {
function setTsrDefaults(config: TanStackStartOutputConfig['tsr']) {
// Normally these are `./src/___`, but we're using `./app/___` for Start stuff
const appDirectory = config?.appDirectory ?? './app'
return {
Expand Down Expand Up @@ -265,9 +264,7 @@ function mergeSsrOptions(options: Array<vite.SSROptions | undefined>) {
return ssrOptions
}

export function defineConfig(
inlineConfig: TanStackStartDefineConfigOptions = {},
) {
export function defineConfig(inlineConfig: TanStackStartInputConfig = {}) {
const opts = inlineConfigSchema.parse(inlineConfig)

const { preset: configDeploymentPreset, ...serverOptions } =
Expand Down Expand Up @@ -483,10 +480,7 @@ function withPlugins(prePlugins: Array<any>, postPlugins?: Array<any>) {
}
}

function withStartPlugins(
opts: TanStackStartDefineConfigOptions,
router: RouterType,
) {
function withStartPlugins(opts: TanStackStartOutputConfig, router: RouterType) {
const tsrConfig = getConfig(setTsrDefaults(opts.tsr))
const { userConfig } = getUserConfig(opts.vite)
const { userConfig: routerUserConfig } = getUserConfig(
Expand Down

0 comments on commit 4b6dc21

Please sign in to comment.