Skip to content

Instantly share code, notes, and snippets.

@bigbeno37
Created June 11, 2017 01:58
Show Gist options
  • Save bigbeno37/6abfe0dc635da344a19b385e616df347 to your computer and use it in GitHub Desktop.
Save bigbeno37/6abfe0dc635da344a19b385e616df347 to your computer and use it in GitHub Desktop.
How to get multiple files working with typescript
import {Student} from "./Student";
function greeter(student: Student) {
return student.firstName + " " + student.lastName;
}
let user = new Student("Jane", "Doe");
document.body.innerHTML = greeter(user);
npm install -g browserify
tsc --module commonjs FILE1.ts FILE2.ts
browserify MAINFILE.js -o bundle.js
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