mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 17:25:21 +00:00
Types and automatic improvements
This commit is contained in:
@@ -75,7 +75,7 @@ export class Pass {
|
|||||||
|
|
||||||
// Parsing and validating pass.json keys
|
// Parsing and validating pass.json keys
|
||||||
const passCoreKeys = Object.keys(this.passCore) as (keyof schema.ValidPass)[];
|
const passCoreKeys = Object.keys(this.passCore) as (keyof schema.ValidPass)[];
|
||||||
const validatedPassKeys = passCoreKeys.reduce((acc, current) => {
|
const validatedPassKeys = passCoreKeys.reduce<schema.ValidPass>((acc, current) => {
|
||||||
if (this.type === current) {
|
if (this.type === current) {
|
||||||
// We want to exclude type keys (eventTicket,
|
// We want to exclude type keys (eventTicket,
|
||||||
// boardingPass, ecc.) and their content
|
// boardingPass, ecc.) and their content
|
||||||
@@ -293,7 +293,7 @@ export class Pass {
|
|||||||
|
|
||||||
beacons(resetFlag: null): this;
|
beacons(resetFlag: null): this;
|
||||||
beacons(...data: schema.Beacon[]): this
|
beacons(...data: schema.Beacon[]): this
|
||||||
beacons(...data: (schema.Beacon|null)[]): this {
|
beacons(...data: (schema.Beacon | null)[]): this {
|
||||||
if (data[0] === null) {
|
if (data[0] === null) {
|
||||||
delete this[passProps]["beacons"];
|
delete this[passProps]["beacons"];
|
||||||
return this;
|
return this;
|
||||||
@@ -316,7 +316,7 @@ export class Pass {
|
|||||||
|
|
||||||
locations(resetFlag: null): this;
|
locations(resetFlag: null): this;
|
||||||
locations(...data: schema.Location[]): this;
|
locations(...data: schema.Location[]): this;
|
||||||
locations(...data: (schema.Location|null)[]): this {
|
locations(...data: (schema.Location | null)[]): this {
|
||||||
if (data[0] === null) {
|
if (data[0] === null) {
|
||||||
delete this[passProps]["locations"];
|
delete this[passProps]["locations"];
|
||||||
return this;
|
return this;
|
||||||
@@ -366,7 +366,7 @@ export class Pass {
|
|||||||
barcodes(resetFlag: null): this;
|
barcodes(resetFlag: null): this;
|
||||||
barcodes(message: string): this;
|
barcodes(message: string): this;
|
||||||
barcodes(...data: schema.Barcode[]): this;
|
barcodes(...data: schema.Barcode[]): this;
|
||||||
barcodes(...data: (schema.Barcode|null|string)[]): this {
|
barcodes(...data: (schema.Barcode | null | string)[]): this {
|
||||||
if (data[0] === null) {
|
if (data[0] === null) {
|
||||||
delete this[passProps]["barcodes"];
|
delete this[passProps]["barcodes"];
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user