country-info-flags
Version:
A lightweight library for country flags, phone codes, and currency information for React and React Native
39 lines (34 loc) • 1.21 kB
TypeScript
import { JSX } from 'react';
type CountryInfo = {
code: string;
name: string;
phoneCode: string;
currency: string;
};
type CountryFlagProps = {
countryCode: string;
height?: number;
width?: number;
};
type NotFoundtype = {
notFound: true;
message: string;
};
type FunctionPhoneNumber = {
code: string;
name: string;
phoneCode: string;
notFound?: false;
} | NotFoundtype;
type FunctionCurrency = {
code: string;
name: string;
currency: string;
notFound?: false;
} | NotFoundtype;
declare function getPhoneNumberCode(countryCode: string, errorMessage?: string): FunctionPhoneNumber;
declare function getCountryCurrencyCode(countryCode: string, errorMessage?: string): FunctionCurrency;
declare function getAllCountryCurrencies(): FunctionCurrency[];
declare function getAllPhoneCurrencies(): FunctionPhoneNumber[];
declare function CountryFlag({ countryCode, height, width }: CountryFlagProps): JSX.Element | null;
export { CountryFlag, type CountryFlagProps, type CountryInfo, type FunctionCurrency, type FunctionPhoneNumber, type NotFoundtype, getAllCountryCurrencies, getAllPhoneCurrencies, getCountryCurrencyCode, getPhoneNumberCode };