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

feat: improve typescript support for config file #465

Merged
merged 2 commits into from
Jan 6, 2022

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Dec 11, 2021

Close: #464

export * from '../dist/node/index'
export * from '../dist/client/index'
export * from '../dist/client/theme-default/config'
Copy link
Member Author

@ulivz ulivz Dec 11, 2021

Choose a reason for hiding this comment

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

Remove this export since it does not exists: https://unpkg.com/browse/[email protected]/dist/client/

@@ -1,146 +1 @@
export namespace DefaultTheme {
Copy link
Member Author

Choose a reason for hiding this comment

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

Move this file to shared types since we need it between server and client.

export function defineConfig(config: RawConfigExports) {
export function defineConfig<T extends ThemeConfig = ThemeConfig>(
config: UserConfig<T>,
usingCustomTheme: true
Copy link
Member Author

Choose a reason for hiding this comment

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

Motivation here: TypeScript cannot overload a function type inferring based on the number of generic type parameters, so I added an additional function parameters here.

@ulivz
Copy link
Member Author

ulivz commented Dec 11, 2021

@yyx990803 Could you help review this pull request?

@yyx990803
Copy link
Member

An extra argument to defineConfig feels too implicit, so I changed to export a separate method defineConfigWithTheme.

@yyx990803 yyx990803 merged commit ba41bb9 into vuejs:main Jan 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Improve TypeScript support for config file.
2 participants