diff --git a/packages/argparse/src/argparse.ts b/packages/argparse/src/argparse.ts index f064f82..1183fd8 100644 --- a/packages/argparse/src/argparse.ts +++ b/packages/argparse/src/argparse.ts @@ -1,7 +1,7 @@ import {relative} from 'path' -export type TArgTypeName = 'string' | 'string[]' | 'number' | 'boolean' -export type TArgType = +export type ArgTypeName = 'string' | 'string[]' | 'number' | 'boolean' +export type ArgType = T extends 'string' ? string : T extends 'string[]' @@ -16,29 +16,29 @@ export const N_ONE_OR_MORE = '+' export const N_ZERO_OR_MORE = '*' export const N_DEFAULT_VALUE = 1 -export type TNumberOfArgs = number | '+' | '*' +export type NumberOfArgs = number | '+' | '*' -export interface ArgParam { +export interface ArgParam { alias?: string description?: string - default?: TArgType - choices?: Array> + default?: ArgType + choices?: Array> required?: boolean positional?: boolean - n?: TNumberOfArgs + n?: NumberOfArgs } -export interface Argument extends ArgParam { +export interface Argument extends ArgParam { type: T } export interface ArgsConfig { - [arg: string]: Argument + [arg: string]: Argument } -export type TArgs = { +export type Args = { [k in keyof T]: T[k] extends Argument ? - TArgType : never + ArgType : never } interface Iterator { @@ -72,7 +72,7 @@ function assert(cond: boolean, message: string) { } } -function getDefaultValue(type: TArgTypeName) { +function getDefaultValue(type: ArgTypeName) { switch (type) { case 'number': return NaN @@ -133,7 +133,7 @@ function extractArray( it: Iterator, argument: string, isPositional: boolean, - n: TNumberOfArgs = N_DEFAULT_VALUE, + n: NumberOfArgs = N_DEFAULT_VALUE, ): string[] { function getLimit() { const l = typeof n === 'number' ? n : Infinity @@ -173,7 +173,7 @@ function help(command: string, config: ArgsConfig, desc = '') { function getArrayHelp( k: string, required?: boolean, - n: TNumberOfArgs = N_DEFAULT_VALUE, + n: NumberOfArgs = N_DEFAULT_VALUE, ) { k = k.toUpperCase() if (n === N_ZERO_OR_MORE) { @@ -194,7 +194,7 @@ function help(command: string, config: ArgsConfig, desc = '') { return required ? array.join(' ') : `[${array.join(' ')}]` } - function getDescription(argConfig: Argument): string { + function getDescription(argConfig: Argument): string { const samples = [] if (argConfig.required) { samples.push('required') @@ -218,7 +218,7 @@ function help(command: string, config: ArgsConfig, desc = '') { } function getArgType( - type: TArgTypeName, argument: string, required?: boolean, n?: TNumberOfArgs, + type: ArgTypeName, argument: string, required?: boolean, n?: NumberOfArgs, ): string { return type === 'string[]' ? getArrayHelp(argument, required, n) @@ -272,7 +272,7 @@ function help(command: string, config: ArgsConfig, desc = '') { .join('\n\n') } -export function arg( +export function arg( type: T, config: ArgParam = {}, ): Argument { @@ -290,7 +290,7 @@ export function argparse( log: (message: string) => void = console.log.bind(console), ) { return { - parse(args: string[]): TArgs { + parse(args: string[]): Args { const command = args[0] args = args.slice(1) const result: any = {} // eslint-disable-line diff --git a/packages/client/src/components/index.ts b/packages/client/src/components/index.ts index e37358e..e07f65f 100644 --- a/packages/client/src/components/index.ts +++ b/packages/client/src/components/index.ts @@ -1,6 +1,5 @@ // export * from './Component' export * from './Button' -export * from './IWithRouterProps' export * from './Input' export * from './Link' export * from './Modal' @@ -8,3 +7,4 @@ export * from './Redirect' export * from './ReturnHere' export * from './TimeAgo' export * from './withHistory' +export * from './WithRouterProps' diff --git a/packages/client/src/crud/CRUDForm.tsx b/packages/client/src/crud/CRUDForm.tsx index dab85f8..2254180 100644 --- a/packages/client/src/crud/CRUDForm.tsx +++ b/packages/client/src/crud/CRUDForm.tsx @@ -2,7 +2,7 @@ import React from 'react' import {Control, Field, Heading, Icon, Input} from 'bloomer' import {CRUDChangeParams} from './CRUDActions' -export type TCRUDFieldType = 'text' | 'password' | 'number' | 'email' | 'tel' +export type CRUDFieldType = 'text' | 'password' | 'number' | 'email' | 'tel' export interface CRUDFieldProps { id?: number @@ -12,22 +12,22 @@ export interface CRUDFieldProps { label: string placeholder?: string name: keyof T & string - type: TCRUDFieldType + type: CRUDFieldType value: string } -export type TCRUDErrors = Partial> +export type CRUDErrors = Partial> export interface CRUDField { Icon?: React.ComponentType label: string placeholder?: string name: keyof T & string - type: TCRUDFieldType + type: CRUDFieldType } export interface CRUDFormProps { - errors: TCRUDErrors + errors: CRUDErrors id?: number item?: T error: string diff --git a/packages/client/src/crud/CRUDReducer.ts b/packages/client/src/crud/CRUDReducer.ts index 3affc38..85a5c6d 100644 --- a/packages/client/src/crud/CRUDReducer.ts +++ b/packages/client/src/crud/CRUDReducer.ts @@ -15,10 +15,10 @@ export interface CRUDState { readonly ids: ReadonlyArray readonly byId: Record readonly status: CRUDStatus - readonly form: CRUDForm + readonly form: CRUDFormState } -export interface CRUDForm { +export interface CRUDFormState { readonly createItem: Pick> readonly createErrors: Partial> diff --git a/packages/client/src/crumbs/Crumb.tsx b/packages/client/src/crumbs/Crumb.tsx index e6d2cd6..4854767 100644 --- a/packages/client/src/crumbs/Crumb.tsx +++ b/packages/client/src/crumbs/Crumb.tsx @@ -1,7 +1,7 @@ +import { Breadcrumb, BreadcrumbItem } from 'bloomer' import React from 'react' -import {Breadcrumb, BreadcrumbItem} from 'bloomer' -import {Link} from 'react-router-dom' -import {CrumbLink} from './CrumbLink' +import { Link } from 'react-router-dom' +import { CrumbLink } from './CrumbLink' export interface CrumbProps { links: CrumbLink[] diff --git a/packages/client/src/crumbs/Crumbs.test.tsx b/packages/client/src/crumbs/Crumbs.test.tsx index f0de691..6078b0a 100644 --- a/packages/client/src/crumbs/Crumbs.test.tsx +++ b/packages/client/src/crumbs/Crumbs.test.tsx @@ -1,7 +1,7 @@ import React from 'react' -import {Crumb} from './Crumb' -import {TestUtils} from '../test-utils' -import {MemoryRouter} from 'react-router-dom' +import { MemoryRouter } from 'react-router-dom' +import { TestUtils } from '../test-utils' +import { Crumb } from './Crumb' const t = new TestUtils() diff --git a/packages/client/src/crumbs/CrumbsActions.ts b/packages/client/src/crumbs/CrumbsActions.ts index b81f150..d6b4510 100644 --- a/packages/client/src/crumbs/CrumbsActions.ts +++ b/packages/client/src/crumbs/CrumbsActions.ts @@ -1,15 +1,10 @@ -import {GetAllActions, Action} from '@rondo.dev/redux' -import {CrumbLink} from './CrumbLink' - -export interface Crumbs { - links: CrumbLink[] - current: string -} +import { Action, GetAllActions } from '@rondo.dev/redux' +import { CrumbsState } from './CrumbsState' export type CrumbsAction = GetAllActions export class CrumbsActions { - setCrumbs(breadcrumbs: Crumbs): Action { + setCrumbs(breadcrumbs: CrumbsState): Action { return { payload: breadcrumbs, type: 'BREADCRUMBS_SET', diff --git a/packages/client/src/crumbs/CrumbsReducer.tsx b/packages/client/src/crumbs/CrumbsReducer.tsx index cbe63fb..9a3dd09 100644 --- a/packages/client/src/crumbs/CrumbsReducer.tsx +++ b/packages/client/src/crumbs/CrumbsReducer.tsx @@ -1,7 +1,5 @@ -import {Crumbs, CrumbsAction} from './CrumbsActions' - -export interface CrumbsState extends Crumbs { -} +import { CrumbsAction } from './CrumbsActions' +import { CrumbsState } from './CrumbsState' const defaultState: CrumbsState = { links: [], diff --git a/packages/client/src/crumbs/CrumbsState.ts b/packages/client/src/crumbs/CrumbsState.ts new file mode 100644 index 0000000..f2d86ab --- /dev/null +++ b/packages/client/src/crumbs/CrumbsState.ts @@ -0,0 +1,6 @@ +import { CrumbLink } from "./CrumbLink"; + +export interface CrumbsState { + links: CrumbLink[] + current: string +} diff --git a/packages/client/src/crumbs/configureCrumbs.test.tsx b/packages/client/src/crumbs/configureCrumbs.test.tsx index 5e28c13..6bcea64 100644 --- a/packages/client/src/crumbs/configureCrumbs.test.tsx +++ b/packages/client/src/crumbs/configureCrumbs.test.tsx @@ -1,7 +1,7 @@ -import * as Feature from './' import React from 'react' -import {MemoryRouter} from 'react-router-dom' -import {TestUtils} from '../test-utils' +import { MemoryRouter } from 'react-router-dom' +import { TestUtils } from '../test-utils' +import * as Feature from './' const t = new TestUtils() diff --git a/packages/client/src/crumbs/configureCrumbs.tsx b/packages/client/src/crumbs/configureCrumbs.tsx index f004f38..1af8e77 100644 --- a/packages/client/src/crumbs/configureCrumbs.tsx +++ b/packages/client/src/crumbs/configureCrumbs.tsx @@ -1,9 +1,9 @@ -import { pack, TStateSelector } from '@rondo.dev/redux' +import { pack, SelectState } from '@rondo.dev/redux' import { Crumb } from './Crumb' -import { ICrumbsState } from './CrumbsReducer' +import { CrumbsState } from './CrumbsState' export function configureCrumbs( - getLocalState: TStateSelector, + getLocalState: SelectState, ) { return pack( getLocalState, diff --git a/packages/client/src/crumbs/index.ts b/packages/client/src/crumbs/index.ts index e32092e..7008800 100644 --- a/packages/client/src/crumbs/index.ts +++ b/packages/client/src/crumbs/index.ts @@ -1,6 +1,7 @@ export * from './configureCrumbs' export * from './Crumb' +export * from './CrumbLink' export * from './CrumbsActions' export * from './CrumbsReducer' +export * from './CrumbsState' export * from './HistoryCrumbs' -export * from './CrumbLink' diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index c3d278b..1fee3ad 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -3,7 +3,6 @@ export * from './crud' export * from './crumbs' export * from './csrf' export * from './login' -export * from './redux' export * from './renderer' export * from './test-utils' diff --git a/packages/client/src/login/LoginActions.ts b/packages/client/src/login/LoginActions.ts index 1781057..65030f9 100644 --- a/packages/client/src/login/LoginActions.ts +++ b/packages/client/src/login/LoginActions.ts @@ -1,18 +1,18 @@ import { APIDef, Credentials, NewUser, UserProfile } from '@rondo.dev/common' import { HTTPClient } from '@rondo.dev/http-client' -import { Action, AsyncAction, createPendingAction, TGetAction } from '@rondo.dev/redux' +import { Action, AsyncAction, createPendingAction, GetAction } from '@rondo.dev/redux' -export type TLoginAction = +export type LoginAction = AsyncAction | AsyncAction | AsyncAction | Action<{redirectTo: string}, 'LOGIN_REDIRECT_SET'> -type TAction = TGetAction +type A = GetAction export const setRedirectTo = ( redirectTo: string, -): Action<{redirectTo: string}, 'LOGIN_REDIRECT_SET'> => { +): A<'LOGIN_REDIRECT_SET'> => { return { payload: {redirectTo}, type: 'LOGIN_REDIRECT_SET', diff --git a/packages/client/src/login/LoginReducer.ts b/packages/client/src/login/LoginReducer.ts index db6a62e..9674037 100644 --- a/packages/client/src/login/LoginReducer.ts +++ b/packages/client/src/login/LoginReducer.ts @@ -1,5 +1,5 @@ import {UserProfile} from '@rondo.dev/common' -import {TLoginAction} from './LoginActions' +import {LoginAction} from './LoginActions' export interface LoginState { readonly error: string @@ -17,7 +17,7 @@ const defaultState: LoginState = { export function Login( state = defaultState, - action: TLoginAction, + action: LoginAction, ): LoginState { switch (action.type) { // sync actions diff --git a/packages/client/src/login/configureLogin.ts b/packages/client/src/login/configureLogin.ts index 7d64b4c..5798eac 100644 --- a/packages/client/src/login/configureLogin.ts +++ b/packages/client/src/login/configureLogin.ts @@ -1,9 +1,9 @@ import { Credentials } from '@rondo.dev/common' -import { pack, TStateSelector } from '@rondo.dev/redux' +import { pack, SelectState } from '@rondo.dev/redux' import { bindActionCreators } from 'redux' import { LoginActions } from './LoginActions' import { LoginForm } from './LoginForm' -import { ILoginState } from './LoginReducer' +import { LoginState } from './LoginReducer' import { withForm } from './withForm' const defaultCredentials: Credentials = { @@ -12,7 +12,7 @@ const defaultCredentials: Credentials = { } export function configureLogin( - getLocalState: TStateSelector, + getLocalState: SelectState, loginActions: LoginActions, ) { return pack( diff --git a/packages/client/src/login/configureRegister.ts b/packages/client/src/login/configureRegister.ts index 53ec10b..4a711b8 100644 --- a/packages/client/src/login/configureRegister.ts +++ b/packages/client/src/login/configureRegister.ts @@ -1,12 +1,12 @@ -import { INewUser } from '@rondo.dev/common' -import { pack, TStateSelector } from '@rondo.dev/redux' +import { NewUser } from '@rondo.dev/common' +import { pack, SelectState } from '@rondo.dev/redux' import { bindActionCreators } from 'redux' import { LoginActions } from './LoginActions' -import { ILoginState } from './LoginReducer' +import { LoginState } from './LoginReducer' import { RegisterForm } from './RegisterForm' import { withForm } from './withForm' -const defaultCredentials: INewUser = { +const defaultCredentials: NewUser = { username: '', password: '', firstName: '', @@ -14,7 +14,7 @@ const defaultCredentials: INewUser = { } export function configureRegister( - getLocalState: TStateSelector, + getLocalState: SelectState, loginActions: LoginActions, ) { return pack( diff --git a/packages/client/src/renderer/ServerRenderer.tsx b/packages/client/src/renderer/ServerRenderer.tsx index db8d203..0373993 100644 --- a/packages/client/src/renderer/ServerRenderer.tsx +++ b/packages/client/src/renderer/ServerRenderer.tsx @@ -5,14 +5,14 @@ import { StaticRouterContext } from 'react-router' import { StaticRouter } from 'react-router-dom' import ssrPrepass from 'react-ssr-prepass' import { Store } from 'redux' -import { IClientConfig } from './IClientConfig' -import { IRenderer } from './IRenderer' +import { ClientConfig } from './ClientConfig' +import { Renderer } from './Renderer' interface ComponentWithFetchData { fetchData(): Promise } -export class ServerRenderer implements IRenderer { +export class ServerRenderer implements Renderer { constructor( readonly RootComponent: React.ComponentType, ) {} @@ -20,7 +20,7 @@ export class ServerRenderer implements IRenderer { url: string, store: Store, props: Props, - config: IClientConfig, + config: ClientConfig, host = '', headers: Record = {}, ) { diff --git a/packages/client/src/team/TeamEditor.tsx b/packages/client/src/team/TeamEditor.tsx index e6b0af1..d6af798 100644 --- a/packages/client/src/team/TeamEditor.tsx +++ b/packages/client/src/team/TeamEditor.tsx @@ -14,7 +14,7 @@ interface UpdateTeamProps { team: Team } -export type TTeamEditorProps = AddTeamProps | UpdateTeamProps +export type TeamEditorProps = AddTeamProps | UpdateTeamProps export interface TeamEditorState { // TODO use redux state for errors! @@ -23,8 +23,8 @@ export interface TeamEditorState { } export class TeamEditor -extends React.PureComponent { - constructor(props: TTeamEditorProps) { +extends React.PureComponent { + constructor(props: TeamEditorProps) { super(props) this.state = { error: '', @@ -34,7 +34,7 @@ extends React.PureComponent { getName(team?: Team) { return team ? team.name : '' } - componentWillReceiveProps(nextProps: TTeamEditorProps) { + componentWillReceiveProps(nextProps: TeamEditorProps) { if (nextProps.type === 'update') { const {team} = nextProps if (team !== (this.props as UpdateTeamProps).team) { diff --git a/packages/client/src/team/configureTeam.ts b/packages/client/src/team/configureTeam.ts index 152d502..ab215b1 100644 --- a/packages/client/src/team/configureTeam.ts +++ b/packages/client/src/team/configureTeam.ts @@ -1,10 +1,10 @@ import { TeamActions, UserActions } from '@rondo.dev/common' -import { bindActionCreators, pack, TStateSelector } from '@rondo.dev/redux' +import { bindActionCreators, pack, SelectState } from '@rondo.dev/redux' import { TeamManager } from './TeamManager' -import { ITeamState } from './TeamReducer' +import { TeamState } from './TeamReducer' export function configureTeam( - getLocalState: TStateSelector, + getLocalState: SelectState, teamActions: TeamActions, userActions: UserActions, ) { diff --git a/packages/client/src/test-utils/TestUtils.tsx b/packages/client/src/test-utils/TestUtils.tsx index 26b9b50..2317682 100644 --- a/packages/client/src/test-utils/TestUtils.tsx +++ b/packages/client/src/test-utils/TestUtils.tsx @@ -1,7 +1,7 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */ import React from 'react' import ReactDOM from 'react-dom' -import {createStore, TStateSelector, WaitMiddleware} from '@rondo.dev/redux' +import {createStore, SelectState, WaitMiddleware} from '@rondo.dev/redux' import {Provider} from 'react-redux' import { Action, @@ -14,7 +14,7 @@ import { interface RenderParams { reducers: ReducersMapObject - select: TStateSelector + select: SelectState } export class TestContainer extends React.Component<{}> { @@ -74,7 +74,7 @@ export class TestUtils { } const withComponent = ( - getComponent: (select: TStateSelector) => + getComponent: (select: SelectState) => React.ComponentType, ) => { const Component = getComponent(select) diff --git a/packages/jsonrpc/src/express.ts b/packages/jsonrpc/src/express.ts index 3231e31..b4acd0f 100644 --- a/packages/jsonrpc/src/express.ts +++ b/packages/jsonrpc/src/express.ts @@ -5,7 +5,7 @@ import { IDEMPOTENT_METHOD_REGEX } from './idempotent' import { createRpcService, ERROR_METHOD_NOT_FOUND, ERROR_SERVER, Request as RPCRequest, SuccessResponse } from './jsonrpc' import { FunctionPropertyNames } from './types' -export type TGetContext = (req: Request) => Promise | Context +export type GetContext = (req: Request) => Promise | Context export interface RPCReturnType { addService>( @@ -31,7 +31,7 @@ async function defaultHook( } export function jsonrpc( - getContext: TGetContext, + getContext: GetContext, logger: Logger, hook: ( details: InvocationDetails, diff --git a/packages/jsonrpc/src/jsonrpc.ts b/packages/jsonrpc/src/jsonrpc.ts index 94e6f5a..f8198e8 100644 --- a/packages/jsonrpc/src/jsonrpc.ts +++ b/packages/jsonrpc/src/jsonrpc.ts @@ -1,4 +1,4 @@ -export type TId = number | string +export type Id = number | string import {ArgumentTypes, FunctionPropertyNames, RetType} from './types' import {isPromise} from './isPromise' import {createError, ErrorResponse} from './error' @@ -63,14 +63,14 @@ export function getAllMethods(obj: T): Array> { export interface Request { jsonrpc: '2.0' - id: TId | null + id: Id | null method: M params: A } export interface SuccessResponse { jsonrpc: '2.0' - id: TId + id: Id result: T error: null } diff --git a/packages/jsonrpc/src/redux.ts b/packages/jsonrpc/src/redux.ts index f8ac19e..0bb64c6 100644 --- a/packages/jsonrpc/src/redux.ts +++ b/packages/jsonrpc/src/redux.ts @@ -1,11 +1,4 @@ -import { - RPCActions, - RPCClient, - TResolvedActions, - TAllActions, - RPCReduxHandlers, - RPCActionsRecord, -} from './types' +import { AllActions, ResolvedActions, RPCActions, RPCActionsRecord, RPCClient, RPCReduxHandlers } from './types' export function createActions( client: RPCClient, @@ -40,9 +33,9 @@ export function createReducer< const self = { withHandler>( - handleAction: (state: State, action: TResolvedActions) => State, - ): (state: State | undefined, action: TAllActions) => State { - return (state: State = defaultState, action: TAllActions): State => { + handleAction: (state: State, action: ResolvedActions) => State, + ): (state: State | undefined, action: AllActions) => State { + return (state: State = defaultState, action: AllActions): State => { if (action.type !== actionType) { return state } diff --git a/packages/jsonrpc/src/remote.ts b/packages/jsonrpc/src/remote.ts index 72f0e8b..0ab09bb 100644 --- a/packages/jsonrpc/src/remote.ts +++ b/packages/jsonrpc/src/remote.ts @@ -2,7 +2,7 @@ import Axios from 'axios' import {FunctionPropertyNames, RPCClient} from './types' import {IDEMPOTENT_METHOD_REGEX} from './idempotent' -export type TRequestIdGenerator = () => T +export type GenerateRequestId = () => T export const createNumberGenerator = (val: number) => () => ++val export const constantId = (val: string) => () => val @@ -11,7 +11,7 @@ export function createRemoteClient( url: string, methods: Array>, headers: Record = {}, - getNextRequestId: TRequestIdGenerator = constantId('c'), + getNextRequestId: GenerateRequestId = constantId('c'), idempotentMethodRegex = IDEMPOTENT_METHOD_REGEX, ) { const axios = Axios.create() diff --git a/packages/jsonrpc/src/types.ts b/packages/jsonrpc/src/types.ts index 2c47395..703af70 100644 --- a/packages/jsonrpc/src/types.ts +++ b/packages/jsonrpc/src/types.ts @@ -72,7 +72,7 @@ export interface RPCRejectedAction< method: Method } -export type TRPCAction< +export type RPCAction< T, ActionType extends string, Method extends string | number | symbol > = RPCPendingAction @@ -95,7 +95,7 @@ export type GetPendingAction = : never type Values = T[keyof T] -export type TPendingActions = GetPendingAction>> -export type TResolvedActions = GetResolvedAction> -export type TAllActions = TPendingActions - | TResolvedActions | GetRejectedAction> +export type PendingActions = GetPendingAction>> +export type ResolvedActions = GetResolvedAction> +export type AllActions = PendingActions + | ResolvedActions | GetRejectedAction> diff --git a/packages/redux/src/actions/AsyncAction.ts b/packages/redux/src/actions/AsyncAction.ts index aff411d..447526c 100644 --- a/packages/redux/src/actions/AsyncAction.ts +++ b/packages/redux/src/actions/AsyncAction.ts @@ -2,7 +2,7 @@ import {PendingAction} from './PendingAction' import {ResolvedAction} from './ResolvedAction' import {RejectedAction} from './RejectedAction' -export type TAsyncStatus = 'pending' | 'resolved' | 'rejected' +export type AsyncStatus = 'pending' | 'resolved' | 'rejected' export type AsyncAction = PendingAction diff --git a/packages/redux/src/pack.test.tsx b/packages/redux/src/pack.test.tsx index 707d72d..728caa6 100644 --- a/packages/redux/src/pack.test.tsx +++ b/packages/redux/src/pack.test.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom' import TestUtils from 'react-dom/test-utils' import { Provider } from 'react-redux' import { createStore } from 'redux' -import { pack, TStateSelector } from './pack' +import { pack, SelectState } from './pack' describe('pack', () => { @@ -67,7 +67,7 @@ describe('pack', () => { } function configurePureComponent( - getLocalState: TStateSelector, + getLocalState: SelectState, ) { return pack( getLocalState, @@ -85,7 +85,7 @@ describe('pack', () => { } function configureFunctionalComponent( - getLocalState: TStateSelector, + getLocalState: SelectState, ) { return pack( getLocalState, diff --git a/packages/redux/src/pack.ts b/packages/redux/src/pack.ts index 26b6968..23bdc1e 100644 --- a/packages/redux/src/pack.ts +++ b/packages/redux/src/pack.ts @@ -3,7 +3,7 @@ import { connect, GetProps, MapDispatchToPropsParam, Matching, ResolveThunks } f /* * Select and return a part of the state */ -export type TStateSelector +export type SelectState = (state: GlobalState) => StateSlice /** @@ -37,7 +37,7 @@ export function pack< C extends React.ComponentType< Matching, GetProps>> >( - getLocalState: TStateSelector, + getLocalState: SelectState, mapStateToProps: (state: LocalState) => StateProps, mapDispatchToProps: MapDispatchToPropsParam, Component: C, diff --git a/packages/scripts/src/Command.ts b/packages/scripts/src/Command.ts new file mode 100644 index 0000000..f1b742f --- /dev/null +++ b/packages/scripts/src/Command.ts @@ -0,0 +1 @@ +export type Command = (...argv: string[]) => unknown diff --git a/packages/scripts/src/Subprocess.test.ts b/packages/scripts/src/Subprocess.test.ts index 64d279e..adfa584 100644 --- a/packages/scripts/src/Subprocess.test.ts +++ b/packages/scripts/src/Subprocess.test.ts @@ -1,5 +1,4 @@ -import {StdioOptions} from './Subprocess' -import {Subprocess} from './Subprocess' +import { StdioOptions, Subprocess } from './Subprocess' describe('Subprocess', () => { diff --git a/packages/scripts/src/Subprocess.ts b/packages/scripts/src/Subprocess.ts index e3746c8..a18a147 100644 --- a/packages/scripts/src/Subprocess.ts +++ b/packages/scripts/src/Subprocess.ts @@ -1,4 +1,4 @@ -import {spawn} from 'child_process' +import { spawn } from 'child_process' export enum StdioOptions { PIPE = 'pipe', diff --git a/packages/scripts/src/TCommand.ts b/packages/scripts/src/TCommand.ts deleted file mode 100644 index b5b4b13..0000000 --- a/packages/scripts/src/TCommand.ts +++ /dev/null @@ -1 +0,0 @@ -export type TCommand = (...argv: string[]) => unknown diff --git a/packages/scripts/src/index.ts b/packages/scripts/src/index.ts index 3ff5b7c..53152b7 100644 --- a/packages/scripts/src/index.ts +++ b/packages/scripts/src/index.ts @@ -1,13 +1,13 @@ #!/usr/bin/env node +import { arg, argparse } from '@rondo.dev/argparse' +import { Command } from './Command' import * as log from './log' -import {TCommand} from './TCommand' -import {argparse, arg} from '@rondo.dev/argparse' -import {resolve} from './resolve' +import { resolve } from './resolve' async function run( commandName: string, commandArgs: string[], - commands: Record, + commands: Record, exit: (code: number) => void, ) { if (!(commandName in commands)) { diff --git a/packages/scripts/src/modules.test.ts b/packages/scripts/src/modules.test.ts index 6c322a3..c64591d 100644 --- a/packages/scripts/src/modules.test.ts +++ b/packages/scripts/src/modules.test.ts @@ -1,5 +1,5 @@ -import {getPathVariable, getPathSeparator, findNodeModules} from './modules' -import {platform} from 'os' +import { platform } from 'os' +import { findNodeModules, getPathSeparator, getPathVariable } from './modules' describe('modules', () => { diff --git a/packages/scripts/src/modules.ts b/packages/scripts/src/modules.ts index fe47d11..bd1ee08 100644 --- a/packages/scripts/src/modules.ts +++ b/packages/scripts/src/modules.ts @@ -1,6 +1,6 @@ import * as fs from 'fs' +import { platform } from 'os' import * as path from 'path' -import {platform} from 'os' export function getPathSeparator(platformValue: string) { return platformValue === 'win32' ? ';' : ':' diff --git a/packages/scripts/src/resolve.ts b/packages/scripts/src/resolve.ts index 68c9ad4..fe146fc 100644 --- a/packages/scripts/src/resolve.ts +++ b/packages/scripts/src/resolve.ts @@ -1,11 +1,11 @@ +import { join } from 'path' +import { Command } from './Command' import * as commands from './scripts' -import {join} from 'path' -import { TCommand } from './TCommand' -export type AvailableCommands = typeof commands & Record +export type AvailableCommands = typeof commands & Record export async function resolve(cwd = process.cwd()): Promise { - let extraScripts: Record = {} + let extraScripts: Record = {} try { extraScripts = await import(join(cwd, './src/scripts')) } catch (err) { diff --git a/packages/scripts/src/run.ts b/packages/scripts/src/run.ts index dfb90b5..2ee4b34 100644 --- a/packages/scripts/src/run.ts +++ b/packages/scripts/src/run.ts @@ -1,5 +1,5 @@ -import {Subprocess} from './Subprocess' -import {getPathVariable} from './modules' +import { getPathVariable } from './modules' +import { Subprocess } from './Subprocess' export async function run(command: string, args: string[], cwd?: string) { return new Subprocess(command, args, { diff --git a/packages/server/tsconfig.esm.json b/packages/server/tsconfig.esm.json index aa914ab..80c3152 100644 --- a/packages/server/tsconfig.esm.json +++ b/packages/server/tsconfig.esm.json @@ -7,6 +7,9 @@ { "path": "../common/tsconfig.esm.json" }, + { + "path": "../client/tsconfig.esm.json" + }, { "path": "../jsonrpc/tsconfig.esm.json" }, @@ -29,4 +32,4 @@ "path": "../validator/tsconfig.esm.json" } ] -} \ No newline at end of file +} diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 807b1c3..003b2ff 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -6,6 +6,7 @@ }, "references": [ {"path": "../common"}, + {"path": "../client"}, {"path": "../jsonrpc"}, {"path": "../logger"}, {"path": "../config"},