Created
June 11, 2017 01:58
-
-
Save bigbeno37/6abfe0dc635da344a19b385e616df347 to your computer and use it in GitHub Desktop.
How to get multiple files working with typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Student} from "./Student"; | |
function greeter(student: Student) { | |
return student.firstName + " " + student.lastName; | |
} | |
let user = new Student("Jane", "Doe"); | |
document.body.innerHTML = greeter(user); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g browserify | |
tsc --module commonjs FILE1.ts FILE2.ts | |
browserify MAINFILE.js -o bundle.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Student { | |
firstName: string; | |
lastName: string; | |
constructor(fname: string, lname: string) { | |
this.firstName = fname; | |
this.lastName = lname; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment