+ All Categories
Home > Technology > Making Visualforce RemoteAction Bulletproof with TypeScript

Making Visualforce RemoteAction Bulletproof with TypeScript

Date post: 16-Apr-2017
Category:
Upload: salesforce-developers
View: 425 times
Download: 3 times
Share this document with a friend
15
Making Visualforce RemoteActions Bulletproof with TypeScript Simon Goodyear Beaufort 12 @simongoodyear
Transcript
Page 1: Making Visualforce RemoteAction Bulletproof with TypeScript

Making Visualforce RemoteActions Bulletproof with TypeScript

 Simon Goodyear  Beaufort 12  @simongoodyear  

Page 2: Making Visualforce RemoteAction Bulletproof with TypeScript

Simon Goodyear Co-Founder, Beaufort 12

Page 3: Making Visualforce RemoteAction Bulletproof with TypeScript

Demo The Problem

Page 4: Making Visualforce RemoteAction Bulletproof with TypeScript

Root Cause Analysis

 JavaScript is not metadata aware

Page 5: Making Visualforce RemoteAction Bulletproof with TypeScript

Making JavaScript Metadata Aware

What we need Where we get it

Method Signatures Tooling API

Custom Apex Types Tooling API

SObjects Standard API

Page 6: Making Visualforce RemoteAction Bulletproof with TypeScript

Making JavaScript Metadata Aware

 JavaScript is loosely typed

Page 7: Making Visualforce RemoteAction Bulletproof with TypeScript

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

Page 8: Making Visualforce RemoteAction Bulletproof with TypeScript

What is TypeScript?

  Strongly typed. Tools perform type inference.

  Modules, Classes & Interfaces

  4 primitives: string, number, boolean, any

  TypeScriptLang.org

Page 9: Making Visualforce RemoteAction Bulletproof with TypeScript

Demo Introduction to TypeScript

Page 10: Making Visualforce RemoteAction Bulletproof with 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

Page 11: Making Visualforce RemoteAction Bulletproof with TypeScript

Demo Joining the dots

Page 12: Making Visualforce RemoteAction Bulletproof with TypeScript

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

Page 13: Making Visualforce RemoteAction Bulletproof with TypeScript

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

Page 14: Making Visualforce RemoteAction Bulletproof with TypeScript

Resources

  typescriptlang.org

  blogs.msdn.com/b/typescript

  channel9.msdn.com/Tags/typescript

  definitelytyped.org

  github.com/Microsoft/TypeScript-Sublime-Plugin

Page 15: Making Visualforce RemoteAction Bulletproof with TypeScript

Thank you


Recommended