Reputation: 43
I'm encountering a build error in my package. I've created a minimal reproduction of the issue here: https://github.com/mannam95/ts-export.
Background
I have a namespace called GLOBALENUMS
defined as follows:
export namespace GLOBALENUMS {
export enum DROPDOWNDATA {
EXTERNAL_PARTNERS = 'EXTERNAL_PARTNERS',
}
export enum PROCESSMAPNODETYPE {
PROCESSGROUP = 'PROCESSGROUP',
PROCESS = 'PROCESS',
}
}
I then created an interface that refers to one of the enum types:
import { GLOBALENUMS } from "../global-enums";
export interface Process {
id: number;
processName?: string;
processMapType?: GLOBALENUMS.PROCESSMAPNODETYPE;
}
At the main index.ts
file, I export the namespace and the interface:
// global enums
export { GLOBALENUMS } from './ts';
// interfaces
export type { Process } from './ts/interfaces';
The Issue
When running yarn build
(using Parcel for bundling), I get the following error:
@parcel/transformer-typescript-types: Got unexpected null
Error: Got unexpected null
at nullthrows (/home/xxxx/Documents/git/ts-export/node_modules/nullthrows/nullthrows.js:7:15)
at TSModuleGraph.propagate (/home/xxxx/Documents/git/ts-export/node_modules/@parcel/transformer-typescript-types/lib/TSModuleGraph.js:221:48)
at shake (/home/xxxx/Documents/git/ts-export/node_modules/@parcel/transformer-typescript-types/lib/shake.js:37:35)
at /home/xxxx/Documents/git/ts-export/node_modules/@parcel/transformer-typescript-types/lib/TSTypesTransformer.js:119:33
... (rest of error)
Curiously, if I comment out the line that references the enum in the Process
interface:
export interface Process {
id: number;
processName?: string;
// processMapType?: GLOBALENUMS.PROCESSMAPNODETYPE;
}
the build succeeds. This leads me to believe that exporting the GLOBALENUMS
namespace is causing the issue, though I'm not sure why.
Questions
Note:- I want to group all enums in a single namespace. this is just a small example.
Any help or suggestions would be greatly appreciated!
Upvotes: 0
Views: 41