-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(opentelemetry-node): fix types to be on the ./sdk entry-point where they are to be used #444
Conversation
…re they are to be used For clarity (I hope) I've moved the lib/index.js to lib/sdk.js to match the entry-point name. THis adds a small test case ensuring a TypeScript 5 project is able to use @elastic/opentelemetry-node.
Hi @trentm
This is due to the User apps must have this feat to be able to resolve the exports from our package. We can say that min version required of TypeScript is npm view typescript time
...
'4.7.2': '2022-05-24T18:38:10.371Z',
... Here's the diff after doing the checks, I've added git diff
diff --git a/packages/opentelemetry-node/test/fixtures/a-ts-proj/package.json b/packages/opentelemetry-node/test/fixtures/a-ts-proj/package.json
index b939929..b755e65 100644
--- a/packages/opentelemetry-node/test/fixtures/a-ts-proj/package.json
+++ b/packages/opentelemetry-node/test/fixtures/a-ts-proj/package.json
@@ -8,7 +8,8 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "typescript": "^5.0.2"
+ "@types/node": "^22.9.3",
+ "typescript": "^4.7.2"
},
"dependencies": {
"@elastic/opentelemetry-node": "file:../../.." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is good. Let's decide on the TS version later
"lint:license-files": "../../scripts/gen-notice.sh --lint . # requires node >=16", | ||
"lint:changelog": "../../scripts/extract-release-notes.sh .", | ||
"test": "NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env tape test/**/*.test.js", | ||
"test:without-test-services": "tape test/**/*.test.js", | ||
"test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait", | ||
"test-services:stop": "docker compose -f ./test/docker-compose.yaml down", | ||
"gen:types": "rm -rf types && tsc" | ||
"gen:types": "rm -rf types && tsc # TODO: would be nice to tree-shake the dts files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we create an issue for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah. :) At least I won't bother. The odd TODO for low-priority and clear nice-to-haves in the code is fine by me. I don't object to one being created, however.
For clarity (I hope) I've moved the lib/index.js to lib/sdk.js to
match the entry-point name. THis adds a small test case ensuring
a TypeScript 5 project is able to use @elastic/opentelemetry-node.
@david-luna This differs a bit from what we pair-programmed:
npx tsc
on the CLI it failed. So I think this means we **want to set a min-supported TS version of v5, at least to use the ".../sdk" entry-point.the failure with 'npx tsc'
Here is what the added test case looks like before the fix, i.e. showing that is fails as we expected:
test failure (before the fix was applied)