Skip to content

Comments

docs(config): add TS callback literal widening note#21702

Open
Vishnuuuu24 wants to merge 1 commit intovitejs:mainfrom
Vishnuuuu24:docs/async-config-literal-types
Open

docs(config): add TS callback literal widening note#21702
Vishnuuuu24 wants to merge 1 commit intovitejs:mainfrom
Vishnuuuu24:docs/async-config-literal-types

Conversation

@Vishnuuuu24
Copy link

Summary

  • add a docs note for TypeScript users about callback-based defineConfig literal widening
  • document practical workarounds (as const or explicit callback return type) for overload errors in async/sync callback config

Why

Issue #21684 reports that in callback-based config, some nested string literals can be widened by TypeScript and trigger overload errors. This PR documents the existing TypeScript limitation and recommended workaround in the Async Config section.

Changes

  • update docs/config/index.md under Async Config with a short note and guidance

Validation

  • pnpm run docs-build

Refs #21684

Copilot AI review requested due to automatic review settings February 24, 2026 13:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds documentation guidance for TypeScript users encountering literal widening issues in callback-based defineConfig. The change addresses issue #21684 where users experience TypeScript overload errors when setting options like minify: 'terser' in async config callbacks.

Changes:

  • Added a note after the Async Config section explaining TypeScript literal widening in callback-based configs and providing two workarounds (as const or explicit return type annotation)

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.

1 participant