RemoteAction Apex methods have helped make Visualforce pages more responsive by allowing us to use more JavaScript and still connect easily to our Apex business logic. But with this power comes the brittleness of JavaScript's untyped nature and the disconnect between JavaScript and Apex methods. The errors caused by these issues are runtime errors, which can slow development down. To catch these errors at compile time, the Tooling API can be used to generate TypeScript proxies for RemoteActions. Join us to learn what TypeScript is, how to use it in Visualforce, and see concrete examples of how to generate proxies for Apex RemoteActions.
7. What is TypeScript?
“TypeScript is a typed superset of JavaScript that compiles to plain JavaScript”
“…a symantic subset of JavaScript; the sensical subset” – Anders Hejlsberg
Aimed at improving the development experience for JavaScript
8. What is TypeScript?
Strongly typed. Tools perform type inference.
Modules, Classes & Interfaces
4 primitives: string, number, boolean, any
TypeScriptLang.org
10. Joining the Dots
Represent metadata as classes in TypeScript
• We need tools to do this
We no longer write JavaScript
• TypeScript only now
TypeScript is compiled before deployment
• And thus type checked
12. Where Next?
Better flow for developers
• Create a grunt task
• Automatically generate d.ts files on metadata changes
Improved support of metadata
• Inner classes
• Namespace support
Integration with continuous integration tools
Whatever else you can imagine
13. 3 Simple Points
JavaScript is not aware of the Salesforce metadata
All the metadata is exposed via the Tooling and Standard APIs
We can make TypeScript aware of the Salesforce metadata