Describe the bug
when importing LoggerTag from @marblejs/core, the enum is undefined.
To Reproduce
import { LoggerTag } from '@marblejs/core'
console.log(LoggerTag.HTTP)
produces the following error:
console.log(LoggerTag.HTTP);
^
TypeError: Cannot read properties of undefined (reading 'HTTP')
Expected behavior
It should not be undefined
Desktop (please complete the following information):
- OS: MacOS 12.5.1
- Package + Version: @marblejs/core v4.0.3
- Node version v16.15.1
Additional context
It looks like a bundling issue. In my node_modules I can see LoggerTag in the type definitions but not in the .js file
// node_modules/@marblejs/core/dist/logger/logger.interface.js
// LoggerTag is here
import { IO } from 'fp-ts/lib/IO';
export declare type Logger = (opts: LoggerOptions) => IO<void>;
export declare enum LoggerLevel {
INFO = 0,
WARN = 1,
ERROR = 2,
DEBUG = 3,
VERBOSE = 4
}
export declare type LoggerOptions = {
tag: string;
type: string;
message: string;
level?: LoggerLevel;
data?: Record<string, unknown>;
};
export declare const enum LoggerTag {
CORE = "core",
HTTP = "http",
MESSAGING = "messaging",
EVENT_BUS = "event_bus",
WEBSOCKETS = "websockets"
}
// node_modules/@marblejs/core/dist/logger/logger.interface.js
// LoggerTag Missing
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoggerLevel = void 0;
var LoggerLevel;
(function (LoggerLevel) {
LoggerLevel[LoggerLevel["INFO"] = 0] = "INFO";
LoggerLevel[LoggerLevel["WARN"] = 1] = "WARN";
LoggerLevel[LoggerLevel["ERROR"] = 2] = "ERROR";
LoggerLevel[LoggerLevel["DEBUG"] = 3] = "DEBUG";
LoggerLevel[LoggerLevel["VERBOSE"] = 4] = "VERBOSE";
})(LoggerLevel = exports.LoggerLevel || (exports.LoggerLevel = {}));
My intuition is that the syntax in the source code is export const enum LoggerTag and should be export enum LoggerTag (removing the const) to work like LoggerLevel
Describe the bug
when importing
LoggerTagfrom@marblejs/core, the enum is undefined.To Reproduce
produces the following error:
Expected behavior
It should not be undefined
Desktop (please complete the following information):
Additional context
It looks like a bundling issue. In my
node_modulesI can seeLoggerTagin the type definitions but not in the.jsfileMy intuition is that the syntax in the source code is
export const enum LoggerTagand should beexport enum LoggerTag(removing theconst) to work likeLoggerLevel