Skip to content

chore(node): Extract node version constant#7734

Merged
AbhiPrasad merged 3 commits intodevelopfrom
abhi-chore-node-version
Apr 5, 2023
Merged

chore(node): Extract node version constant#7734
AbhiPrasad merged 3 commits intodevelopfrom
abhi-chore-node-version

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Contributor

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

@AbhiPrasad AbhiPrasad requested review from a team, lforst and mydea 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
Copy Markdown
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
Copy Markdown
Contributor 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