From c7bb27a4c2cbecc6c367fbbc4bbefda75af2584d Mon Sep 17 00:00:00 2001 From: Clayton Grassick Date: Tue, 13 Sep 2022 15:09:02 -0400 Subject: [PATCH] Update exports --- lib/index.d.ts | 6 ++++-- lib/index.js | 2 +- src/index.ts | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 88b0bbf..8bf5abf 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -6,10 +6,12 @@ export interface LocalizerData { strings: LocalizedString[]; } export { default as Localizer } from './Localizer'; +/** Function to localize a string */ +export declare type LocalizeString = (str: string, ...args: any[]) => string; /** Create a default T that does nothing */ -export declare const defaultT: any; +export declare const defaultT: LocalizeString; declare const _default: { Localizer: typeof Localizer; - defaultT: any; + defaultT: LocalizeString; }; export default _default; diff --git a/lib/index.js b/lib/index.js index 12c7d93..d352f69 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,7 +8,7 @@ const Localizer_1 = __importDefault(require("./Localizer")); var Localizer_2 = require("./Localizer"); Object.defineProperty(exports, "Localizer", { enumerable: true, get: function () { return __importDefault(Localizer_2).default; } }); // Create default localizer -var defaultLocalizer = new exports.Localizer(); +var defaultLocalizer = new Localizer_1.default({ locales: [{ code: "en", name: "English" }], strings: [] }); /** Create a default T that does nothing */ exports.defaultT = defaultLocalizer.T; // Support for non-ES6 diff --git a/src/index.ts b/src/index.ts index ef9613b..abfd3a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,11 +10,14 @@ export interface LocalizerData { export { default as Localizer } from './Localizer' +/** Function to localize a string */ +export type LocalizeString = (str: string, ...args: any[]) => string + // Create default localizer -var defaultLocalizer = new exports.Localizer() +var defaultLocalizer = new Localizer({ locales: [{ code: "en", name: "English" }], strings: [] }) /** Create a default T that does nothing */ -export const defaultT = defaultLocalizer.T +export const defaultT: LocalizeString = defaultLocalizer.T // Support for non-ES6 export default { Localizer, defaultT } \ No newline at end of file