Published npm package doesn't show function hints

Viewed 31

I have a utils function inside my published npm package that exports many functions, The functions look like this:

const createBox = ({id, width}) => {
}  

Before I publish my npm package, When I enter createBox, I can see all parameters it can take but After I publish my npm package and Install it in another project, I don't get any hints and After hovering over the function All I see is an Any word.
I'm using ReactJS, my babel.config.json file:

{
    "presets": [
        [
            "@babel/env",
            {
                "targets": {
                    "edge": "17",
                    "firefox": "60",
                    "chrome": "67",
                    "safari": "11.1"
                },
                "useBuiltIns": "usage",
                "corejs": "3.6.5"
            }
        ],
        "@babel/preset-react"
    ]
}  

And here is the build:

"build": "cross-env NODE_ENV=production babel src/lib --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,__snapshots__",  

How can I build the package so It shows all the function hints including its parameters?.

1 Answers

I'm assuming you are using VSCode? I think this is some annoying default. Try changing this setting in VSCode:

"javascript.implicitProjectConfig.checkJs": true
Related