toLowerCase() function / method not found

Not sure if I need a specific type library, but most String.prototype functions built into JS are marking themselves as not found. For example:

8 comments

Does it work if you write

"".toLowerCase()

Also, did you try invalidating caches?

0

Elena, 

I tried invalidating the cache and restarting, didn't change it. 

I tried console.log('HELLO'.toLowerCase()); And it does work, so it must not like that I'm applying it to a variable?

0

Seems that it doesn't correctly infer email type (it has no clue what parameter type is expected and may resolve it by name to some existing function in your app). Try ctrl+clicking on email - what definition are you taken to?

0

When I tried ctrl + clicking it to find the parameter definition it does nothing. I installed the type library for passport, as well as passport local, so I'm unsure why it thinks that. Email is defined as a string in the User Schema (which is in the Model folder, as it should be). Is there a way I can get it to infer that it's a string? 

0

You can try using inline JsDoc annotations, like

(/*string*/email
1

you need ading the annotation to your callback declaration

(/*string*/email, password, done) => (...
1

That worked! Thank you! Never used jsDoc annotations before, thanks! 

0

Please sign in to leave a comment.