Skip to content

Instantly share code, notes, and snippets.

@METACEO
Created December 27, 2018 00:11
Show Gist options
  • Save METACEO/52b54f7b7d86e6185c2b8444f1c2bb15 to your computer and use it in GitHub Desktop.
Save METACEO/52b54f7b7d86e6185c2b8444f1c2bb15 to your computer and use it in GitHub Desktop.
let student = {
name: 'Alice',
major: 'Computer Science',
year: 2
};
// into...
class Student {
constructor(public name: string,
public major: string,
public year: number) {
}
}
let student = {
name: 'Alice',
major: 'Computer Science',
year: 2
};
// ...finally:
let student = new Student('Alice', 'Computer Science', 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment