Having this code snippet:
declare enum Snacks {
APPLE = 'APPLE',
CARROT = 'CARROT',
JERKY = 'JERKY'
}
declare abstract class ForceSnacks {
static snack : Snacks
}
export class MySnacks implements ForceSnacks {
static snack = Snacks.APPLE;
}
Encountering an unfamiliar error:
https://i.sstatic.net/egTmy.png
Does anyone have a solution to resolve the ambient initializer error?
The error message reads as follows:
"Initializers are not allowed in ambient contexts"
Sometimes, another error appears:
"Ambient declaration should have no initializer"