-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lacking null checks and improved method description and running tests #339
Comments
Hello 👋 @christian3042 |
@christian3042
and updated descriptions |
There was a similar issue already and it partly has been fixed: #122 The reason why null checks are necessary, is because regExp.exec(this.document.cookie) can return null. You can check the interface RegExp:
The code itself executed might not return a null value in this case, but from the interface definition a null check should be done. |
Describe the bug
During the development of an application using the ngx-cookie-service, I ran into some issue, that my Cookies didn't get deleted. Checking the Readme I found the solution:
This should replace the description of the deleteAll() method, as
is confusing and can be misunderstood. Because the non accessible cookies from other paths won't get deleted.
I also checked the code and found some missing null checks, and tried to fix it:
/projects/ngx-cookie-service/src/lib/cookie.service.ts:
projects/ngx-cookie-service-ssr/src/lib/ssr-cookie.service.ts:
Unfortunately I didn't manage to run the tests on my machine. Is there any documentation on how to run the tests? I tried to use jest / ts-jest and use same babel / jest config.js but ran from one error to another. Could you also please provide the test dependencies in the package.json and also test configuration files? That would help other devs, to run the tests easily.
Steps to Reproduce
Linter errors are shown in VSCode:
Type 'RegExpExecArray | null' is not assignable to type 'RegExpExecArray'.
Type 'null' is not assignable to type 'RegExpExecArray'.ts(2322)
Expected behaviour
No linter errors.
What version of the library you see this issue?
19.0.0
What version of Angular are you using?
Angular 19
The text was updated successfully, but these errors were encountered: