Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #40 enums had
const
added to them. const enums are removed at compile time and replaced with numbers, e.g.:...compiles to:
Here we require strings to be passed to
libdatachannel
, so in #259 we exported objects with values that correspond to the enums so consuming code can import something they can use inPeerConnection
method invocations, e.g.:In #278 the codebase was converted to TypeScript and a non-const enum crept back in. Now all the enums live in
types.ts
and since #300 all exports fromtypes.ts
are re-exported fromindex.ts
.Rollup was introduced as part of #278, but if you check the esm and cjs output dirs,
tests.ts
is not being transpiled totests.js
(I think because they aren't added to the default export oflib/index.js
so would not be in thecjs
version -types/lib/types.d.ts
is present though, sotsc
is doing it's job) and the re-export of the exports fromtests.ts
is being removed so enums are broken again at runtime.The fix here is to give up on enums since they are a constant source of pain for consumers and change them to be types: