I\'ve searched around but can\'t seem to find an answer for this, hopefully you can help. How can I add an enum to Image? This is what I would like ideally but I get an error.>
I think the following is an improvement on KoenT's solution:
export class Image
{
constructor ()
{
this.state = Image.State.Idle;
}
state: Image.State;
}
export namespace Image
{
export enum State
{
Idle,
Loading,
Ready,
Error
}
}
The advantage being that you can leverage named imports:
import {Image} from './image';
let img = new Image()
img.state = Image.State.Error