integrate message-schema type definitions

This commit is contained in:
bedlam343 2024-04-03 10:55:33 -07:00
parent fbbd183c4b
commit 9c4b87eb1d
9 changed files with 862 additions and 44 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "submodules/message-schemas"]
path = submodules/message-schemas
url = https://git.tjdev.de/thi-sjsu-project/message-schemas

833
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,13 +12,15 @@
"format": "prettier --write .", "format": "prettier --write .",
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint --fix .", "lint:fix": "eslint --fix .",
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit",
"prepare": "ts-patch install && typia patch"
}, },
"dependencies": { "dependencies": {
"@reduxjs/toolkit": "^2.0.1", "@reduxjs/toolkit": "^2.0.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-redux": "^9.1.0" "react-redux": "^9.1.0",
"typia": "^5.5.10"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/dom": "^9.3.4", "@testing-library/dom": "^9.3.4",
@ -34,8 +36,10 @@
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"jsdom": "^23.2.0", "jsdom": "^23.2.0",
"prettier": "^3.2.1", "prettier": "^3.2.1",
"typescript": "^5.3.3", "ts-node": "^10.9.2",
"ts-patch": "^3.1.2",
"typescript": "^5.4.2",
"vite": "^5.0.11", "vite": "^5.0.11",
"vitest": "^1.2.0" "vitest": "^1.2.0"
} }
} }

View File

@ -8,6 +8,7 @@ const Prototype = () => {
useEffect(() => { useEffect(() => {
// use setInterval to run monitor every second (1000ms) // use setInterval to run monitor every second (1000ms)
const interval = setInterval(() => monitor({}), ONE_SECOND_IN_MS); const interval = setInterval(() => monitor({}), ONE_SECOND_IN_MS);
// clear interval when component unmounts to prevent memory leak
return () => clearInterval(interval); return () => clearInterval(interval);
}, []); }, []);

View File

@ -1,11 +1,11 @@
import React from "react"; import React from 'react';
import { createRoot } from "react-dom/client"; import { createRoot } from 'react-dom/client';
import { Provider } from "react-redux"; import { Provider } from 'react-redux';
import { store } from "src/redux/store"; import store from 'src/redux/store';
import App from "src/App"; import App from 'src/App';
import "src/index.css"; import 'src/index.css';
const container = document.getElementById("root"); const container = document.getElementById('root');
if (container) { if (container) {
const root = createRoot(container); const root = createRoot(container);

View File

@ -1,5 +1,7 @@
import type { Message } from 'submodules/message-schemas/schema-types';
type SelectorProps = { type SelectorProps = {
// define expected input here and it's type (number, string, etc.) message: Message;
}; };
/** /**
@ -8,7 +10,7 @@ type SelectorProps = {
* @returns ??? * @returns ???
*/ */
const useSelector = ({}: SelectorProps) => { const useSelector = ({}: SelectorProps) => {
console.log("useSelector"); console.log('useSelector');
}; };
export default useSelector; export default useSelector;

View File

@ -1,4 +1,4 @@
import { combineSlices, configureStore } from "@reduxjs/toolkit"; import { combineSlices, configureStore } from '@reduxjs/toolkit';
// pass in slices to combine into combineSlices() // pass in slices to combine into combineSlices()
// `combineSlices` automatically combines the reducers using // `combineSlices` automatically combines the reducers using
@ -12,13 +12,13 @@ const store = configureStore({
reducer: rootReducer, reducer: rootReducer,
// this is unnecessary, but included for demonstration purposes // this is unnecessary, but included for demonstration purposes
// since default middlewares are automatically included // since default middlewares are automatically included
middleware: getDefaultMiddleware => getDefaultMiddleware(), middleware: (getDefaultMiddleware) => getDefaultMiddleware(),
}); });
// Infer the type of `store` // Infer the type of `store`
type AppStore = typeof store; type AppStore = typeof store;
// Infer the `AppDispatch` type from the store itself // Infer the `AppDispatch` type from the store itself
type AppDispatch = AppStore["dispatch"]; type AppDispatch = AppStore['dispatch'];
export { store }; export default store;
export type { RootState, AppStore, AppDispatch }; export type { RootState, AppStore, AppDispatch };

@ -0,0 +1 @@
Subproject commit e92d57ab4226c46e97bdd5164f8121db67caf808

View File

@ -2,11 +2,17 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"src/*": ["./src/*"] "src/*": [
"./src/*"
]
}, },
"target": "ESNext", "target": "ESNext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"], "lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": false, "allowJs": false,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": false, "esModuleInterop": false,
@ -18,7 +24,19 @@
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
"types": ["vitest/globals"] "types": [
"vitest/globals"
],
"plugins": [
{
"transform": "typia/lib/transform"
}
],
"strictNullChecks": true
}, },
"references": [{ "path": "./tsconfig.node.json" }] "references": [
} {
"path": "./tsconfig.node.json"
}
]
}