TypeScript Development

at DriveTime


A brief overview of the history of TypeScript development at DriveTime, as well as suggestions for adopting and advancing TypeScript development within your own team

Presentation by Allen Rice

About Me


  • Static web development in 1998

  • ASP.NET & SPA development in 2005

  • Joined DriveTime in 2011

  • TypeScript in 2013

About DriveTime


  • "Buy here pay here" 

  • 139 dealerships, 24 inspection centers

  • Vertically integrated

  • 4 sister companies

  • over 5000 employees  

About DriveTime Cont.

  • Developers: Full stack, mostly

  • IDE's: Visual Studio, VS Code

  • Frameworks: MVC, WebAPI, Knockout, Angular 2

  • Hosting: Azure and On-Prem

  • CI/CD: Jenkins

What we're talking about


  • How TypeScript adoption went for us

  • What we currently use

  • What we plan on using in the future

  • How you can adopt it yourself

Origin Story: Point Of Sale


  • New project, ambitious timeline, 12 developers 

  • We knew JS development would be an issue

  • TypeScript was just being initially released

  • Overall architecture: Mediator / Component pattern

How did it go?


  • C# only developers were able to jump in

  • Refactoring and compile time feedback was amazing

  • TypeLite connected C# to TypeScript for the first time

  • Completely new tech for us: 

TypeScript, Jasmine, Chutzpah, Sandboxing, 
TypeLite, Map files, Mediator / Component pattern,
JSLinq

What were the Challenges?


  • IDE vs local build vs CI/CD build vs Chutzpah

Other Challenges?


  • ASP.NET Bundling & Minification

Challenges, Cont.


  • No real client side build process                                 

  • No Generics in TypeScript yet

  • Chutzpah: Huge pain and not realistic

  • Definition files (almost not worth mentioning)

  • TypeLite death spiral

Any more Challenges?

Naming! 

dt.components.findEDocs.viewModel.messageAlertType
dt.pos.mediator.instance.publish
DT.topics.findEDocs.activateAlert
dt.posAdmin.mediator.managers.findEDocs.ajaxHandlers.activateMessageAlert

Biggest take away

Use a module system!

Overall how was it?


We never would have shipped in that time frame without TypeScript

no, I mean: How has adoption gone?


  • We don't write JavaScript in our WebUI's anymore

  • 10 apps released to prod using TypeScript
    (5k - 50k lines of code each)

  • 2 new apps currently in development

  • No problems in training (its way easier)

New since Pos

  • Introduced gulp, karma, amd, requirejs, generics, nodejs, npm

  • Built our own npm packages

  • Built our own Visual Studio Templates & Scaffolders

  • Built entire release pipelines around all this

Brand new for us (< 3 months)

  • tsconfig file usage
  • npm scripts in lieu of gulp (maybe)
  • Angular 2.0
  • Web Pack
  • TSLint
  • Typings
  • Code Coverage
  • Code generation (in process)
  • CommonJS

Tech we're looking to adopt








  • TypeLite alternative
  • Tree shaking
  • await (TypeScript 2.1 / 2.2)
  • Improved project templates
  • Improved scaffolding
  • .net core

So you have it all figured out?


  • IDE still gets a per-system version of TypeScript
  • Still writing most of our node code in JS
  • ImmutableJS is a huge pain with TypeScript
  • Code generation is still a manual process
  • No map files after optimization
  • auto-magic references

How Should I go about adopting TypeScript?

Misc recommendations


  • Don't require new hires to know TypeScript

  • Come up with a training regimen

  • Get to know nodejs if you haven't already

  • Read the spec, especially the  Import section

  • Just start using TypeScript!

Recap


  • Point of sale started it all at DriveTime, circa 2013

  • We continue to enjoy it and don't actively write JS anymore

  • Adoption of TypeScript is pretty easy, just start doing it!

References

coming soon

TypeScript Development at DriveTime

By Allen Rice

TypeScript Development at DriveTime

A brief overview of the history of TypeScript development at DriveTime, as well as suggestions for adopting and advancing TypeScript development within your own development group

  • 954