Skip to content

Commit 439866b

Browse files
committed
fix: Remove 'any' types by centralizing type definitions
1 parent 2dd1d24 commit 439866b

File tree

25 files changed

+281
-94
lines changed

25 files changed

+281
-94
lines changed

pages/[slug].page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ import { Headline1 } from '~/components/Headlines';
88
import { SectionContext } from '~/context';
99
import { DocsHelp } from '~/components/DocsHelp';
1010
import NextPrevButton from '~/components/NavigationButtons';
11+
import type { Frontmatter } from '~/types/common';
1112

1213
export async function getStaticPaths() {
1314
return getStaticMarkdownPaths('pages');
1415
}
15-
export async function getStaticProps(args: any) {
16+
export async function getStaticProps(args: { params?: { slug: string } }) {
1617
return getStaticMarkdownProps(args, 'pages');
1718
}
1819

1920
export default function StaticMarkdownPage({
2021
frontmatter,
2122
content,
2223
}: {
23-
frontmatter: any;
24-
content: any;
24+
frontmatter: Frontmatter;
25+
content: string;
2526
}) {
2627
const fileRenderType = '_md';
2728
const newTitle = 'JSON Schema - ' + frontmatter.title;

pages/ambassadors/index.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function getStaticProps() {
2626
export default function ambassadorPages({
2727
ambassadorData,
2828
}: {
29-
ambassadorData: any;
29+
ambassadorData: string;
3030
}) {
3131
return (
3232
<SectionContext.Provider value='ambassador'>

pages/draft-05/index.page.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
88
import { Headline1 } from '~/components/Headlines';
99
import { DocsHelp } from '~/components/DocsHelp';
1010
import NextPrevButton from '~/components/NavigationButtons';
11+
import { Frontmatter } from '~/types/common';
1112

1213
export async function getStaticProps() {
1314
const index = fs.readFileSync('pages/draft-05/index.md', 'utf-8');
@@ -27,12 +28,23 @@ export async function getStaticProps() {
2728
};
2829
}
2930

31+
interface DraftFrontmatter extends Frontmatter {
32+
Specification?: string;
33+
Published?: string;
34+
Metaschema?: string;
35+
}
36+
37+
interface BlocksData {
38+
index: string;
39+
body: string;
40+
}
41+
3042
export default function ImplementationsPages({
3143
blocks,
3244
frontmatter,
3345
}: {
34-
blocks: any;
35-
frontmatter: any;
46+
blocks: BlocksData;
47+
frontmatter: DraftFrontmatter;
3648
}) {
3749
const fileRenderType = 'indexmd';
3850
return (

pages/draft-06/[slug].page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
77
import { Headline1 } from '~/components/Headlines';
88
import { SectionContext } from '~/context';
99
import { DocsHelp } from '~/components/DocsHelp';
10+
import { Frontmatter } from '~/types/common';
1011

1112
export async function getStaticPaths() {
1213
return getStaticMarkdownPaths('pages/draft-06');
1314
}
14-
export async function getStaticProps(args: any) {
15+
export async function getStaticProps(args: { params?: { slug: string } }) {
1516
return getStaticMarkdownProps(args, 'pages/draft-06');
1617
}
1718

1819
export default function StaticMarkdownPage({
1920
frontmatter,
2021
content,
2122
}: {
22-
frontmatter: any;
23-
content: any;
23+
frontmatter: Frontmatter;
24+
content: string;
2425
}) {
2526
const fileRenderType = '_md';
2627
const newTitle = 'JSON Schema - ' + frontmatter.title;
2728

2829
return (
29-
<SectionContext.Provider value={frontmatter.section || null}>
30+
<SectionContext.Provider value={frontmatter.section ?? null}>
3031
<Head>
3132
<title>{newTitle}</title>
3233
</Head>

pages/draft-06/index.page.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
88
import { Headline1 } from '~/components/Headlines';
99
import { DocsHelp } from '~/components/DocsHelp';
1010
import NextPrevButton from '~/components/NavigationButtons';
11+
import { Frontmatter } from '~/types/common';
1112

1213
export async function getStaticProps() {
1314
const index = fs.readFileSync('pages/draft-06/index.md', 'utf-8');
@@ -25,12 +26,22 @@ export async function getStaticProps() {
2526
};
2627
}
2728

29+
interface DraftFrontmatter extends Frontmatter {
30+
Specification?: string;
31+
Published?: string;
32+
Metaschema?: string;
33+
}
34+
35+
interface BlocksData {
36+
index: string;
37+
}
38+
2839
export default function ImplementationsPages({
2940
blocks,
3041
frontmatter,
3142
}: {
32-
blocks: any;
33-
frontmatter: any;
43+
blocks: BlocksData;
44+
frontmatter: DraftFrontmatter;
3445
}) {
3546
const fileRenderType = 'indexmd';
3647
return (

pages/draft-07/[slug].page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
77
import { Headline1 } from '~/components/Headlines';
88
import { SectionContext } from '~/context';
99
import { DocsHelp } from '~/components/DocsHelp';
10+
import { Frontmatter } from '~/types/common';
1011

1112
export async function getStaticPaths() {
1213
return getStaticMarkdownPaths('pages/draft-07');
1314
}
14-
export async function getStaticProps(args: any) {
15+
export async function getStaticProps(args: { params?: { slug: string } }) {
1516
return getStaticMarkdownProps(args, 'pages/draft-07');
1617
}
1718

1819
export default function StaticMarkdownPage({
1920
frontmatter,
2021
content,
2122
}: {
22-
frontmatter: any;
23-
content: any;
23+
frontmatter: Frontmatter;
24+
content: string;
2425
}) {
2526
const fileRenderType = '_md';
2627
const newTitle = 'JSON Schema - ' + frontmatter.title;
2728

2829
return (
29-
<SectionContext.Provider value={frontmatter.section || null}>
30+
<SectionContext.Provider value={frontmatter.section ?? null}>
3031
<Head>
3132
<title>{newTitle}</title>
3233
</Head>

pages/draft-07/index.page.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
88
import { Headline1 } from '~/components/Headlines';
99
import { DocsHelp } from '~/components/DocsHelp';
1010
import NextPrevButton from '~/components/NavigationButtons';
11+
import { Frontmatter } from '~/types/common';
1112

1213
export async function getStaticProps() {
1314
const index = fs.readFileSync('pages/draft-07/index.md', 'utf-8');
@@ -25,12 +26,22 @@ export async function getStaticProps() {
2526
};
2627
}
2728

29+
interface DraftFrontmatter extends Frontmatter {
30+
Specification?: string;
31+
Published?: string;
32+
Metaschema?: string;
33+
}
34+
35+
interface BlocksData {
36+
index: string;
37+
}
38+
2839
export default function ImplementationsPages({
2940
blocks,
3041
frontmatter,
3142
}: {
32-
blocks: any;
33-
frontmatter: any;
43+
blocks: BlocksData;
44+
frontmatter: DraftFrontmatter;
3445
}) {
3546
const fileRenderType = 'indexmd';
3647
return (

pages/draft/2019-09/[slug].page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
77
import { Headline1 } from '~/components/Headlines';
88
import { SectionContext } from '~/context';
99
import { DocsHelp } from '~/components/DocsHelp';
10+
import { Frontmatter } from '~/types/common';
1011

1112
export async function getStaticPaths() {
1213
return getStaticMarkdownPaths('pages/draft/2019-09');
1314
}
14-
export async function getStaticProps(args: any) {
15+
export async function getStaticProps(args: { params?: { slug: string } }) {
1516
return getStaticMarkdownProps(args, 'pages/draft/2019-09');
1617
}
1718

1819
export default function StaticMarkdownPage({
1920
frontmatter,
2021
content,
2122
}: {
22-
frontmatter: any;
23-
content: any;
23+
frontmatter: Frontmatter;
24+
content: string;
2425
}) {
2526
const fileRenderType = '_md';
2627
const newTitle = 'JSON Schema - ' + frontmatter.title;
2728

2829
return (
29-
<SectionContext.Provider value={frontmatter.section || null}>
30+
<SectionContext.Provider value={frontmatter.section ?? null}>
3031
<Head>
3132
<title>{newTitle}</title>
3233
</Head>

pages/draft/2019-09/index.page.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
88
import { Headline1 } from '~/components/Headlines';
99
import { DocsHelp } from '~/components/DocsHelp';
1010
import NextPrevButton from '~/components/NavigationButtons';
11+
import { Frontmatter } from '~/types/common';
1112

1213
export async function getStaticProps() {
1314
const index = fs.readFileSync('pages/draft/2019-09/index.md', 'utf-8');
@@ -24,12 +25,22 @@ export async function getStaticProps() {
2425
};
2526
}
2627

28+
interface DraftFrontmatter extends Frontmatter {
29+
Specification?: string;
30+
Published?: string;
31+
Metaschema?: string;
32+
}
33+
34+
interface BlocksData {
35+
index: string;
36+
}
37+
2738
export default function ImplementationsPages({
2839
blocks,
2940
frontmatter,
3041
}: {
31-
blocks: any;
32-
frontmatter: any;
42+
blocks: BlocksData;
43+
frontmatter: DraftFrontmatter;
3344
}) {
3445
const fileRenderType = 'indexmd';
3546
return (

pages/draft/2020-12/[slug].page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
77
import { Headline1 } from '~/components/Headlines';
88
import { SectionContext } from '~/context';
99
import { DocsHelp } from '~/components/DocsHelp';
10+
import { Frontmatter } from '~/types/common';
1011

1112
export async function getStaticPaths() {
1213
return getStaticMarkdownPaths('pages/draft/2020-12');
1314
}
14-
export async function getStaticProps(args: any) {
15+
export async function getStaticProps(args: { params?: { slug: string } }) {
1516
return getStaticMarkdownProps(args, 'pages/draft/2020-12');
1617
}
1718

1819
export default function StaticMarkdownPage({
1920
frontmatter,
2021
content,
2122
}: {
22-
frontmatter: any;
23-
content: any;
23+
frontmatter: Frontmatter;
24+
content: string;
2425
}) {
2526
const fileRenderType = '_md';
2627
const newTitle = 'JSON Schema - ' + frontmatter.title;
2728

2829
return (
29-
<SectionContext.Provider value={frontmatter.section || null}>
30+
<SectionContext.Provider value={frontmatter.section ?? null}>
3031
<Head>
3132
<title>{newTitle}</title>
3233
</Head>

0 commit comments

Comments
 (0)