Migrating from JavaScript to TypeScript
[Pages:15]Migrating from JavaScript to TypeScript
TypeScript. JavaScript that scales.
Seungjae Lee @huiseoul
Huiseoul?
Frontend React Native, Mobx ...
Backend Node.js, GraphQL ...
Written by TyoeScript and one @types/huiseoul
History
2012 10 MicroSoft
2014 4 Build v1.0 VS2013 builtin
2014 7 5 , Github
2016 9 v2.0 @types/* strictNullChecks
v2.3.2
Specs
Opensource: Superset of JavaSript
JavaScript
Static Typing Checked at compile time Type annotation
OOP EcmaScript features
supports v3 ~ future proposals ... and much more
Benefit
: OK : >
Learning curve
JavaScript JavaScript !
Install & run
$ npm install -g typescript $ echo 'console.log("Hello, World!");' > saystone.ts $ tsc saystone.ts $ node saystone.js Hello, World!
Compiler config
your-project/tsconfig.json
# automically points ./your-project/tsconfig.json your-project$ tsc
json.html
Example: Pure TypeScript
class Student { fullName: string; constructor(public firstName, public middleInitial, public this.fullName = firstName + " " + middleInitial + }
}
interface Person { firstName: string; lastName: string;
}
function greeter(person : Person) { return "Hello, " + person.firstName + " " + person.lastName
}
var user = new Student("Jane", "M.", "User");
console.log(greeter(user));
Output: Converted JavaScript
var Student = (function () { function Student(firstName, middleInitial, lastName) { this.firstName = firstName; this.middleInitial = middleInitial; this.lastName = lastName; this.fullName = firstName + " " + middleInitial + } return Student;
}()); function greeter(person) {
return "Hello, " + person.firstName + " " + person.lastName } var user = new Student("Jane", "M.", "User"); console.log(greeter(user));
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- migrating from javascript to typescript
- schemas and types for json data
- esri geodev webinar series using typescript with the
- restful apis for the 5g service based architecture
- json or javascript object notation is a lightweight text
- maximo 76 scripting features bruno portaluri
- typescript notes for professionals
- signaling protocols and procedures for citizens broadband
- chapter 1 http client web age solutions
- typeorm tutorialspoint
Related searches
- how to switch from survival to creative
- how to get from grams to tons
- how to go from ml to moles
- how to convert from moles to grams
- how to convert from pdf to txt
- how to convert from miles to kilometers
- how to convert from mph to mpm
- how to convert from miles to meters
- add javascript to url
- javascript to call url
- javascript to ascii
- javascript to redirect to another page