Consider the following predefined object:
const obj = {
ONE: 'ONE',
TWO: 'TWO'
};
If I attempt to assign the constant obj.ONE
to a new type like this:
type TOne = obj.ONE
An error message is displayed stating:
Cannot find namespace 'obj'.
or
'ONE' refers to a value, but is being used as a type here.
when the strings are not enclosed within an object. Is there a solution to enable me to assign a predefined string to a type successfully?