UNPKG

my-example-types

Version:

Spartans never die. They just go missing in action.

51 lines (39 loc) 840 B
export default interface Spartan { readonly label: string; readonly name: string; } export class SpartanI implements Spartan { #boren: boolean; readonly label = "ORION"; readonly name: string; constructor(name: string) { this.#boren = false; this.name = name; } hasBorens() { return this.#boren; } falsifyRecords() { this.#boren = true; } } export class SpartanII implements Spartan { #armor: string | undefined; readonly label = "II"; readonly name: string; readonly tag: number; constructor(name: string, tag: number) { this.name = name; this.tag = tag; } getArmor() { return this.#armor; } setArmor(armor: string | undefined) { this.#armor = armor; } } export const spartans = [ new SpartanI("Avery Junior Johnson"), new SpartanII("John", 117), ];