Repository navigation
fix(cli): 修复创建页面时配置属性识别 #19561
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
Merged
Single-Dancer
merged 6 commits into
NervJS:main
from
Jarvis636431:fix/cli-config-property-keys
Oct 26, 2026
+328
−9
Merged
fix(cli): 修复创建页面时配置属性识别 #19561
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ce2ca51
fix(cli): handle quoted config keys when creating pages
Jarvis636431 6600101
fix(cli): update the last matching config property
Jarvis636431 0d65b9c
fix(cli): explicitly narrow config object types
Jarvis636431 00a7f4d
fix(cli): reject unresolved config property overrides
Jarvis636431 f71dfca
fix(cli): continue searching past unresolved subpackage roots
Jarvis636431 7d42d01
Merge branch 'main' into fix/cli-config-property-keys
Jarvis636431 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(cli): explicitly narrow config object types
- Loading branch information
commit 0d65b9c9a7c8fa294f615bcfc331d7d13836acc3
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这里的参数类型是
Node | null | undefined,但当前 Babel types 的类型守卫不会把node收窄到ObjectExpression,因此访问node.properties会导致 TypeScript 编译失败(TS18049/TS2339)。建议将参数类型限制为
ObjectExpression | null | undefined,或先通过显式类型守卫得到一个ObjectExpression局部变量后再访问properties。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.
感谢指出,已在 0d65b9c 中改为直接检查
node?.type !== 'ObjectExpression',通过 AST 的 type 字段显式收窄类型,再访问properties,避免依赖这里的 Babel 类型守卫。修改后 CLI 的
tsc构建、ESLint 和 69 个页面配置测试均通过。本机原代码也能通过构建,暂未复现您报告的编译错误,因此补上了明确的类型检查,烦请复查。另外如实补充全量测试结果:226 个通过、7 个跳过、2 个失败。两项失败均位于
doctor-config.spec.ts,预期的 framework 选项包含none,但本机安装的@tarojs/plugin-doctor返回的选项不包含它;已通过直接调用该插件确认这一差异。