You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.
@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}↓
| import { useContext } from 'react'; | |
| import { createStore, createEffect, createEvent, sample, attach, combine, restore } from 'effector'; | |
| import { spread, debug, not, and, empty, or } from 'patronum'; | |
| import { createGate, useGate } from 'effector-react'; | |
| import { | |
| useLocation, | |
| useNavigate, | |
| matchPath, | |
| generatePath, | |
| RouteMatch, |
| import { createContext, ReactNode, useContext } from "react"; | |
| import { | |
| ControllerInjectedResult, | |
| Form as FormType, | |
| useForm, | |
| useFieldArray, | |
| } from "effector-react-form"; | |
| import { FieldArray, ResultUseFieldArray } from "effector-react-form/types/ts"; | |
| export const FormContext = createContext<any>(null); |
| /*** function that used as middleware ***/ | |
| accessToken: async (name) => { | |
| if (typeof document === "undefined") return ""; | |
| let token = document.cookie | |
| .split(";") | |
| .filter((cookie) => cookie.startsWith("token"))[0]; | |
| if (!token) { | |
| const response = await fetch("/api/refresh", { method: "POST" }); |
| type AnyFunction = (...args: any[]) => any | |
| function useEvent<T extends AnyFunction>(callback?: T) { | |
| const ref = useRef<AnyFunction | undefined>(() => { | |
| throw new Error("Cannot call an event handler while rendering.") | |
| }) | |
| // Or useInsertionEffect if it's React 18 | |
| useLayoutEffect(() => { | |
| ref.current = callback | |
| }) |
| import React from 'react'; | |
| import { useEvent, useStore } from 'effector-react'; | |
| import { $counter, dec, inc, reset } from './counter'; | |
| export const App = () => { | |
| const counter = useStore($counter); | |
| const api = useEvent({ inc, dec, reset }); | |
| return ( | |
| <div> |
| import { forward } from "effector"; | |
| import { createGate } from "effector-react"; | |
| import { createCached } from "store/helpers"; | |
| export const delegationSelectGage = createGate(); | |
| const [doFetch, $delegation, $loading] = createCached<void, Data[]>( | |
| fetchDelegations, | |
| "delegation" | |
| ); |
| import { createStore, createEvent, type Event, type Store } from "effector"; | |
| import { useStoreMap, useEvent } from "effector-react/scope"; | |
| import { useCallback } from "react"; | |
| type Key = string; | |
| type SetPayload<T> = { key: Key; value: T }; | |
| type KeyValueStore<T> = Record<Key, T>; | |
| type KV<T> = { | |
| set: Event<SetPayload<T>>; |
| // In TS, interfaces are "open" and can be extended | |
| interface Date { | |
| /** | |
| * Give a more precise return type to the method `toISOString()`: | |
| * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString | |
| */ | |
| toISOString(): TDateISO; | |
| } | |
| type TYear = `${number}${number}${number}${number}`; |