We recently exported a const enum
: export const enum SemconvStability
from #5684, released in @opentelemetry/instrumentation@0.201.0
. From a quick look, there are no other const enum
exports from packages in this repo.
TIL exporting a const enum
from a package is problematic for some usages of the package. https://ncjamieson.com/dont-export-const-enums/ explains the issue. Some tooling will compile TS modules one file at a time in isolation. In those cases, a const enum reference, e.g. SemconvStability.OLD
, cannot be resolved. One such tooling example is ts-node
being used by mocha for testing in opentelemetry-js.git and opentelemetry-js-contrib.git. I gather that this was not an issue for usage of SemconvStability
in the same repo (e.g. in instr-http, instr-xhr, instr-fetch), because it is a monorepo where the dependencies are symlinks to the source dir.
We hit the error in this PR, the first one in opentelemetry-js-contrib to attempt to use SemconvStability
: open-telemetry/opentelemetry-js-contrib#2671 (comment)
To fix this:
const enum
to enum
. I've confirmed this fixes the testing issue for the instrumentation-knex PR above. fix(instrumentation): change SemconvStability
export from const enum
to enum
#5692isolatedModules: true
to our tsconfig.json in the opentelemetry-js repo. This config is suggested in the blog post above as a way to guard against exporting const enums. Adding this config also means dealing with a number (153) of cases of error TS1205: Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'.
in our packages, so this is a larger change. (See chore: enable tsconfig isolatedModules #5697)isolatedModules
compilation option opentelemetry-js-contrib#2839 for contrib repoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4