-
Notifications
You must be signed in to change notification settings - Fork 0
Fix TypeScript build errors and prepare deployment #23
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| /// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| /// <reference path="./.next/types/routes.d.ts" /> | ||
| import "./.next/types/routes.d.ts"; | ||
|
|
||
| // NOTE: This file should not be edited | ||
| // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,7 +38,11 @@ function SetPasswordForm() { | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| setLoading(true); | ||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||
| const auth = await setPassword({ token, password }); | ||||||||||||||||||||||||||||||||||||||||
| const auth =await setPassword({ | ||||||||||||||||||||||||||||||||||||||||
| username: "", | ||||||||||||||||||||||||||||||||||||||||
| otp: token, | ||||||||||||||||||||||||||||||||||||||||
| password | ||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not send an empty At Line 42, Proposed fix const searchParams = useSearchParams();
const token = searchParams.get("token") ?? "";
+ const username = searchParams.get("username") ?? "";
@@
- if (!token) {
- setError("Invalid or missing activation token. Please use the link from your email.");
+ if (!token || !username) {
+ setError("Invalid activation link. Please use the latest link from your email.");
return;
}
@@
const auth =await setPassword({
- username: "",
+ username,
otp: token,
password
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| setSuccess(true); | ||||||||||||||||||||||||||||||||||||||||
| setTimeout(() => router.push(roleToRoute(auth.role)), 1500); | ||||||||||||||||||||||||||||||||||||||||
| } catch (err) { | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Next.js 15 typed routes configuration next-env.d.ts correct syntax💡 Result:
In Next.js 15, you should not manually edit the next-env.d.ts file [1][2][3]. This file is automatically generated and managed by Next.js whenever you run next dev, next build, or next typegen [1][2]. Modifying it will result in your changes being overwritten [1][2]. To enable and configure typed routes, follow these steps: 1. Enable typedRoutes: Open your next.config.js (or next.config.ts) and set typedRoutes to true [4]. // next.config.ts import type { NextConfig } from 'next'; const nextConfig: NextConfig = { typedRoutes: true, }; export default nextConfig; 2. Ensure tsconfig.json configuration: Your tsconfig.json must include the generated type definitions [1][2]. This is usually handled automatically by create-next-app, but you should verify that your include array contains the following paths [1][2]: { "include": [ "next-env.d.ts", ".next/types//.ts", "/.ts", "/.tsx" ] } 3. Custom Type Declarations: If you need to add your own custom type declarations, do not add them to next-env.d.ts [1][2]. Instead, create a separate file (e.g., custom-types.d.ts) and add that filename to the include array in your tsconfig.json [1][2][3]. How it works: When typedRoutes is enabled, Next.js generates a hidden directory at.next/types that contains information about all valid routes in your application [1][2]. By including.next/types//.ts in your tsconfig.json, the TypeScript compiler can access these generated types to provide real-time validation and autocompletion for href values in components like next/link and methods in next/navigation [1][2]. Important notes: - Version Control: It is recommended to add next-env.d.ts to your.gitignore file, as it is generated dynamically [1][2][3]. - CI/CD: If you perform separate type checking in your CI pipeline, ensure you run next typegen before your type checker (e.g., tsc --noEmit) to ensure the route types are up to date [5].
Citations:
next typegenneeds to be run in CI in case of seperate type check vercel/next.js#82916🏁 Script executed:
Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE
Length of output: 666
🏁 Script executed:
Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE
Length of output: 194
🏁 Script executed:
Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE
Length of output: 780
🏁 Script executed:
Repository: SheCanCODE-Capstone-Projects/Med-Delivery-System-FE
Length of output: 961
🌐 Web query:
next-env.d.ts import "./.next/types/routes.d.ts"; Next.js typed routes next-env.d.ts should not be edited syntax💡 Result:
The file next-env.d.ts is an auto-generated file in Next.js projects that ensures TypeScript recognizes Next.js type definitions, such as those for non-code imports (e.g., images, stylesheets) and route types [1][2]. You should never manually edit this file [3][2]. Because it is automatically regenerated by Next.js commands like next dev, next build, and next typegen, any manual changes will be overwritten [2]. Key takeaways regarding next-env.d.ts: 1. Do not edit or remove it: The file is managed entirely by the Next.js framework [3][2]. 2. Version control: It is recommended to add next-env.d.ts to your.gitignore file to avoid unnecessary churn in version control, as the file content can change based on the last command run (e.g., dev vs. build) [4][2][5]. 3. Generation in CI: If your CI pipeline requires type checking (e.g., via tsc), you must ensure the file exists. You can generate it by running npx next typegen before your type-checking command [4][6][5]. 4. Custom types: If you need to add custom TypeScript declarations, create a separate.d.ts file and include it in your tsconfig.json file, rather than attempting to modify next-env.d.ts [3][1][2]. The import statement import "./.next/types/routes.d.ts"; is a standard part of this auto-generated file when the experimental typedRoutes feature is enabled [1][2]. It allows Next.js to provide type-safe hrefs for components like next/link [2].
Citations:
next typegenneeds to be run in CI in case of seperate type check vercel/next.js#82916Stop manually editing
next-env.d.ts; configure typed routes vianext.config.mjsand let Next regenerate it.next-env.d.tsis annotated as “This file should not be edited” but it now includesimport "./.next/types/routes.d.ts";. Sincenext.config.mjsdoes not enabletypedRoutes, this routes import likely came from a previous typegen run—update typed routes configuration (typedRoutes: true) and regenerate, or revert/remove the manualroutes.d.tsimport so type generation matches the current config.🤖 Prompt for AI Agents