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

fix(instrumentation): allow different export types for files within a Node module #4046

Closed

Conversation

haines
Copy link

@haines haines commented Aug 9, 2023

Which problem is this PR solving?

The InstrumentationModuleDefinition<T> interface defines a property files: InstrumentationModuleFile<any>[].

InstrumentationNodeModuleDefinition<T> implements this interface but defines the property as files: InstrumentationModuleFile<T>[]. This implies that all files within the module have the same exports type, which is unlikely! As a result, you cannot (for example) call .push() on the files field without type casting.

Short description of the changes

This PR changes the type of the property in the class to match the interface it implements.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

npm run compile

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@haines haines force-pushed the fix-node-module-file-export-types branch from 16864d4 to c2cdd98 Compare August 9, 2023 09:21
@haines haines changed the title fix(instrumentation): allow different export types for files within a module fix(instrumentation): allow different export types for files within a Node module Aug 9, 2023
@haines haines force-pushed the fix-node-module-file-export-types branch from c2cdd98 to a3e55f7 Compare August 9, 2023 09:36
@haines haines marked this pull request as ready for review August 9, 2023 09:38
@haines haines requested a review from a team August 9, 2023 09:38
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #4046 (41fb74f) into main (e01f493) will decrease coverage by 0.61%.
The diff coverage is n/a.

❗ Current head 41fb74f differs from pull request most recent head 030c97e. Consider uploading reports for the commit 030c97e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4046      +/-   ##
==========================================
- Coverage   92.83%   92.23%   -0.61%     
==========================================
  Files         328      334       +6     
  Lines        9519     9463      -56     
  Branches     2050     2009      -41     
==========================================
- Hits         8837     8728     -109     
- Misses        682      735      +53     
Files Coverage Δ
...ntation/src/instrumentationNodeModuleDefinition.ts 14.28% <ø> (ø)

... and 63 files with indirect coverage changes

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Oct 9, 2023
@haines haines force-pushed the fix-node-module-file-export-types branch from a3e55f7 to 9796bb1 Compare October 9, 2023 12:52
@github-actions github-actions bot removed the stale label Oct 16, 2023
@haines haines force-pushed the fix-node-module-file-export-types branch from 9796bb1 to d2e415d Compare November 3, 2023 10:43
Copy link

github-actions bot commented Jan 8, 2024

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 8, 2024
@haines haines force-pushed the fix-node-module-file-export-types branch from d2e415d to 41fb74f Compare January 9, 2024 15:36
@haines
Copy link
Author

haines commented Jan 9, 2024

@pichlermarc could you please take a look?

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

I can see this being useful. Pinging @dyladan as I seem to remember we talked about this at some point - he might have some input on the matter.

@@ -22,7 +22,7 @@ import {
export class InstrumentationNodeModuleDefinition<T>
Copy link
Member

Choose a reason for hiding this comment

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

@dyladan I seem to remember that we discussed changing this to <T=any> at some point so that it can be left out for reasons like this. WDYT?

… Node module

Signed-off-by: Andrew Haines <andrew@haines.org.nz>
@haines haines force-pushed the fix-node-module-file-export-types branch from da28a0a to 030c97e Compare April 4, 2024 09:25
@haines
Copy link
Author

haines commented Apr 4, 2024

Hi @pichlermarc @dyladan, is there anything blocking getting this merged?

@pichlermarc
Copy link
Member

@haines we'll likely remove this type-parameter completely as we've had multiple probems with this in the past. See #4598 for a full write-up.

@haines haines closed this Apr 4, 2024
@haines haines deleted the fix-node-module-file-export-types branch April 4, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants