Type Systems
@ddprrt • fettblog.eu
workingdraft.de
@workingdraft
technologieplauscherl.at
@plauscherl
workingdraft.de
@workingdraft
technologieplauscherl.at
@plauscherl
scriptconf.org
@scriptconf
workingdraft.de
@workingdraft
technologieplauscherl.at
@plauscherl
scriptconf.org
@scriptconf
workingdraft.de ?
@workingdraft
scriptconf.org
MEETUPS
Endlich kann ich Klassen schreiben!
= =
== ===
=
=
==
===
Turbo Pascal
Borland Delphi
C#
TypeScript
Anders Hejlsberg
GOSLING
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
reliability productivity
Design goals
https://www.ecma-international.org/activities/Languages/Language%20overview.pdf
https://web.archive.org/web/20080723235906/http://ecmascript.org/es4/spec/evolutionary-programming-tutorial.pdf
⭐ 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
⭐ 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
⭐ 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.
Type systems, oida!
⛩ Gradual, structural, generic
( Distinct value / type namespaces
) Extensive type inference
* Control flow analysis
& Object-oriented and functional
Gradual, structural, generic
Duck typing
Type namespaces
primitive types
number
string
boolean
Symbol
Object
null
undefined
number
string
boolean
Symbol
Object
null
undefined
top types any
unknown
number
string
boolean
Symbol
Object
null
undefined
bottom types never
primitive types
number
string
boolean
Symbol
Object
null
undefined
primitive types
number
string
boolean
null
undefined
value types
number
string
boolean
null
undefined
true
false
-1
1000000
NaN
6
120.3
…
…
‘Hello world’
‘Baumi’
value types
true
false
-1
1000000
NaN
6
120.3
…
…
‘Hello world’
‘Baumi’null
undefined
value types
number
string
boolean
true
false
-1
1000000
NaN
6
120.3
…
…
‘Hello world’
‘Baumi’null
undefined
number |
string |
undefined
number
string
boolean
true
false
-1
1000000
NaN
6
120.3
…
…
‘Hello world’
‘Baumi’null
undefined
Intersection types
{ a: string }
{ b: string }
{
a: string,
b: string
}
Examples
fin

TypeScript's Type System