frankcollins3 / Next-Water-App

Happy, Healthy Water Cycling App that tracks user/human fluid intake.
https://next-water-app.vercel.app
1 stars 0 forks source link

parseInt() to deal with string | number [3:31pm] #77

Closed frankcollins3 closed 11 months ago

frankcollins3 commented 11 months ago

attempting to do: create "remember me" functionality based on cookies.

error: now modularized func: iPROMISEcookies returns: const sliceID = cookieIdString.slice(3) cookieIdString = "id=${id}" which returns ${id} return sliceID || "no ID to return! sorry!"

if the id gets brought back successfully, parseInt(${sliceID}) will return a number. if it's the string it returns NaN. now, this promise has been moved to useContext.tsx for modularity but I just checked if parseInt("mystring") returns NaN. it does.

Screen Shot 2023-07-21 at 3 30 22 PM

proposed approach: 1: error message suggests: This condition will always return 'true'.ts(2845) LogInOutGoogle2.tsx(68, 57): Did you mean '!Number.isNaN(IDtokenINT)'?

perhaps do that. just kind of confused how dragging and dropping same {NaN} becomes always true especially seeing as how that value is can be either a string so it could not always be true?

frankcollins3 commented 11 months ago

suggestion works so convention evolves. as stated, still confused how that type gets returned, for which it cant be checked [3:36pm]