I have this:
declare enum Foods {
CHERRY = 'CHERRY',
LETTUCE = 'LETTUCE',
JERKY = 'JERKY'
}
declare abstract class ForceFoods {
static food : Foods
}
export class MyFoods implements ForceFoods {
static food = Foods.CHERRY;
}
But here is the error that I don't know how to solve:
Does anyone know how to fix that the ambient initializer error?
Here is the error:
"Initializers are not allowed in ambient contexts"
I also get this error sometimes:
"Ambient declaration should have no initializer"
The reason for the error was because all the code was in a declaration file (.d.ts). To fix the error, put the implementing class in a .ts file:
// index.d.ts
// index.ts