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(
(id: keyof M, setter?: MessageSetterFunction, isOverwrite?: boolean) => {
(id: keyof M, setter?: MessageSetter, isOverwrite?: boolean) => {
if (!msgSetters[id] || isOverwrite) {
msgSetters[id] =
setter ?? buildMessageSetter<M>(String(id), messageGroupRef);

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

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

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

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

Loading…
Cancel
Save