Visual Studio 2015 update 3. I'm getting the error:
Uncaught ReferenceError: require is not defined
on:
import { Category } from "./Enums"; at runtime.
I don't really understand why I am getting this error (I am quite new to Typescript )
enums.ts:
export enum Category { Biography, Poetry, Fiction, History, Children }
interface.ts:
import { Category } from './enums';
export interface Book {
id: number;
title: string;
author: string;
available: boolean;
category: Category;
pages?: number;
markDamaged?: DamageLogger;
}
app.ts:
import { Category } from './enums';
import { Book, DamageLogger, Author, Librarian } from './interfaces';
import { UniversityLibrarian } from './classes';
function GetAllBooks(): Book[] {
let books = [
{ id: 1, title: 'Ulysses', author: 'James Joyce', available: true, category: Category.Fiction },
{ id: 2, title: 'A Farewell to Arms', author: 'Ernest Hemingway', available: false, category: Category.Fiction },
{ id: 3, title: 'I Know Why the Caged Bird Sings', author: 'Maya Angelou', available: true, category: Category.Poetry },
{ id: 4, title: 'Moby Dick', author: 'Herman Melville', available: true, category: Category.Fiction }
];
return books
;