import * as I from './interfaces'; import {Inventory} from "./interfaces"; class UniversityLibrarian implements I.Librarian { department: string; email: string; name: string; assistCustomer(custName: string): void { console.log(`${this.name} is assisting ${custName}.`); } } abstract class ReferenceItem { static department = 'Research'; private _publisher: string; constructor(public title: string, protected year?: number) { } printItem(): void { console.log(`${this.title} was published in ${this.year}`); console.log(`Department: ${ReferenceItem.department}.`); } get publisher(): string { return this._publisher.toUpperCase(); } set publisher(p: string) { this._publisher = p; } abstract printCitation(): void; } class Journal extends ReferenceItem { public contributors: string[]; constructor(title: string, year: number) { super(title, year); } printCitation(): void { console.log(`${this.title} - ${JSON.stringify(this.contributors)}.`); } } class Catalog implements Inventory { private catalogItems = new Array(); addItem(newItem: T): void { this.catalogItems.push(newItem); } getAllItems(): Array { return this.catalogItems; } getNewestItem(): T { return this.catalogItems.slice(-1)[0]; } } export { Catalog, Journal, ReferenceItem, UniversityLibrarian };