Skip to content

Commit

Permalink
types: avoid overriding app runtime config namespace (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jun 21, 2023
1 parent c5dd2a1 commit b926dd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
NitroOptions,
NitroRouteConfig,
NitroRouteRules,
NitroRuntimeConfig,
} from "./types";
import { runtimeDir, pkgDir } from "./dirs";
import * as _PRESETS from "./presets";
Expand Down Expand Up @@ -368,7 +369,7 @@ export function normalizeRuntimeConfig(config: NitroConfig) {
nitro: {},
});
runtimeConfig.nitro.routeRules = config.routeRules;
return runtimeConfig;
return runtimeConfig as NitroRuntimeConfig;
}

export function normalizeRouteRules(
Expand Down
12 changes: 10 additions & 2 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ export type NitroDynamicConfig = Pick<
"runtimeConfig" | "routeRules"
>;

export interface NitroRuntimeConfigApp {
baseURL: string;
[key: string]: any;
}

export interface NitroRuntimeConfig {
app: {
baseURL: string;
app: NitroRuntimeConfigApp;
nitro: {
routeRules?: {
[path: string]: NitroRouteConfig;
};
};
[key: string]: any;
}
Expand Down

0 comments on commit b926dd0

Please sign in to comment.