Improved few types

This commit is contained in:
Alexander Cerutti
2021-02-05 08:11:53 +01:00
parent 9469758b91
commit d017a38ac9

View File

@@ -42,7 +42,7 @@ export class Pass {
private Certificates: schema.FinalCertificates; private Certificates: schema.FinalCertificates;
private [transitType]: string = ""; private [transitType]: string = "";
l10nTranslations: { [key: string]: { [key: string]: string } } = {}; private l10nTranslations: { [languageCode: string]: { [placeholder: string]: string } } = {};
constructor(options: schema.PassInstance) { constructor(options: schema.PassInstance) {
if (!schema.isValid(options, "instance")) { if (!schema.isValid(options, "instance")) {
@@ -242,7 +242,7 @@ export class Pass {
* @see https://apple.co/2KOv0OW - Passes support localization * @see https://apple.co/2KOv0OW - Passes support localization
*/ */
localize(lang: string, translations?: { [key: string]: string }): this { localize(lang: string, translations?: { [placeholder: string]: string }): this {
if (lang && typeof lang === "string" && (typeof translations === "object" || translations === undefined)) { if (lang && typeof lang === "string" && (typeof translations === "object" || translations === undefined)) {
this.l10nTranslations[lang] = translations || {}; this.l10nTranslations[lang] = translations || {};
} }