-
Notifications
You must be signed in to change notification settings - Fork 386
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
Conversation
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.
📊 Benchmark resultsComparing with 719c17c
|
@@ -8,23 +8,14 @@ export type BuildConfig = NonNullable<NetlifyTOML['build']> | |||
export type DevConfig = NonNullable<NetlifyTOML['dev']> & { |
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.
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[] |
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.
This is normalized to a string before it gets here: https://github.com/netlify/build/blob/1b9f2f40de7ded6285e9b7c08a1adb43550a0ccf/packages/build-info/src/settings/get-build-settings.ts#L102
pollingStrategies: devConfig.pollingStrategies?.map((s) => s.name) ?? [], | ||
pollingStrategies: devConfig.pollingStrategies ?? [], |
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.
This is the regression/fix
pollingStrategies: { name: string }[] | ||
pollingStrategies: PollingStrategy[] |
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.
This one was correct. I made it reference the canonical type while I was here.
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.