Working on a project in Angular 6, I encountered an issue with using the npm package object-set-all-values-to version 3.9.45
. Here's what I did:
1- Successfully installed it using npm i object-set-all-values-to
✔️ OK
2- However, when trying to import it, I faced an error ❌
- Option 1:
import setAllValuesTo from 'object-set-all-values-to';
I encountered an issue where the declaration file for module 'object-set-all-values-to' was not found. This led me to explore potential solutions but none seemed to work.
- Option 2:
import setAllValuesTo from 'object-set-all-values-to/dist/object-set-all-values-to.esm.js';
Similar to option 1, this approach also presented challenges in finding the declaration file for the module.
If you have any suggestions on how to resolve this issue, please share your insights.
Although using an alternative solution (
const setAllValuesTo = require('object-set-all-values-to');
) worked, it does not align with the strict code style rules enforced in my project.
Despite attempting various methods proposed by others facing similar issues, including adding comments and declarations, I still haven't managed to overcome the problem.
The presence or absence of types for 'object-set-all-values-to' became apparent during troubleshooting, as attempts to install them resulted in an error (npm ERR! code E404).
Reviewing the configuration values in tsconfig.json
, certain settings such as "noImplicitAny" were trialed individually to test their impact. An adjustment to this setting resolved one error but introduced another related to the function being called not recognized.
A reported concern to the package author regarding this issue remains unanswered thus far.