Skip to content

Commit

Permalink
Fix all TypeScript errors (except Tabs which is ignored for now).
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrause committed Nov 19, 2024
1 parent 5e39b3d commit a2fb249
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
"editor.trimAutoWhitespace": false,
"files.eol": "\n",
"javascript.preferences.quoteStyle": "single",
"typescript.tsdk": "node_modules/typescript/lib", // Use the TypeScript SDK from the current project
}
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"vite-plugin-lib-inject-css": "^2.1.1",
"vite-plugin-svg-icons": "^2.0.1",
"typescript": "^5.6.3",
"@types/node": "^22.9.0",
"stylelint": "^16.10.0",
"stylelint-config-standard-scss": "^13.1.0",
"@biomejs/biome": "^1.9.4",
Expand Down
1 change: 1 addition & 0 deletions package.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const packageConfig = {

// Static analysis
'typescript': '^5.6.3',
'@types/node': '^22.9.0',
'stylelint': '^16.10.0',
'stylelint-config-standard-scss': '^13.1.0',
'@biomejs/biome': '^1.9.4',
Expand Down
4 changes: 2 additions & 2 deletions scripts/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const getServices = () => {

type ScriptArgs = {
values: {
help: boolean | undefined,
silent: boolean | undefined,
help?: undefined | boolean,
silent?: undefined | boolean,
},
positionals: Array<string>,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/context/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type FormArgs = React.ComponentProps<typeof Form>;
type Story = StoryObj<FormArgs>;

const FormWithState = (props: React.ComponentProps<typeof Form>) => {
const action = async (previousState: unknown, formData: FormData) => {
const action = async (previousState: unknown, formData: FormData): Promise<null> => {
if (typeof props.action === 'function') {
return props.action?.(formData);
return props.action?.(formData) ?? null;
}
return null;
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/context/Form/FormOptics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export { cl as FormClassNames };

export type FormContext<T> = {
formId: string,
accessor: O.OpticFor<T>,
//accessor: O.OpticFor<T>,
};
export const FormContext = React.createContext<null | FormContext<unknown>>(null);
export const useFormContext = <T,>(): FormContext<T> => {
Expand All @@ -43,7 +43,7 @@ export const Form = (props: FormProps) => {
const [wrapperRef, setWrapperRef] = React.useState<null | React.ComponentRef<'div'>>(null);

// Memoize to keep a stable reference
const context: FormContext = React.useMemo(() => ({ formId }), [formId]);
const context: FormContext<unknown> = React.useMemo(() => ({ formId }), [formId]);

const renderForm = ({ children }: { children: React.ReactNode }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigations/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type DefaultTabOption = {
className?: string,
};
const defaultTabOptions: DefaultTabOption[] = [1,2,3,4].map(index => {
return { index }
return { index };
});

type TabWithTriggerProps = React.PropsWithChildren<Partial<TabsArgs>> & {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
"exclude": [
"node_modules",
"**/*.spec.ts",
"src/components/navigations/Tabs/Tabs.stories.tsx", // TEMP: need to fix a few type errors
],
"include": [
//"vite.config.ts",
"app/**/*",
"src/**/*",
"scripts/**/*",
],
"references": [{ "path": "./tsconfig.node.json" }],
}
2 changes: 2 additions & 0 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"emitDeclarationOnly": true,
"composite": true,
"skipLibCheck": true,
"target": "es2022",
"module": "ESNext",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
Expand All @@ -19,5 +20,6 @@
},
"include": [
"vite.config.ts",
"scripts/**/*",
],
}

0 comments on commit a2fb249

Please sign in to comment.