Browse Source

5.9: configuring a project with references.

Frederic G. MARAND 5 years ago
parent
commit
a73371b5cd
4 changed files with 10 additions and 4 deletions
  1. 3 1
      app/app.ts
  2. 2 0
      app/player.ts
  3. 4 3
      app/tsconfig.json
  4. 1 0
      package.json

+ 3 - 1
app/app.ts

@@ -1,3 +1,5 @@
+/// <reference path="player.ts" />
+
 function startGame() {
   // Starting a new game.
   let playerName: string | undefined = getInputValue('playername');
@@ -53,5 +55,5 @@ function logError(message: string): void {
 }
 
 let firstPlayer: Player = new Player();
-firstPlayer.name = 'Lanier';
+firstPlayer.name = 'Laney';
 console.log(firstPlayer.formatName());

+ 2 - 0
app/player.ts

@@ -1,3 +1,5 @@
+/// <reference path="person.ts" />
+
 class Player implements Person {
   age: number;
   formatName(): string {

+ 4 - 3
app/tsconfig.json

@@ -1,9 +1,10 @@
 {
   "extends": "../tsconfig.base.json",
   "compilerOptions": {
-    "removeComments": true
+    "removeComments": true,
+    "outFile": "../js/app.js"
   },
-  "include": [
-    "./**/*"
+  "files": [
+    "app.ts"
   ]
 }

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   "main": "index.js",
   "name": "Pluralsight-GettingStartedWithTypeScript",
   "scripts": {
+    "compile": "rm -fr js/* && cd app && npx tsc",
     "start": "http-server"
   },
   "version": "2.0.0"