ellipsed icon indicating copy to clipboard operation
ellipsed copied to clipboard

ES6 import issue - Could not find a declaration file for module 'ellipsed'.

Open richardpap opened this issue 5 years ago • 2 comments

Hey,

I'm trying to import the lib the ES6 way: import { ellipsis } from 'ellipsed';

However, I'm getting the following error.

Could not find a declaration file for module 'ellipsed'. 'project_path/node_modules/ellipsed/lib/ellipsed.js' implicitly has an 'any' type. Try npm install @types/ellipsed if it exists or add a new declaration (.d.ts) file containing declare module 'ellipsed'; [7016]

Any idea why is this happening? Thanks!

richardpap avatar Mar 06 '19 10:03 richardpap

Hi @richardpap, can you tell me about your development environment? I have no trouble importing it as es6 module as described.

Just to be safe, if you're using it as es6 module, you'll need a parser like babel. Do you have any particular configuration?

nzambello avatar Mar 07 '19 11:03 nzambello

Yea, sure.

I'm using webpack 4, so babel is implemented.

"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0"

And this is how babel is set:

{
    "presets": [
        [
            "env",
            {
                "useBuiltIns": true,
                "targets": {
                    "browsers": [
                        "last 2 versions",
                        "safari > 8",
                        "not ie < 11"
                    ]
                }
            }
        ]
    ]
}

richardpap avatar Mar 11 '19 10:03 richardpap

Resolved as now supports TS declarations

nzambello avatar Nov 23 '22 18:11 nzambello