refactor(striker-ui): rename MessageSetterFunction->MessageSetter

main
Tsu-ba-me 2 years ago
parent 4557e27e1b
commit de5ae58c7e
  1. 2
      striker-ui/hooks/useFormUtils.ts
  2. 4
      striker-ui/lib/buildMapToMessageSetter.ts
  3. 2
      striker-ui/types/FormUtils.d.ts
  4. 2
      striker-ui/types/MapToMessageSetter.d.ts
  5. 2
      striker-ui/types/MessageSetterFunction.d.ts

@ -68,7 +68,7 @@ const useFormUtils = <
); );
const setMsgSetter = useCallback( const setMsgSetter = useCallback(
(id: keyof M, setter?: MessageSetterFunction, isOverwrite?: boolean) => { (id: keyof M, setter?: MessageSetter, isOverwrite?: boolean) => {
if (!msgSetters[id] || isOverwrite) { if (!msgSetters[id] || isOverwrite) {
msgSetters[id] = msgSetters[id] =
setter ?? buildMessageSetter<M>(String(id), messageGroupRef); setter ?? buildMessageSetter<M>(String(id), messageGroupRef);

@ -7,8 +7,8 @@ const buildMessageSetter = <T extends MapToInputTestID>(
messageGroupRef: MutableRefObject<MessageGroupForwardedRefContent>, messageGroupRef: MutableRefObject<MessageGroupForwardedRefContent>,
container?: MapToMessageSetter<T>, container?: MapToMessageSetter<T>,
key: string = id, key: string = id,
): MessageSetterFunction => { ): MessageSetter => {
const setter: MessageSetterFunction = (message?) => { const setter: MessageSetter = (message?) => {
messageGroupRef.current.setMessage?.call(null, id, message); messageGroupRef.current.setMessage?.call(null, id, message);
}; };

@ -25,7 +25,7 @@ type FormUtils<M extends MapToInputTestID> = {
>; >;
setMsgSetter: ( setMsgSetter: (
id: keyof M, id: keyof M,
setter?: MessageSetterFunction, setter?: MessageSetter,
isOverwrite?: boolean, isOverwrite?: boolean,
) => void; ) => void;
setValidity: (key: keyof M, value?: boolean) => void; setValidity: (key: keyof M, value?: boolean) => void;

@ -1,5 +1,5 @@
type MapToMessageSetter<T extends MapToInputTestID> = { type MapToMessageSetter<T extends MapToInputTestID> = {
[MessageSetterID in keyof T]: MessageSetterFunction; [MessageSetterID in keyof T]: MessageSetter;
}; };
type InputIds<T> = ReadonlyArray<T> | MapToInputTestID; type InputIds<T> = ReadonlyArray<T> | MapToInputTestID;

@ -1,3 +1,3 @@
type MessageSetterFunction = ( type MessageSetter = (
message?: import('../components/MessageBox').Message, message?: import('../components/MessageBox').Message,
) => void; ) => void;

Loading…
Cancel
Save