In my Typescript projects, I frequently use an npm module called common-types
(repository: https://github.com/lifegadget/common-types). Recently, I added an enum for managing Firebase projects named FirebaseEvent
. Here is how it is defined:
export enum FirebaseEvent {
value = 'value',
child_added = 'child_added',
child_moved = 'child_moved',
child_removed = 'child_removed',
child_changed = 'child_changed'
};
The issue arises when attempting to import this enum using the following statement:
import { FirebaseEvent } from 'common-types';
This results in the following error:
https://i.stack.imgur.com/u9Hv0.png
It's worth noting that line 5 of the common-types file reads as follows:
export interface IDictionary<T = any> {
[key: string]: T;
}
Although the error message may point to this line, importing other parts of the module like IDictionary
or datetime
works without issue.
Interestingly, any attempt to import FirebaseEvent
along with other components such as shown below also triggers the same error:
import { IDictionary, FirebaseEvent } from 'common-types';