Typescript: constants in an interface

You cannot declare values in an interface.

You can declare values in a module:

module OlympicMedal {
    export var GOLD = "Gold";
    export var SILVER = "Silver";
}

In an upcoming release of TypeScript, you will be able to use const:

module OlympicMedal {
    export const GOLD = "Gold";
    export const SILVER = "Silver";
}

OlympicMedal.GOLD = 'Bronze'; // Error

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)