Skip to content

Commit 7172bf5

Browse files
committed
feat: minimal valid ts setup for docs
1 parent 9101013 commit 7172bf5

10 files changed

Lines changed: 66 additions & 14 deletions

File tree

docs/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"serve": "docusaurus serve",
1313
"write-translations": "docusaurus write-translations",
1414
"write-heading-ids": "docusaurus write-heading-ids",
15-
"format-js": "prettier --write --list-different './**/*.{js,ts,tsx}'"
15+
"format-js": "prettier --write --list-different './**/*.{js,ts,tsx}'",
16+
"typecheck": "tsc"
1617
},
1718
"dependencies": {
1819
"@docusaurus/core": "3.9.2",
@@ -58,7 +59,8 @@
5859
"@docusaurus/module-type-aliases": "3.9.2",
5960
"@docusaurus/tsconfig": "3.9.2",
6061
"@docusaurus/types": "3.9.2",
61-
"raw-loader": "^4.0.2"
62+
"raw-loader": "^4.0.2",
63+
"typescript": "5.9.3"
6264
},
6365
"browserslist": {
6466
"production": [

docs/src/components/Grid/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
2+
import type { PropsWithChildren } from 'react';
23
import styles from './styles.module.css';
34

4-
export default function Grid({ children }) {
5+
export default function Grid({ children }: PropsWithChildren) {
56
return <div className={styles.container}>{children}</div>;
67
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
2+
import type { PropsWithChildren } from 'react';
23
import styles from './styles.module.css';
34

4-
export default function Indent({ children }) {
5+
export default function Indent({ children }: PropsWithChildren) {
56
return <div className={styles.container}>{children}</div>;
67
}

docs/src/components/Optional/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ interface Props {
55
footnote?: boolean;
66
}
77

8-
export default function Optional({ footnote }) {
8+
export default function Optional({ footnote }: Props) {
99
return <div className={styles.badge}>Optional{footnote ? '*' : ''}</div>;
1010
}

docs/src/components/Row/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
2+
import type { PropsWithChildren } from 'react';
23
import styles from './styles.module.css';
34

4-
export default function Row({ children }) {
5+
export default function Row({ children }: PropsWithChildren) {
56
return <div className={styles.container}>{children}</div>;
67
}

docs/src/theme/MDXComponents/DetailsStyling.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@ import { useCollapsible, Collapsible } from '@docusaurus/theme-common';
33
import clsx from 'clsx';
44
import React from 'react';
55
import { useRef, useState } from 'react';
6+
import type { ComponentProps, ReactElement, ReactNode } from 'react';
67

78
import styles from './styles.module.css';
89
import useIsBrowser from '@docusaurus/useIsBrowser';
910
import ThemedImage from '@theme/ThemedImage';
1011
import useBaseUrl from '@docusaurus/useBaseUrl';
1112

12-
const DetailsStyling = ({ summary, children, ...props }): JSX.Element => {
13+
interface DetailsStylingProps extends ComponentProps<'details'> {
14+
summary: ReactElement<{ children?: ReactNode }>;
15+
}
16+
17+
const DetailsStyling = ({
18+
summary,
19+
children,
20+
...props
21+
}: DetailsStylingProps): ReactElement => {
1322
const isBrowser = useIsBrowser();
1423
const { collapsed, setCollapsed } = useCollapsible({
1524
initialState: !props.open,
@@ -72,7 +81,6 @@ const DetailsStyling = ({ summary, children, ...props }): JSX.Element => {
7281
<Collapsible
7382
lazy={false}
7483
collapsed={collapsed}
75-
disableSSRStyle
7684
onCollapseTransitionEnd={newCollapsed => {
7785
setCollapsed(newCollapsed);
7886
setOpen(!newCollapsed);

docs/src/theme/muiTheme.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { experimental_extendTheme as extendTheme } from '@mui/material/styles';
1+
import { extendTheme } from '@mui/material/styles';
22

33
import Aeonik from '../../static/fonts/Aeonik-Regular.otf';
44

docs/src/types.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference types="@docusaurus/module-type-aliases" />
2+
/// <reference types="@docusaurus/theme-classic" />
3+
4+
// t-rex-ui publishes no type declarations (its package.json points at a
5+
// dist/main.d.ts that is not shipped). Only the exports used from checked
6+
// TypeScript files are declared here; the .js theme overrides that import
7+
// its components are not typechecked and need no declarations.
8+
declare module '@swmansion/t-rex-ui' {
9+
export interface BannerZone {
10+
zoneId: string;
11+
contentId: string;
12+
fallbackBgColor?: string;
13+
}
14+
}
15+
16+
declare module '*.otf';

docs/tsconfig.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
2-
"extends": "../tsconfig.base.json",
2+
"extends": "@docusaurus/tsconfig",
33
"compilerOptions": {
44
"baseUrl": ".",
5+
"strict": true,
6+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
57
"paths": {
68
"@site/*": ["./*"],
79
"react-native-enriched-html": ["../src/index.tsx"]
8-
},
10+
}
911
},
10-
"exclude": [".docusaurus", "build"],
11-
"include": ["src/examples"]
12-
}
12+
"include": ["src"],
13+
"exclude": [".docusaurus", "build"]
14+
}

docs/yarn.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7395,6 +7395,7 @@ __metadata:
73957395
react-dom: "npm:19.1.1"
73967396
react-native: "npm:0.86.0"
73977397
react-native-web: "npm:0.21.2"
7398+
typescript: "npm:5.9.3"
73987399
languageName: unknown
73997400
linkType: soft
74007401

@@ -14798,6 +14799,26 @@ __metadata:
1479814799
languageName: node
1479914800
linkType: hard
1480014801

14802+
"typescript@npm:5.9.3":
14803+
version: 5.9.3
14804+
resolution: "typescript@npm:5.9.3"
14805+
bin:
14806+
tsc: bin/tsc
14807+
tsserver: bin/tsserver
14808+
checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5
14809+
languageName: node
14810+
linkType: hard
14811+
14812+
"typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>":
14813+
version: 5.9.3
14814+
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
14815+
bin:
14816+
tsc: bin/tsc
14817+
tsserver: bin/tsserver
14818+
checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
14819+
languageName: node
14820+
linkType: hard
14821+
1480114822
"ua-parser-js@npm:^1.0.35":
1480214823
version: 1.0.41
1480314824
resolution: "ua-parser-js@npm:1.0.41"

0 commit comments

Comments
 (0)