This project is read-only.

Please add support for 'const' (immutable) variables and objects.

Topics: Language Specification
Oct 3, 2012 at 7:07 PM

See :

"In object-oriented and functional programming, an immutable object is an object whose state cannot be modified after it is created."

For example for variable and member declarations:

const MAX = 43;

But also for function parameters:

function foo( const bar : Bar ) { ... }


Oct 3, 2012 at 9:41 PM

The type system in TypeScript focuses on ECMAScript interfaces and features, so we likely won't support creating constants if ECMAScript doesn't support it.

That said, ES5 does allow you to create readonly fields (eg, using the Object.defineProperty), which we could look into supporting.