Skip to content
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

chore(node): Extract node version constant #7734

Merged
merged 3 commits into from
Apr 5, 2023

Conversation

AbhiPrasad
Copy link
Member

Just a quick refactor because I noticed this was duplicated everywhere.

@AbhiPrasad AbhiPrasad requested review from a team, mydea and lforst and removed request for a team April 4, 2023 15:26
@@ -0,0 +1,3 @@
import { parseSemver } from '@sentry/utils';

export const NODE_VERSION: ReturnType<typeof parseSemver> = parseSemver(process.versions.node);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Should we not put our own type here (not sure what parseSemver actually returns, a string??)? Seems a bit redundant and if the return type changes we won't actually find out and it will just be different from before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I had to include this because otherwise I was getting a build error:

created build/esm in 355ms
src/nodeVersion.ts:3:14 - error TS4023: Exported variable 'NODE_VERSION' has or is using name 'SemVer' from external module "/Users/abhijeetprasad/workspace/sentry-javascript/packages/utils/build/types/misc" but cannot be named.

3 export const NODE_VERSION = parseSemver(process.versions.node);

It seems because SemVer is not exported, the type breaks?

@AbhiPrasad AbhiPrasad merged commit a0e9489 into develop Apr 5, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-chore-node-version branch April 5, 2023 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants