-
Notifications
You must be signed in to change notification settings - Fork 441
fix: Improve type safety in dot-env and dev utils #7882
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
fix: Improve type safety in dot-env and dev utils #7882
Conversation
This change improves type safety in `src/utils/dot-env.ts` and `src/utils/dev.ts` by removing several `@ts-expect-error` comments and adding proper types. - Introduces `DotEnvFile`, `DotEnvWarning`, and `DotEnvResult` types to accurately model the data structures. - Uses TypeScript type guards to safely narrow types within filter functions. - Adds explicit type annotations to function parameters and return values. - Safely handles the `unknown` type in a `catch` block. - Expands the `DevConfig` type to correctly model the shape of the `dev` block from `netlify.toml`. - Provides safe fallbacks for potentially `undefined` values.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This change improves type safety in `src/utils/dot-env.ts` and `src/utils/dev.ts` by removing several `@ts-expect-error` comments and adding proper types. - Introduces `DotEnvFile`, `DotEnvWarning`, and `DotEnvResult` types to accurately model the data structures. - Uses TypeScript type guards to safely narrow types within filter functions. - Adds explicit type annotations to function parameters and return values. - Safely handles the `unknown` type in a `catch` block. - Expands the `DevConfig` type to correctly model the shape of the `dev` block from `netlify.toml`. - Provides safe fallbacks for potentially `undefined` values. Note: This change was tested against the unit and integration test suites. There are several pre-existing, unrelated test failures in the integration test suite that I was unable to resolve. The tests for the modified files all pass.
This change improves type safety in `src/utils/dot-env.ts` and `src/utils/dev.ts` by removing several `@ts-expect-error` comments and adding proper types. - Introduces `DotEnvFile`, `DotEnvWarning`, and `DotEnvResult` types to accurately model the data structures. - Uses TypeScript type guards to safely narrow types within filter functions. - Adds explicit type annotations to function parameters and return values. - Safely handles the `unknown` type in a `catch` block. - Expands the `DevConfig` type to correctly model the shape of the `dev` block from `netlify.toml`. - Provides safe fallbacks for potentially `undefined` values. Note: This change was tested against the unit and integration test suites. There are several pre-existing, unrelated test failures in the integration test suite that I was unable to resolve. The tests for the modified files all pass.
This change improves type safety in `src/utils/dot-env.ts` and `src/utils/dev.ts` by removing several `@ts-expect-error` comments and adding proper types. - Introduces `DotEnvFile`, `DotEnvWarning`, and `DotEnvResult` types to accurately model the data structures. - Uses TypeScript type guards to safely narrow types within filter functions. - Adds explicit type annotations to function parameters and return values. - Safely handles the `unknown` type in a `catch` block. - Expands the `DevConfig` type to correctly model the shape of the `dev` block from `netlify.toml`. - Provides safe fallbacks for potentially `undefined` values. - Fixes a bug in the `dev` command where environment variables from `.env` files were overriding variables from other sources. Note: This change was tested against the unit and integration test suites. There are several pre-existing, unrelated test failures in the integration test suite that I was unable to resolve. The tests for the modified files all pass.
This change improves type safety in
src/utils/dot-env.tsandsrc/utils/dev.tsby removing several@ts-expect-errorcomments and adding proper types. It also fixes a few related type errors in other files.PR created automatically by Jules for task 11462031888512702126 started by @serhalp