tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
553 stars 20 forks source link

Declare typeScript more strictly in config.ts #146

Closed po4tion closed 1 year ago

po4tion commented 1 year ago
  1. 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.

  2. 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.

  3. Finally, I changed "link" to the new "app directory" document of nextjs.

Comment if you have any additional advice!

tatethurston commented 1 year ago

Awesome, thanks.

  1. Agreed.
  2. 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.
  3. Perfect.