Skip to content

Commit

Permalink
fix(i18n): marked optional arguments
Browse files Browse the repository at this point in the history
Using this plugin in a TypeScript project, missing optional arguments such as `options` in `tr(key, options)` throw compiler errors since they are not marked as optional with a question mark. This PR fixes this, marking optional arguments as optional.
  • Loading branch information
Giovanni Lovato committed Dec 22, 2015
1 parent ab40714 commit cc9b48b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/i18n.js
Expand Up @@ -22,7 +22,7 @@ export class I18N {
}
}

setup(options) {
setup(options?) {
const defaultOptions = {
resGetPath: 'locale/__lng__/__ns__.json',
lng: 'en',
Expand Down Expand Up @@ -56,15 +56,15 @@ export class I18N {
return this.i18next.lng();
}

nf(options, locales) {
nf(options?, locales?) {
return new this.Intl.NumberFormat(locales || this.getLocale(), options || {});
}

df(options, locales) {
df(options?, locales?) {
return new this.Intl.DateTimeFormat(locales || this.getLocale(), options);
}

tr(key, options) {
tr(key, options?) {
let fullOptions = this.globalVars;

if (options !== undefined) {
Expand Down

0 comments on commit cc9b48b

Please sign in to comment.