Molten

What was removed from TypeScript

Cast leaves out anything that would need a runtime (types at runtime, a garbage collector, exceptions). Each removal has a direct replacement, and the compiler's message names it.

You write Compiler says Use instead
any 'any' was removed; use unions or generics A union or a generic
unknown 'unknown' was removed; use unions or generics A union or a generic
undefined 'undefined' was removed; use 'null' null and T | null
var 'var' was removed; use 'let' or 'const' let, const
===, !== '===' was removed; use '==' ==, != (already strict)
throw, try, catch 'throw' was removed; return a nullable value or result union Return T | null or a result union
number 'number' was removed; use 'int' or 'float' int, float or a sized type
Adding fields at runtime type FixedLayout has no member 'added' Declare the field, or use Map<K, V>
Index signatures { [k: string]: T } index signatures were removed; use Map<K, V> Map<K, V>
get x() / set x(v) getters and setters were removed; use plain methods Plain methods (methods named get and set are fine)
eval(...) 'eval' was removed; use a plain function A function
obj.prototype type Example has no member 'prototype' Plain methods
class B extends A inheritance is not supported An interface with implements
Closures that change captured variables cannot assign to captured variable 'count' Captures are snapshots; keep mutable state in an object
async, await 'async' is reserved Not yet; reserved for coroutines

Not available (yet)

These are TypeScript features Cast doesn't have today. Some are rejected by the parser with a generic message:

Feature Message
Module-level let expected import, function, struct, const, or default behavior
enum expected import, function, struct, const, or default behavior (use a string literal union)
Default parameter values, optional parameters x?: T expected ')'
** exponentiation operators are not supported yet (use pow)
for...in expected ';' (use for...of)
Math.*, console.* unknown name 'Math', unknown name 'console' (use the built-ins and print)
new on a struct 'new' requires a class name (call it: Vec(1, 2))

Coroutines

async function and await are planned: they will compile to small state machines, so a wave spawner could await seconds(1.5) cheaply. They are not in v1 because the rule for a code reload while coroutines are suspended is still undecided. The keywords are reserved so adding them later breaks nothing.

View this page's source on GitHub