Преглед на файлове

8.11: importing an entire module.

Frederic G. MARAND преди 5 години
родител
ревизия
fcf22344e5
променени са 3 файла, в които са добавени 11 реда и са изтрити 7 реда
  1. 8 4
      app/app.ts
  2. 2 2
      app/classes.ts
  3. 1 1
      app/interfaces.ts

+ 8 - 4
app/app.ts

@@ -1,4 +1,4 @@
-import {Book, DamageLogger, Librarian} from './interfaces';
+import {Book, Logger as DamageLogger, Librarian} from './interfaces';
 import {Category} from "./enums";
 import {ReferenceItem, UniversityLibrarian} from "./classes";
 import { CalculateLateFees as CalcFee, MaxBooksAllowed }  from './lib/utilityfunctions';
@@ -190,8 +190,12 @@ function classDemo() {
   console.log(favoriteNovel);
 }
 
+function importDemo() {
+  let fee = CalcFee(10);
+  let max = MaxBooksAllowed(12);
+  console.log(`Fee: ${fee}, max books: ${max}.`);
+}
+
 false && bookDemo();
 false && classDemo();
-
-let fee = CalcFee(10);
-let max = MaxBooksAllowed(12);
+false && importDemo();

+ 2 - 2
app/classes.ts

@@ -1,6 +1,6 @@
-import {Librarian} from './interfaces';
+import * as I from './interfaces';
 
-class UniversityLibrarian implements Librarian {
+class UniversityLibrarian implements I.Librarian {
   department: string;
   email: string;
   name: string;

+ 1 - 1
app/interfaces.ts

@@ -32,6 +32,6 @@ interface Librarian extends Person {
 export {
   Author,
   Book,
-  DamageLogger,
+  DamageLogger as Logger,
   Librarian,
 }