enums are undefined on namespace merging
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
A bug: please describe the error that you encountered Typescript declartion merging leaves, enums undefined.
export interface Test {
}
export namespace Test {
export enum TestEnum {
Hello='Hello',
World='World'
}
}
Test.TestEnum === undefined.
Test.TestEnum.Hello <-- throws error because undefined.
How To Reproduce
A bug: please include instructions how to reproduce. Issues without reproduction are likely to receive no feedback.
- Create some files with the above setup.
- Attempt to import the
Test
interface and use theTestEnum
somewhere. It will throw an error because theTestEnum
is undefined
Can you reproduce the error in the integration tests in ng-packagr?
If possible, take a look at the integration/samples
and try to break one of these builds!
Is the error you faced in an application importing the library
Try to break the Angular CLI app in integration/consumers/ng-cli
!
Expected Behaviour
A bug: please describe what behaviour or result you expected No Error
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 2.4.2
@angular/*: 5.2.4
typescript: 2.7.1
rxjs: 5.5.10
node: 9.8.1
npm/yarn: yarn 1.5.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
What does it mean: Enum declarations can only merge with ...
sharedDirectory/Types.ts:880:13 Type error: Enum declarations can only merge with namespace or other enum declarations. 878 | }*/ 879 |.
Read more >Merging and Adding Functionality to Enum - Learn TypeScript
In this lesson, you will see two advanced features: merging and adding functions to enum.
Read more >Enum Class (System) - Microsoft Learn
Provides the base class for enumerations. ... Namespace: System ... to the enumeration type even if that numeric value is not defined in...
Read more >Enumeration in TypeScript - Gregory Pabian - Medium
Interestingly enough, we are allowed to merge multiple const enum statements across ... We can use the name of the enumeration type to...
Read more >12 TypeScript enums: How do they work? What can they be ...
12.2 Specifying enum member values (advanced) # · A literal enum member: either has no initializer; or is initialized via a number literal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @alan-agius4,
tsickle
has released version0.29.0
which apparently fixes this problem. 🥂 🎊Did you use annotateForClosureCompiler in your own project before? As without this flag tsickle won’t be used.