Skip to content

Commit e1a82cb

Browse files
authored
Merge pull request #4 from daesdev/copilot/resolve-all-fix-types
2 parents 3615978 + e699376 commit e1a82cb

4 files changed

Lines changed: 28 additions & 19 deletions

File tree

components/Footer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { PageProps } from "$fresh/server.ts";
21
import translations from "../locales/es.json" with { type: "json" };
3-
interface State {
2+
3+
interface FooterProps {
44
state: { lang: string; translations: typeof translations };
55
}
6-
export default function Footer({ state }: PageProps<State>) {
6+
7+
export default function Footer({ state }: FooterProps) {
78
const { lang: _lang, translations } = state;
89
return (
910
<footer class="text-center text-xs w-full py-1 mt-10 mb-20">

routes/[lang]/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,23 @@ import AnchorLang from "../../islands/AnchorLang.tsx";
88
import translations from "../../locales/es.json" with { type: "json" };
99
import { getLanguages } from "../../utils/global.ts";
1010

11-
export const handler: Handlers = {
11+
interface MiddlewareState {
12+
lang: string;
13+
translations: typeof translations;
14+
}
15+
16+
interface Data {
17+
languages: string[];
18+
}
19+
20+
export const handler: Handlers<Data, MiddlewareState> = {
1221
async GET(_, ctx) {
1322
const languages = await getLanguages(); // Obtén los lenguajes en el servidor
1423
return ctx.render({ languages });
1524
},
1625
};
1726

18-
interface State {
19-
state: { lang: string; translations: typeof translations };
20-
languages: string[];
21-
}
22-
23-
export default function Home({ state, data }: PageProps<State>) {
27+
export default function Home({ state, data }: PageProps<Data, MiddlewareState>) {
2428
const { lang, translations } = state;
2529
const { languages } = data;
2630
return (

routes/_404.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Head } from "$fresh/runtime.ts";
2-
import { pageProps } from "$fresh/server.ts";
3-
export default function Error404(_props: pageProps<{ message: string }>) {
2+
import { PageProps } from "$fresh/server.ts";
3+
export default function Error404(_props: PageProps<{ message: string }>) {
44
return (
55
<>
66
<Head>

routes/index.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ import AnchorLang from "../islands/AnchorLang.tsx";
77
import translations from "../locales/es.json" with { type: "json" };
88
import { getLanguages } from "../utils/global.ts";
99

10-
export const handler: Handlers = {
10+
interface MiddlewareState {
11+
lang: string;
12+
translations: typeof translations;
13+
}
14+
15+
interface Data {
16+
languages: string[];
17+
}
18+
19+
export const handler: Handlers<Data, MiddlewareState> = {
1120
async GET(_, ctx) {
1221
const languages = await getLanguages(); // Obtén los lenguajes en el servidor
1322
return ctx.render({ languages });
1423
},
1524
};
1625

17-
interface State {
18-
state: { lang: string; translations: typeof translations };
19-
languages: string[];
20-
}
21-
22-
export default function Home({ state, data }: PageProps<State>) {
26+
export default function Home({ state, data }: PageProps<Data, MiddlewareState>) {
2327
const { lang, translations } = state;
2428
const { languages } = data;
2529
return (

0 commit comments

Comments
 (0)