Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

TypeScript's Type System

49 views

Published on

A talk about how TypeScript's type system works. Presented at Lotum, Bad Nauheim.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

TypeScript's Type System

  1. 1. Type Systems @ddprrt • fettblog.eu
  2. 2. workingdraft.de @workingdraft
  3. 3. technologieplauscherl.at @plauscherl workingdraft.de @workingdraft
  4. 4. technologieplauscherl.at @plauscherl scriptconf.org @scriptconf workingdraft.de @workingdraft
  5. 5. technologieplauscherl.at @plauscherl scriptconf.org @scriptconf workingdraft.de ? @workingdraft
  6. 6. scriptconf.org
  7. 7. MEETUPS
  8. 8. Endlich kann ich Klassen schreiben!
  9. 9. = = == ===
  10. 10. = = == === Turbo Pascal Borland Delphi C# TypeScript
  11. 11. Anders Hejlsberg
  12. 12. GOSLING
  13. 13. You guys (at Microsoft) still don't get it, because it's sort of Java with reliability, productivity and security deleted - James Gosling reliability productivity
  14. 14. reliability productivity
  15. 15. Design goals
  16. 16. https://www.ecma-international.org/activities/Languages/Language%20overview.pdf
  17. 17. https://web.archive.org/web/20080723235906/http://ecmascript.org/es4/spec/evolutionary-programming-tutorial.pdf
  18. 18. ⭐ Open Source and Open Development " Closely track ECMAScript standard # Innovate in type system $ Best of breed tooling ⏬ Continually lower barrier to entry & Community, community, community
  19. 19. ⭐ Open Source and Open Development " Closely track ECMAScript standard # Innovate in type system $ Best of breed tooling ⏬ Continually lower barrier to entry & Community, community, community
  20. 20. ⭐ TypeScript IS JavaScript ⭐ Language innovation through ECMAScript ⭐ Type system innovation through use cases ⭐ Tooling as prime citizen Non-goal: Apply a sound or "provably correct" type system. Instead, strike a balance between correctness and productivity.
  21. 21. Type systems, oida!
  22. 22. ⛩ Gradual, structural, generic ( Distinct value / type namespaces ) Extensive type inference * Control flow analysis & Object-oriented and functional
  23. 23. Gradual, structural, generic
  24. 24. Duck typing
  25. 25. Type namespaces
  26. 26. primitive types number string boolean Symbol Object null undefined
  27. 27. number string boolean Symbol Object null undefined top types any unknown
  28. 28. number string boolean Symbol Object null undefined bottom types never
  29. 29. primitive types number string boolean Symbol Object null undefined
  30. 30. primitive types number string boolean null undefined
  31. 31. value types number string boolean null undefined true false -1 1000000 NaN 6 120.3 … … ‘Hello world’ ‘Baumi’
  32. 32. value types true false -1 1000000 NaN 6 120.3 … … ‘Hello world’ ‘Baumi’null undefined
  33. 33. value types number string boolean true false -1 1000000 NaN 6 120.3 … … ‘Hello world’ ‘Baumi’null undefined
  34. 34. number | string | undefined number string boolean true false -1 1000000 NaN 6 120.3 … … ‘Hello world’ ‘Baumi’null undefined
  35. 35. Intersection types { a: string } { b: string } { a: string, b: string }
  36. 36. Examples
  37. 37. fin

×