Skip to content

Commit

Permalink
Update exports
Browse files Browse the repository at this point in the history
  • Loading branch information
grassick committed Sep 13, 2022
1 parent c10b4f9 commit c7bb27a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit c7bb27a

Please sign in to comment.