Skip to content
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: fix incorrect dev config types and netlify dev regression #7135

Merged
merged 2 commits into from
Mar 25, 2025
Merged

Conversation

serhalp
Copy link
Collaborator

@serhalp serhalp commented Mar 25, 2025

Summary

Fixes #7124.

The regression was introduced here: https://github.com/netlify/cli/pull/7112/files#r2005549184. The detected framework config's pollingStrategies property was no longer being threaded through correctly.

This was introduced because the DevConfig type was incorrect and the weak type assertion (and general type weakness in this codebase) allowed it.

This also fixes a few nearby type isues.

The regression was introduced here: https://github.com/netlify/cli/pull/7112/files#r2005549184.

This was introduced because the `DevConfig` type was incorrect and the weak type assertion
(and general type weakness in this codebase) allowed it.

This also fixes a few nearby type isues.
Copy link

📊 Benchmark results

Comparing with 719c17c

  • Dependency count: 1,173 (no change)
  • Package size: 297 MB (no change)
  • Number of ts-expect-error directives: 715 (no change)

@@ -8,23 +8,14 @@ export type BuildConfig = NonNullable<NetlifyTOML['build']>
export type DevConfig = NonNullable<NetlifyTOML['dev']> & {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see here we're extending this type, but we were duplicating most of it here. Most of this diff is cleaning up this unnecessary duplication + adding undefined to optional properties.


jwtSecret: string
jwtRolePath: string
pollingStrategies?: PollingStrategy[]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pollingStrategies: devConfig.pollingStrategies?.map((s) => s.name) ?? [],
pollingStrategies: devConfig.pollingStrategies ?? [],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the regression/fix

Comment on lines -15 to +16
pollingStrategies: { name: string }[]
pollingStrategies: PollingStrategy[]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was correct. I made it reference the canonical type while I was here.

@serhalp serhalp marked this pull request as ready for review March 25, 2025 20:33
@serhalp serhalp requested a review from a team as a code owner March 25, 2025 20:33
@serhalp serhalp enabled auto-merge (squash) March 25, 2025 22:48
@serhalp serhalp merged commit ad197f7 into main Mar 25, 2025
52 checks passed
@serhalp serhalp deleted the fix/7124 branch March 25, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Never ending "Waiting for framework" in 19.0.3
3 participants