jvandemo / jvandemo/generator-angular2-library
Duplicate export for enums error
- Dominant language
- JavaScript
- Stars
- 740
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I have the following format for enums in my code:
```
export enum UserRolesEnum {
ADMIN,
OTHER
}
```
```
export namespace UserRolesEnum {
export function toString(v: UserRolesEnum): string {
return UserRolesEnum[v];
}
export function stringToEnum(input: string): UserRolesEnum {
let enumString: UserRolesEnum = UserRolesEnum[input];
return enumString;
}
}
```
> I'm getting the following error:
> Error: Duplicate export 'UserRolesEnum'
> at error (...node_modules/gulp-rollup/node_modules/rollup/dist/rollup.js:185:14)
> at Module.error (...node_modules/gulp-rollup/node_modules/rollup/dist/rollup.js:8170:3)
> at tryParse (...node_modules/gulp-rollup/node_modules/rollup/dist/rollup.js:7888:10)
> at new Module (...node_modules/gulp-rollup/node_modules/rollup/dist/rollup.js:7924:15)
> at load.catch.then.then.then.source (...node_modules/gulp-rollup/node_modules/rollup/dist/rollup.js:9749:20)
> at process._tickCallback (internal/process/next_tick.js:109:7)
Is there a way to fix this without renaming my enums and namespaces?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported TypeScript enum and namespace export with the generator's gulp-rollup setup, then trace the Rollup duplicate-export error in the build configuration. Done means the example builds without renaming UserRolesEnum or its namespace; the payload names no repository files or tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100