giotiskl / filterizr

:sparkles: Filterizr is a JavaScript library that sorts, shuffles and filters responsive galleries using CSS3 transitions :sparkles:
MIT License
647 stars 246 forks source link

Angular cli compile errors #119

Open karl04 opened 5 years ago

karl04 commented 5 years ago

I have integrated the plugin into my project but when I go to compile using the angular cli, I get the following error

ERROR in node_modules/filterizr/dist/FilterContainer.d.ts(1,10): error TS2305: Module '"/Users/work/project/project1/node_modules/filterizr/dist/FilterizrOptions/defaultOptions"' has no exported member 'RawOptionsCallbacks'

node_modules/filterizr/dist/FilterItems.d.ts(1,10): error TS2305: Module '"/Users/work/project/project1/node_modules/filterizr/dist/ActiveFilter"' has no exported member 'Filter'.

Is this module compatible with angular cli?

giotiskl commented 5 years ago

@karl04 which Filterizr version are you using?

Can you share also a code snippet please of where the error is happening?

karl04 commented 5 years ago

@giotiskl I'm using version filterizr": "^2.2.3"

when I run the ng build command, it throws the above errors

giotiskl commented 5 years ago

@karl04 can you share the code snippet where you import/use Filterizr or are the errors simply thrown by adding filterizr to your node modules and runing the ng build command?

It looks like there's some problem with the type declarations shipped with Filterizr, adding to your tsconfig.json the following will temporarily disable these issues (most likely) but that's not a proper fix ofc.

{
    "compilerOptions": {
        "skipLibCheck": true,
        ...
    },
    ...
}

I'll have to look more into this

karl04 commented 5 years ago

the errors simply thrown by adding filterizr to node modules and running the ng build command.

yes it compiles with the flag enabled, but is there a way to just skip checking for this module?

giotiskl commented 5 years ago

@karl04 could you please also share the contents of your tsconfig.json?

As far as I know the skipLibCheck option is applied to all installed (TypeScript) libraries, but is not necessarily a bad practice (e.g. FB's create-react-app has it enabled by default for newly created TypeScript React apps). In some cases it can even speed up the compilation of your own app.

The thing is that some times libraries have a less (or more) strict tsconfig than your own which can cause incompatibilities.

Although based on the error you get it looks like some types are not exported properly. I couldn't reproduce it yet unfortunately.

karl04 commented 5 years ago

{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", //"skipLibCheck": true, "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2016", "dom" ] },

"exclude": ["./node_modules"], "angularCompilerOptions": { "preserveWhitespaces": false } }

mikr96 commented 5 years ago

I have integrated the plugin into my project but when I go to compile using the angular cli, I get the following error ERROR in node_modules/filterizr/dist/FilterContainer.d.ts(1,10): error TS2305: Module '"/Users/work/project/project1/node_modules/filterizr/dist/FilterizrOptions/defaultOptions"' has no exported member 'RawOptionsCallbacks' node_modules/filterizr/dist/FilterItems.d.ts(1,10): error TS2305: Module '"/Users/work/project/project1/node_modules/filterizr/dist/ActiveFilter"' has no exported member 'Filter'. Is this module compatible with angular cli?

I also had the same error with ionic 4. Any solution ?