Skip to content

Commit 0d6ffb1

Browse files
committed
Fix TypeScript errors
1 parent d265c01 commit 0d6ffb1

File tree

17 files changed

+125
-89
lines changed

17 files changed

+125
-89
lines changed

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const config = {
5656
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
5757
return defaultCreateFeedItems({
5858
// keep only the 10 most recent blog posts in the feed
59-
blogPosts: blogPosts.filter((item, index) => index < 10),
59+
blogPosts: blogPosts.filter((_, index) => index < 10),
6060
...rest,
6161
});
6262
},

dry-create-kolibri-templates/react-webpack/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import './App.css';
23
import { KolButton } from '@public-ui/react';
34

dry-create-kolibri-templates/react-webpack/src/declare.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ declare module '*.jpeg';
22
declare module '*.jpg';
33
declare module '*.png';
44
declare module '*.gif';
5+
declare module '@unocss/webpack';
6+
declare module '@unocss/preset-mini';

dry-create-kolibri-templates/react-webpack/src/react.main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { register } from '@public-ui/components';
23
import { defineCustomElements } from '@public-ui/components/dist/loader';
34
import { DEFAULT } from '@public-ui/themes';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"@docusaurus/types": "3.4.0",
5959
"@tsconfig/docusaurus": "2.0.3",
6060
"@types/prettier": "2.7.3",
61+
"@types/react-dom": "18.3.0",
6162
"@typescript-eslint/eslint-plugin": "7.18.0",
6263
"@typescript-eslint/parser": "7.18.0",
6364
"autoprefixer": "10.4.20",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/BitvTestResults.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ function parseResult(name: string, result: string) {
3232
}
3333

3434
export const BitvTestResult: FC = () => {
35-
const [data, setData] = useState([]);
35+
const [data, setData] = useState<{ component: string; bmf: string; zoll: string }[]>([]);
3636

3737
useEffect(() => {
3838
getDataFromExcel()
3939
.then((results) => {
40-
console.log(results);
40+
const typedResults = results as { [key: string]: string };
41+
console.log(typedResults);
4142
const data = [];
42-
for (const key in results) {
43+
for (const key in typedResults) {
4344
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
44-
data.push(parseResult(key, results[key]));
45+
data.push(parseResult(key, typedResults[key]));
4546
}
4647
setData(data);
4748
console.log(data);

src/components/LiveEditorCompact/types.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ export type TagName =
169169
| 'modal'
170170
| 'nav'
171171
| 'pagination'
172-
| 'popover'
173172
| 'progress'
174173
| 'quote'
175174
| 'select'
@@ -181,7 +180,6 @@ export type TagName =
181180
| 'tabs'
182181
| 'tag'
183182
| 'textarea'
184-
| 'toast'
185183
| 'tooltip'
186184
| 'version';
187185

src/components/Mermaid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type MermaidProps = {
99

1010
let mermaidTimeout: NodeJS.Timeout;
1111

12-
export const mermaidLoadContent = (config) => {
12+
export const mermaidLoadContent = (config: any) => {
1313
if (config) {
1414
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1515
mermaid.initialize(Object.assign({ startOnLoad: true }, config));

src/components/PropertiesOverview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ ELEMENTS.tags.forEach((tag) => {
5151
}
5252
const prop = PROPS.get(attribute.name);
5353
if (prop) {
54-
prop.get('components').add(componentName);
55-
prop.get('descriptions').add(attribute.description);
56-
prop.get('types').add(attribute.type.replace(/ \| undefined/g, ''));
54+
prop.get('components')?.add(componentName);
55+
prop.get('descriptions')?.add(attribute.description);
56+
prop.get('types')?.add(attribute.type.replace(/ \| undefined/g, ''));
5757
}
5858
});
5959
}

src/components/docs/ComponentList.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useDocsPreferredVersion } from '@docusaurus/theme-common';
44
import Link from '@docusaurus/Link';
55
import { KolBadge, KolCard, KolHeading } from '@public-ui/react';
66

7-
import type { Language } from '../../shares/language';
7+
import type { Language, Locale } from '../../shares/language';
88
import type { Version } from '../../shares/version';
99
import { COMPONENT_SYNONYMS } from '../../shares/synonyms';
1010
import type { Component } from '../samplePreviews';
@@ -30,7 +30,11 @@ const LazyLoadComponent: FC<
3030

3131
const formattedComponentName = name.charAt(0).toUpperCase() + name.slice(1);
3232

33-
const SampleComponent = loadComponent();
33+
interface SampleComponentProps {
34+
lang: Locale;
35+
}
36+
37+
const SampleComponent: React.FC<SampleComponentProps> = loadComponent();
3438
if (!loadComponent) {
3539
throw new Error(`Example component for ${name} not found`);
3640
}

0 commit comments

Comments
 (0)