LinkedSoftwareDependencies / Components.js

🧩 A semantic dependency injection framework
https://componentsjs.readthedocs.io/
Other
41 stars 6 forks source link

fix: improved handling of constructor arguments of type unknown. #95

Closed wkerckho closed 2 years ago

wkerckho commented 2 years ago

Relevant issue: Components.js related issue in the Solid Community Server https://github.com/CommunitySolidServer/CommunitySolidServer/issues/1182

Purpose

The goal of these changes is to ensure that primitive constructor arguments preserve their data type when using unknown as argument type.

Changes

I've updated the method hasValueType in ParameterPropertyHandlerRange to perform additional handling in case the type is a ParameterRangeWildcard (the type that is generated when using unknown).

I've added testing for various cases of instantiations when using an unknown constructor argument in the file instantiateFile-test.

Improvements

Possible improvements for this fix that can be performed by someone that is more familiar with the Components.js codebase:

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 2320004393

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 2299708934: 0.0%
Covered Lines: 1265
Relevant Lines: 1265

💛 - Coveralls
wkerckho commented 2 years ago

Incorporated the requested changes and updated ParameterPropertyHandlerRange-test.ts:

rubensworks commented 2 years ago

Thanks for this! Released as 5.2.0.