In my opinion, using the "as" operator forces the type, so the program can behave unexpectedly regardless of the developer's intentions. Therefore, I think it is better to use type guard than as operator.
I think it is better to change the comparison operator more strictly to avoid unexpected results and to increase the readability and stability of the code.
Finally, I changed "link" to the new "app directory" document of nextjs.
One thing to watch out for is the loose comparison will catch both undefined and null, where this strict comparison will only catch undefined. That is not a problem here though.
In my opinion, using the "as" operator forces the type, so the program can behave unexpectedly regardless of the developer's intentions. Therefore, I think it is better to use type guard than as operator.
I think it is better to change the comparison operator more strictly to avoid unexpected results and to increase the readability and stability of the code.
Finally, I changed "link" to the new "app directory" document of nextjs.
Comment if you have any additional advice!