Imagine I have defined an enum in one file (test1.ts):
export enum Colors{
red=1,
blue=2,
green=3
}
Then in another file (test2.ts), I am creating a class with a method. One of the parameters for that method is a Color from the Colors enum:
'use strict';
declare var require: any;
declare var exports: any;
var Colors = require('Colors');
class DoSomethingWithColor{
ColorFunction(aColour:Colors){
//Exciting color processing goes here..
}
}
However, I am encountering an error:
Cannot find name Colors
Even though it is exported and required in the second file. Could there be something incorrect in my approach or is this not the recommended way to achieve what I intend to do in TypeScript? If not, what would be the preferred solution?
Appreciate your insight