use-postal-jp
Version:
郵便番号を住所に変換するReactカスタムフックです。住所データを内部に持たず、APIで住所変換するため軽量なパッケージになっています。
9 lines (8 loc) • 446 B
TypeScript
import { Address } from './utils';
import { APIResponse } from './endpoint';
declare type AddressOrCustom<T> = T extends never | Address ? Address : T;
export declare const usePostalJp: <T = Address, R = APIResponse>(postalCode: string, ready: boolean, option?: {
url?: ((code: [string, string]) => string) | undefined;
parse?: ((res: R) => T) | undefined;
} | undefined) => [AddressOrCustom<T> | null, boolean, Error | null];
export {};