2

I'm not exactly sure what's going on here but I have a node.js project (type: javascript) with no ts files in it (go figure) that is throwing 3 typescript errors:

Error   TS2304  Cannot find name 'object'.
Error   TS2428  All declarations of 'WeakMap' must have identical type parameters.
Error   TS2304  Cannot find name 'object'.

All 3 of these are in relation to lodash. I'm not quite sure enough about what I'm doing here to even know what to actually search for but I've stumbled across some fixes referencing a tsconfig file or rolling back the lodash version but most of those are old. On top of that, I'm not sure why I would even need that since I'm doing exactly nothing with typescript...

Anyone have any ideas?

2 Answers 2

1

I had the same problem begin working on an existing vanilla Javascript project which uses JQuery version 2.1.4, I want to use latest version of JQuery, Typescript and Webpack in this project but if kept failing when I tried to import some Typescript code into a plain Javascript file. And in this js file, the previous developer added a class called Map to the window object

$(function () {
    window.Map = function ()...;
});

Which conflicts with es6 Map native object, and I kept getting incorrect parameters passes type of error, I then removed the latest jquery version I tried to use, and continue using the same jquery version the developer used initially, and it works again. I still have no idea why using the latest jquery version caused the error.

Not sure if it was helpful

Sign up to request clarification or add additional context in comments.

2 Comments

I'm not even able to get the errors to show up at the moment and I haven't changed anything. If/when they pop up again, I'll comment out all the jquery references and see if it goes away. Thanks for the input. ==EDIT== As I was typing that all the errors popped up. I went ahead and un-included jquery from the project and commented out all references to it...no change
Did you upgrade anything?
0

You should downgrade @types/lodash to version 4.14.50.

See my answer here: In Angular4 - How do I add lodash and do a build without errors

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.