Date post: | 16-Apr-2017 |
Category: |
Software |
Upload: | simon-goodyear |
View: | 186 times |
Download: | 2 times |
Making Visualforce RemoteActions Bulletproof with TypeScript
Simon GoodyearBeaufort 12@simongoodyear
Simon GoodyearCo-Founder, Beaufort 12
DemoThe Problem
Root Cause Analysis
JavaScript is not metadata aware
Making JavaScript Metadata Aware
What we need Where we get it
Method Signatures Tooling API
Custom Apex Types Tooling API
SObjects Standard API
Making JavaScript Metadata Aware
JavaScript is loosely typed
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
What is TypeScript?
Strongly typed. Tools perform type inference.
Modules, Classes & Interfaces
4 primitives: string, number, boolean, any
TypeScriptLang.org
DemoIntroduction to TypeScript
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
DemoJoining the dots
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
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
Resources
typescriptlang.org
blogs.msdn.com/b/typescript
channel9.msdn.com/Tags/typescript
definitelytyped.org
github.com/Microsoft/TypeScript-Sublime-Plugin
Thank you