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(define-config): param types incorrect #1274

Closed
wants to merge 4 commits into from

Conversation

yimingbot
Copy link

🤔 这个变动的性质是?/ What is the nature of this change?

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

#1216 (reply in thread)

💡 需求背景和解决方案 / Background or solution

从@umijs/preset-umi导入IConfig(umi没有直接导出),然后删除[key: string]: any,避免Omit失效

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English fix defineConfig param types
🇨🇳 Chinese 修复 defineConfig 参数类型失效

@vercel
Copy link

vercel bot commented Nov 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
dumi ✅ Ready (Inspect) Visit Preview Nov 25, 2022 at 8:04AM (UTC)

@yimingbot yimingbot changed the title fix(define-config): 修复参数类型丢失 fix(define-config): param types incorrect Nov 17, 2022
src/types.ts Outdated
type NoStringIndex<T> = {
[K in keyof T as string extends K ? never : K]: T[K];
};
type IUmiConfig = NoStringIndex<Parameters<typeof defineConfig>[0]>;
Copy link
Member

Choose a reason for hiding this comment

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

我本地试了下好像不太行,defineConfig 的参数类型拿出来就是 any 了,不知道是不是类型系统的限制,因为是依赖的依赖

Copy link
Author

Choose a reason for hiding this comment

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

试了下我本地也不行了,之前莫名可以。。
要不还是从preset-umi导入IConfig吧,或者让umi加个导出export type { IConfig } from '@umijs/preset-umi';

Copy link
Author

Choose a reason for hiding this comment

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

先revert了

Copy link
Member

Choose a reason for hiding this comment

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

感谢,我再思考下,想尽可能减少对 umi 子包的依赖

@PeachScript
Copy link
Member

#1389 已用另一个思路修复该问题,感谢提交 PR,希望继续帮助 dumi 改进

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.

None yet

2 participants