5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-19 10:29:29 +08:00
wails/v3/internal/parser/testdata/struct_literal_multiple_other/models.js
2023-12-16 14:02:19 +11:00

64 lines
1.9 KiB
JavaScript

// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// Defining the main namespace
export const main = {};
main.Person = class {
/**
* Creates a new Person instance.
* @constructor
* @param {Object} source - The source object to create the Person.
* @param {string} source.Name
* @param {services.Address} source.Address
*/
constructor(source = {}) {
const { name = "", address = null } = source;
this.name = name;
this.address = address;
}
/**
* Creates a new Person instance from a string or object.
* @param {string|object} source - The source data to create a Person instance from.
* @returns main.Person A new Person instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new main.Person(parsedSource);
}
};
// Defining the services namespace
export const services = {};
services.Address = class {
/**
* Creates a new Address instance.
* @constructor
* @param {Object} source - The source object to create the Address.
* @param {string} source.Street
* @param {string} source.State
* @param {string} source.Country
*/
constructor(source = {}) {
const { street = "", state = "", country = "" } = source;
this.street = street;
this.state = state;
this.country = country;
}
/**
* Creates a new Address instance from a string or object.
* @param {string|object} source - The source data to create a Address instance from.
* @returns services.Address A new Address instance.
*/
static createFrom(source = {}) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new services.Address(parsedSource);
}
};