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(types): narrow down the return type of defineConfig #13792

Merged

Commits on Jul 11, 2023

  1. fix(types): narrow down the return type of defineConfig

    Fixes compatibility with `mergeConfig`, as reported in vuejs/create-vue#313
    
    Before the change, `defineConfig` would return `UserConfigExport`, which
    is a union type. This would cause `mergeConfig` to fail, as it doesn't
    accept the `UserConfigFn` type in the union. (vitejs#13135)
    
    After the change, `defineConfig` returns the same type that it receives,
    so it would exclude `UserConfigFn` from the return type whenever
    possible.
    haoqunjiang committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    790cee2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f11b2f View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. fix: revert to overload defineConfig

    Based on vitejs#13792 but with slightly more verbose function style
    configuration types.
    We can make the generic version pass the tests with some hack, but it
    is too permissive that it would allow users to pass in unknown fields.
    The overload version is much more direct and simpler.
    
    Thanks @xiaoxiangmoe for helping me debug this.
    haoqunjiang committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    1f93dec View commit details
    Browse the repository at this point in the history