This will be used to support the generation of composed type which is made up of primitives:
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {Primitives}
*/
export function createPrimitivesFromDiscriminatorValue(parseNode: ParseNode | undefined) : number | string | undefined {
const nodeValue = parseNode?.getNodeValue();
switch (typeof nodeValue) {
case "number":
case "string":
return nodeValue;
default:
return undefined;
}
}
This will be used to support the generation of composed type which is made up of primitives: