feat(): presentational-bricks、basic-bricks增加d.ts文件 Closes CI-1142#534
feat(): presentational-bricks、basic-bricks增加d.ts文件 Closes CI-1142#534
Conversation
Walkthrough移除 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches
🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 28
Note
Due to the large number of review comments, Critical severity comments were prioritized as inline comments.
🟠 Major comments (16)
bricks/presentational-bricks/dist-types/brick-collapse-card/index.d.ts-5-5 (1)
5-5:⚠️ Potential issue | 🟠 Major在
.d.ts文件中缺少descriptionsItemProps的导入第 5 行和第 25 行都引用了
descriptionsItemProps类型,但该声明文件未导入此类型。虽然该类型在源文件bricks/presentational-bricks/src/interfaces/brick-collapse-card.ts中已正确定义和导出,但生成的.d.ts文件缺少相应的导入语句,会导致 TypeScript 消费者无法解析此类型。需要在
.d.ts文件顶部添加:import type { descriptionsItemProps } from "...";或在生成声明文件的构建流程中确保类型正确导出。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-collapse-card/index.d.ts` at line 5, The generated declaration is missing an import for the referenced type descriptionsItemProps; add an explicit type-only import for descriptionsItemProps at the top of the generated declaration file (or fix the declaration generation so it emits that import) so the two usages of descriptionsItemProps in the declaration (e.g., the descriptionList?: descriptionsItemProps[] property and any other references) resolve for TypeScript consumers.bricks/presentational-bricks/dist-types/brick-quick-entries/index.d.ts-4-15 (1)
4-15:⚠️ Potential issue | 🟠 Major补充缺失的
MenuIcon类型导入。Line 5 和 Line 11 使用了
MenuIcon,但当前文件缺少相应导入。其他类似文件均从@next-core/brick-types导入此类型。需在文件顶部添加:import type { MenuIcon } from "@next-core/brick-types";缺少此导入会导致消费方出现
Cannot find name 'MenuIcon'的类型错误。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-quick-entries/index.d.ts` around lines 4 - 15, Add the missing type import for MenuIcon used by LinkProps and TitleConfig: import the MenuIcon type from "@next-core/brick-types" at the top of the file so the referenced symbols LinkProps and TitleConfig compile without "Cannot find name 'MenuIcon'" errors.bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts-7-7 (1)
7-7:⚠️ Potential issue | 🟠 Major
MenuIcon类型未导入,会导致消费者端类型解析错误。Line 7 使用了
MenuIcon,但文件中仅在 Line 2 导入了UseBrickConf。需要同时导入MenuIcon来自@next-core/brick-types。修复建议
-import type { UseBrickConf } from "@next-core/brick-types"; +import type { UseBrickConf, MenuIcon } from "@next-core/brick-types";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts` at line 7, The declaration references MenuIcon but it isn't imported; update the type imports so MenuIcon is imported from `@next-core/brick-types` alongside UseBrickConf (i.e. add MenuIcon to the import statement that currently brings in UseBrickConf) so the icon?: MenuIcon type resolves correctly.bricks/presentational-bricks/dist-types/digital-number/index.d.ts-6-7 (1)
6-7:⚠️ Potential issue | 🟠 Major添加
CSSProperties的显式导入以避免类型错误。
CSSProperties在当前文件中被使用(第 6、7、21、22 行),但缺少显式导入。TypeScript 在下游项目消费此类型声明时会报错。建议在文件顶部添加导入:修复建议
+import type { CSSProperties } from "react"; + export type DigitalNumberType = "default" | "custom";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/digital-number/index.d.ts` around lines 6 - 7, The declaration uses the CSSProperties type for cellStyle and textStyle (and other occurrences) but lacks an explicit import; add an explicit import of CSSProperties (e.g. import { CSSProperties } from 'react') at the top of the declaration file so the types resolve when downstream projects consume the types, and update any other places in this file referencing CSSProperties (e.g., the properties named cellStyle and textStyle) to rely on that imported symbol.bricks/presentational-bricks/dist-types/brick-tree/index.d.ts-18-20 (1)
18-20:⚠️ Potential issue | 🟠 Major统一 Key 类型定义,解决 props、callbacks、events 及 element class 中的类型混用问题。
当前代码混用了
React.Key[]和string[]:
- Props 定义(两个同名 BrickTreeProps 接口):第一个使用
React.Key[](18-20行),第二个使用string[](80-82行)- Callbacks(onSelect/onCheck/onExpand):使用
React.Key[](33-59行)- Events(tree.select/tree.check/tree.checkV2):使用
string[](109-131行),但 tree.expand 使用React.Key[](133行)- Element class 属性:使用
string[](147-149行)建议统一标准(全部
string[]或全部React.Key[])并保持整个链路一致。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-tree/index.d.ts` around lines 18 - 20, The code mixes React.Key[] and string[] for tree keys; unify all key-related types to React.Key[]: update the BrickTreeProps interfaces' selectedKeys/checkedKeys/expandedKeys, the callback signatures (onSelect, onCheck, onExpand), the tree event payload types (tree.select, tree.check, tree.checkV2, tree.expand), and the Element class properties (previously string[]) to use React.Key[] consistently; ensure all references and exports in index.d.ts (including the two BrickTreeProps declarations and any event/interface names) are adjusted so the entire type flow uses React.Key[].bricks/presentational-bricks/dist-types/brick-tree/index.d.ts-6-10 (1)
6-10:⚠️ Potential issue | 🟠 Major缺失必需的类型导入,导致发布的 d.ts 文件不可用。
AntTreeNodeProps、MenuIcon、checkedFilterProps在源代码中正确导入,但生成的 d.ts 中缺失,消费者会遇到"Cannot find name"类型错误。需从相应的源文件中添加导入:
AntTreeNodeProps应从"antd/lib/tree"导入MenuIcon应从"@next-core/brick-types"导入checkedFilterProps应从其定义位置导入此外,
BrickTreeProps接口声明重复(行 17-76 和 78-106),导致属性类型冲突。第一个声明中selectedKeys、checkedKeys、expandedKeys为React.Key[],第二个为string[],同时height和virtualScrollHeight字段不一致,需要合并为单一接口定义。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-tree/index.d.ts` around lines 6 - 10, Add the missing type imports to the emitted d.ts: import AntTreeNodeProps from "antd/lib/tree", import MenuIcon from "@next-core/brick-types", and import checkedFilterProps from its original definition file so the compiled declarations don't reference unknown names; then remove the duplicate BrickTreeProps declarations and consolidate them into a single interface (keep the unique name BrickTreeProps) with selectedKeys, checkedKeys, expandedKeys typed as React.Key[] and make height and virtualScrollHeight consistent (pick a single type, e.g., number) so there is only one authoritative set of properties.bricks/presentational-bricks/dist-types/card-item/index.d.ts-21-21 (1)
21-21:⚠️ Potential issue | 🟠 Major在 dist-types 文件中缺少
CardLayoutType的导出第 21 行和第 94 行使用了
CardLayoutType,但该类型未从此文件导出。虽然源文件中已定义为枚举类型,但生成的.d.ts文件缺少该导出语句,会导致编译错误。需要在
bricks/presentational-bricks/dist-types/card-item/index.d.ts中添加以下导出:🔧 修复方案 - 导出 CardLayoutType
import type { MenuIcon } from "@next-core/brick-types"; import type { CardProps } from "antd/lib/card"; +export enum CardLayoutType { + ICON_AS_BACKGROUND = "icon-as-background", + ICON_SMALL_ALIGN_LEFT = "icon-small-align-left", + ICON_ALIGN_RIGHT = "icon-align-right", + ICON_ALIGN_LEFT = "icon-align-left", + ICON_ALIGN_MIDDLE = "icon-align-middle", + BLOCK_ICON_ALIGN_LEFT = "block-icon-align-left", +} + export type Color =🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/card-item/index.d.ts` at line 21, The generated declaration file is missing an export for the enum/type CardLayoutType which is referenced by the CardItem types; add an explicit export for CardLayoutType in the dist-types card-item index.d.ts (declare and export the enum or re-export the existing type from the source) so that CardLayoutType is available to consumers and the references in CardItem (cardLayoutType?: CardLayoutType) resolve correctly.bricks/presentational-bricks/dist-types/brick-list/index.d.ts-1-12 (1)
1-12:⚠️ Potential issue | 🟠 Major缺少
ListItemProps和ListItemMetaProps的导入第 3 行和第 8 行使用了未导入的类型
ListItemProps和ListItemMetaProps,会导致编译错误。虽然源文件bricks/presentational-bricks/src/brick-list/BrickList.tsx正确导入了这些类型,但生成的类型声明文件缺少这些导入。🔧 建议修复
-import type { ListProps } from "antd/lib/list"; +import type { ListProps, ListItemProps, ListItemMetaProps } from "antd/lib/list";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-list/index.d.ts` around lines 1 - 12, The generated .d.ts is missing imports for the types referenced in ItemProps and MetaProps; add the missing type imports (ListItemProps and ListItemMetaProps) from the same module as ListProps so the declarations compile. Update the top of the file to import type { ListProps, ListItemProps, ListItemMetaProps } from "antd/lib/list" (or adjust the declaration generation so these types are emitted) so ItemProps and MetaProps can reference ListItemProps and ListItemMetaProps without errors.bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts-6-6 (1)
6-6:⚠️ Potential issue | 🟠 MajorselectedKeys 属性类型与事件 payload 不一致,需要修正。
selectedKeys 属性当前定义为
string[],但事件general.transfer.change的 payload 使用了Array<DataNode["key"]>。这会导致当 DataNode 的 key 为 number 类型时,产生类型错误。建议统一为Array<DataNode["key"]>以确保类型一致性。涉及行:6、16、25
建议修复方案
export interface TreeTransferProps { dataSource?: any[]; - selectedKeys?: string[]; + selectedKeys?: Array<DataNode["key"]>; @@ export declare class TreeTransferElement extends HTMLElement { dataSource: any[] | undefined; - selectedKeys: string[] | undefined; + selectedKeys: Array<DataNode["key"]> | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts` at line 6, The selectedKeys property is typed as string[] but the event general.transfer.change uses Array<DataNode["key"]>, causing a mismatch when DataNode.key can be a number; update the type of selectedKeys (and any related properties mentioned around the same interface at the other occurrences) from string[] to Array<DataNode["key"]> so it matches the event payload; locate the selectedKeys declaration and any duplicate props in the same declaration (referenced as selectedKeys) and replace their types with Array<DataNode["key"]>.bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts-1-1 (1)
1-1:⚠️ Potential issue | 🟠 Major声明文件中避免 React 默认导入,改用类型导入以提升消费端兼容性。
当前仅使用类型
CSSProperties,在 tsconfig 未明确配置esModuleInterop的项目中,默认导入可能导致消费端因兼容性配置差异出现类型报错。建议改为import type形式。建议修复
-import React from "react"; +import type { CSSProperties } from "react"; import type { DataNode } from "rc-tree-select/lib/interface"; export interface TreeTransferProps { dataSource?: any[]; selectedKeys?: string[]; - listStyle?: React.CSSProperties; + listStyle?: CSSProperties; showSearch?: boolean; titles?: string[]; shownumItem?: boolean; replaceFields?: { key: string; title: string }; defaultExpandAll?: boolean; } export declare class TreeTransferElement extends HTMLElement { dataSource: any[] | undefined; selectedKeys: string[] | undefined; - listStyle: React.CSSProperties | undefined; + listStyle: CSSProperties | undefined;注:此模式同样存在于项目中其他 29 个 .d.ts 文件,建议统一处理。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts` at line 1, Replace the default React runtime import with a type-only import: remove the current default import "import React from 'react'" and instead import the used type(s) using TypeScript's type import syntax (e.g., import type { CSSProperties } from 'react') so the declaration file does not force a value import; apply the same change for other .d.ts files that only reference React types to avoid esModuleInterop-related consumer errors.bricks/presentational-bricks/dist-types/rank-table/index.d.ts-58-58 (1)
58-58:⚠️ Potential issue | 🟠 Major
sort.update事件的order类型应与属性定义对齐为SortOrder属性
order使用SortOrder类型,但事件载荷将其定义为string | number。实际代码发送的是'ascend' | 'descend' | null值,类型定义不准确会导致消费者无法获得正确的类型约束。建议统一为SortOrder。🔧 建议修复
export interface RankTableEvents { "sort.update": CustomEvent<{ sort: string; - order: string | number; + order: SortOrder; }>; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/rank-table/index.d.ts` at line 58, The event payload type for the "sort.update" event must be changed to match the property type: replace the current loose type (string | number or similar) used in the "sort.update" event payload with the defined SortOrder type so consumers get correct typings; locate the type/interface that defines the "sort.update" payload (the event emitter or payload interface where order is typed) and update its order property to use SortOrder (the same symbol used for the component prop) and adjust any related JSDoc/type exports to maintain consistency.bricks/presentational-bricks/dist-types/dropdown-button/index.d.ts-1-1 (1)
1-1:⚠️ Potential issue | 🟠 Major补充类型导入声明,修复
Option类型解析错误。该文件在第 4 行和第 25 行使用
Option类型,但未在当前文件中导入。由于dist-types/interfaces/目录未导出Option接口定义,而@next-core/brick-types包中也不包含此类型,消费者使用此声明文件时会直接遭遇类型错误。此问题同样存在于
dropdown-select组件的类型声明中。建议在类型生成过程中确保本地接口定义被正确导出,或在当前文件中声明Option接口来源。🔧 修复方案
在
src/dropdown-button/index.tsx已正确导入Option的基础上,需要确保生成的.d.ts文件也包含相应导入。可在dist-types/dropdown-button/index.d.ts添加:-import type { MenuIcon } from "@next-core/brick-types"; +import type { MenuIcon } from "@next-core/brick-types"; +import type { Option } from "../interfaces/dropdown-select.js";或调整
tsconfig.types.json,确保src/interfaces/被编译到dist-types/interfaces/。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/dropdown-button/index.d.ts` at line 1, The declaration file is missing the Option type import used by Option references (and currently only imports MenuIcon), causing consumer type errors; fix by adding an explicit type import for Option in the generated declaration (e.g., import type { Option } from "…";) so Option is available to the declarations that reference it, or adjust your type-generation/tsconfig.types.json so src/interfaces (which defines Option) is compiled into dist-types/interfaces and exported; apply the same correction to the dropdown-select component declarations as well.bricks/presentational-bricks/dist-types/brick-calendar/index.d.ts-1-17 (1)
1-17:⚠️ Potential issue | 🟠 Major在类型声明文件中补充
moment类型导入,避免类型解析失败。生成的
.d.ts文件在第 6、12、21、23、26、28、43 行使用moment.Moment,但缺少相应的导入声明。源代码中虽然正确引入了 moment,但类型声明文件的生成过程中未保留该导入,导致消费该类型定义的项目会出现"Cannot find namespace 'moment'"的 TypeScript 错误。建议修复
import type { CalendarMode } from "antd/lib/calendar/generateCalendar"; import type { UseBrickConf } from "@next-core/brick-types"; +import type * as moment from "moment"; export interface PanelEvent {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-calendar/index.d.ts` around lines 1 - 17, The generated declaration is missing the moment type import causing "Cannot find namespace 'moment'"; add a type import for Moment and update the declarations to use it (e.g. add "import type { Moment } from 'moment';" in the .d.ts or adjust the generator to emit that import) and replace usages of moment.Moment in the PanelEvent and BrickCalendarProps types with Moment (references: PanelEvent.date, BrickCalendarProps.value, and any other occurrences of moment.Moment such as in dateCell/monthCell typings).bricks/basic-bricks/dist-types/general-notification/index.d.ts-22-22 (1)
22-22:⚠️ Potential issue | 🟠 Major在 .d.ts 中补充
CSSProperties显式导入,确保类型解析正确。
CSSProperties在第 22 行和第 44 行被使用但未显式导入,会导致类型解析风险。请添加以下导入:修复方案
+import type { CSSProperties } from "react"; import type { NotificationPlacement } from "antd/lib/notification"; import type { NotificationApi } from "antd/es/notification"; import type { MenuIcon } from "@next-core/brick-types";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-notification/index.d.ts` at line 22, 声明文件中使用了 CSSProperties(例如在 iconStyle 和 style 等属性上)但未显式导入,导致类型解析风险;请在该声明文件顶部添加对 CSSProperties 的显式导入(从 react 导入 CSSProperties),以确保类型可解析,并更新任何使用 CSSProperties 的类型位置(如 iconStyle 和 其它 style 属性)以引用该导入的符号。bricks/presentational-bricks/dist-types/general-slider/index.d.ts-8-8 (1)
8-8:⚠️ Potential issue | 🟠 Major
.d.ts文件缺少SliderMarks的导入声明文件
bricks/presentational-bricks/dist-types/general-slider/index.d.ts在第 8 和 49 行使用了SliderMarks类型,但未导入。需要添加导入语句:import { SliderMarks } from "antd/lib/slider";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/general-slider/index.d.ts` at line 8, The declaration file is using the SliderMarks type but not importing it; add an import for SliderMarks from antd (e.g., import { SliderMarks } from "antd/lib/slider") at the top of the declaration so the references to SliderMarks (used in the optional property marks?: SliderMarks and any other occurrences) are resolved; update the module/type declarations in general-slider (types that reference SliderMarks) to rely on that imported type.bricks/presentational-bricks/dist-types/brick-table/index.d.ts-124-124 (1)
124-124:⚠️ Potential issue | 🟠 Major
filter.update事件与column.filters.update事件的类型不一致
filters属性和column.filters.update事件都使用Record<string, string[]>来表示表头列过滤,但filter.update事件定义为Record<string, number>。虽然filter.update实际发出的是分页相关数据(page/pageSize),但这种命名容易导致混淆——消费者可能期望onFilterUpdate回调传入与filters属性相同的数据结构。建议:
- 明确区分两个事件的用途:
filter.update用于分页更新,column.filters.update用于列过滤- 如果
filter.update确实是分页事件,考虑将其重命名为pagination.update以避免歧义,或更新文档说明其真实用途🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-table/index.d.ts` at line 124, The types for the table filter events are inconsistent: the props field filters and the column.filters.update event use Record<string, string[]> for column filters, while the filter.update event is typed as Record<string, number> but actually carries pagination (page/pageSize). Update the API to avoid confusion by either renaming the event filter.update to pagination.update (and update all occurrences: event emitter, handler names like onFilterUpdate → onPaginationUpdate) to reflect it carries pagination numbers, or change the type of filter.update to a dedicated Pagination type (e.g., { page: number; pageSize: number }) and update any handler signatures and docs; ensure column.filters.update and the filters prop remain typed as Record<string, string[]> so consumers can distinguish column filtering from pagination.
🟡 Minor comments (10)
bricks/presentational-bricks/dist-types/brick-collapse-card/index.d.ts-18-18 (1)
18-18:⚠️ Potential issue | 🟡 Minor
title属性可选性定义不一致在
BrickCollapseCardProps中title定义为可选(title?: string),但在BrickCollapseCardElement中定义为必需(title: string)。这与其他属性的处理模式不符——其他可选属性在 Element 中均定义为Type | undefined的形式(如cardTitle: string | undefined)。建议修改 Element 中的title定义为title: string | undefined以保持一致性。建议修复
export declare class BrickCollapseCardElement extends HTMLElement { ... - title: string; + title: string | undefined; ... }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-collapse-card/index.d.ts` at line 18, The `title` optionality is inconsistent: `BrickCollapseCardProps` declares `title?: string` but `BrickCollapseCardElement` declares `title: string`; update `BrickCollapseCardElement` so its `title` type matches the optional pattern used elsewhere by changing it to `title: string | undefined`. Locate the `BrickCollapseCardElement` interface/type in the declaration file and replace the current `title: string` with `title: string | undefined` to align with `BrickCollapseCardProps` and other element property typings.bricks/presentational-bricks/dist-types/brick-tree/index.d.ts-75-75 (1)
75-75:⚠️ Potential issue | 🟡 Minor
height与virtualScrollHeight命名并存,容易误导使用方。当前类型同时暴露两个高度字段名,但
BrickTreeElement只声明了virtualScrollHeight。建议保留一个主字段,另一个若需兼容请显式标注 deprecated/alias。Also applies to: 105-105, 172-172
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-tree/index.d.ts` at line 75, The types expose two conflicting height props—height and virtualScrollHeight—while BrickTreeElement only declares virtualScrollHeight; consolidate to a single canonical property (prefer virtualScrollHeight on BrickTreeElement) and make the other an explicit deprecated alias: add a deprecated JSDoc/@deprecated annotation for height (or virtualScrollHeight if you prefer the other name) and re-export it as an alias that maps to the canonical property in the type declarations for the places referencing height (including the signatures around the existing occurrences), updating any exported interfaces/types so consumers see only the canonical field plus a documented deprecated alias.bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts-1-2 (1)
1-2:⚠️ Potential issue | 🟡 Minor改为从公开 API 导入,而非深层导入 antd 内部路径。
当前对 antd 内部目录结构有耦合,这在 antd 升级时更容易失效。建议在源文件
bricks/presentational-bricks/src/datetime-selector/index.tsx和DatetimeSelector.tsx中改为从公开入口导入ButtonProps,通过ButtonProps["size"]获取 size 类型(即SizeType)。此变更会自动更新生成的声明文件。注:该模式在整个项目中广泛存在(已检查 100+ 处),如无法一次全部修复,建议至少在此处应用。
♻️ 源文件修改建议
修改
src/datetime-selector/index.tsx和src/datetime-selector/DatetimeSelector.tsx:-import { ButtonSize } from "antd/lib/button"; +import type { ButtonProps } from "antd"; @@ - size?: ButtonSize; + size?: ButtonProps["size"]; @@ - size: ButtonSize | undefined; + size: ButtonProps["size"] | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts` around lines 1 - 2, 在源文件 bricks/presentational-bricks/src/datetime-selector/index.tsx 和 DatetimeSelector.tsx 中将深层导入 import type { ButtonSize } from "antd/lib/button" 替换为从公开入口导入 ButtonProps(例如 import type { ButtonProps } from "antd"),并把使用的 size 类型改为 ButtonProps["size"](等同于 SizeType);更新所有引用 ButtonSize 的类型位置(例如在 DatetimeSelector 组件的 props 或本模块导出的类型)以使用 ButtonProps["size"],保存后重新生成声明文件以让 dist-types/index.d.ts 自动反映更改。bricks/presentational-bricks/dist-types/agent-status/index.d.ts-4-10 (1)
4-10:⚠️ Potential issue | 🟡 Minor需要在 .d.ts 文件中导出
AgentStatusType枚举。文件中多处引用了
AgentStatusType(第 4 行和第 10 行),但该文件未导出此类型。源文件bricks/presentational-bricks/src/agent-status/index.tsx已导出AgentStatusType枚举,生成的 .d.ts 文件应包含该导出声明,否则使用此模块的代码无法访问该类型。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/agent-status/index.d.ts` around lines 4 - 10, 在生成的声明文件中缺少对 AgentStatusType 枚举的导出,导致 AgentStatusElement 中引用的类型不可用;在 dist-types 的声明(index.d.ts)中添加与源文件 bricks/presentational-bricks/src/agent-status/index.tsx 中相同的导出声明,例如补充一个 export declare enum AgentStatusType { ... }(枚举成员与源文件保持一致),确保 AgentStatusType 在文件顶层被导出以供外部代码和 AgentStatusElement 的 value/类型引用使用。bricks/basic-bricks/dist-types/delete-confirm-modal/index.d.ts-11-11 (1)
11-11:⚠️ Potential issue | 🟡 Minor
title属性类型不一致。接口中
title为可选属性 (title?: string),但元素类中定义为必需属性 (title: string)。应保持一致。🐛 建议修复
export declare class DeleteConfirmModalElement extends HTMLElement { eventName: string | undefined; message: string | undefined; - title: string; + title: string | undefined; data: any | undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/delete-confirm-modal/index.d.ts` at line 11, The declaration shows a mismatch for the title property: the interface marks title as optional (title?: string) but the element class declares it as required (title: string); update the element class declaration for the DeleteConfirmModal component (the class/element that currently has title: string) to make the property optional (title?: string) so it matches the interface, or alternatively make the interface title required—pick one consistent change and apply it to the symbol "title" in both the interface and the element/class declarations.bricks/basic-bricks/dist-types/index-card/index.d.ts-1-8 (1)
1-8:⚠️ Potential issue | 🟡 Minor
title可空性声明不一致,应与接口契约对齐。
IndexCardElementProps接口定义title为可选(title?: string),但IndexCardElement在 .d.ts 中声明为必填(title: string),造成属性类型与接口约定不符。这会误导消费侧类型检查。建议在属性声明中允许undefined,使其与接口保持一致。建议修改
export declare class IndexCardElement extends HTMLElement { contentGridGap: number | undefined; - title: string; + title: string | undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/index-card/index.d.ts` around lines 1 - 8, The declaration for IndexCardElement mismatches the IndexCardProps interface: IndexCardProps defines title as optional but IndexCardElement declares title as required; update the IndexCardElement type so its title property allows undefined (e.g., title: string | undefined) to match IndexCardProps, and verify other properties like contentGridGap remain consistent with IndexCardProps.bricks/presentational-bricks/dist-types/collapsible-card-item/index.d.ts-8-8 (1)
8-8:⚠️ Potential issue | 🟡 Minor
CSSProperties类型未导入或缺少命名空间前缀第 8 行和第 38 行使用了
CSSProperties,但该类型未单独导入,也没有使用React.CSSProperties前缀。而第 23 行和第 55 行正确使用了React.CSSProperties。这会导致 TypeScript 编译错误。🔧 建议修复
- cardStyle?: CSSProperties; + cardStyle?: React.CSSProperties;- cardStyle: CSSProperties | undefined; + cardStyle: React.CSSProperties | undefined;Also applies to: 38-38
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/collapsible-card-item/index.d.ts` at line 8, 在声明文件中裸用 CSSProperties 导致编译错误:把未导入的 CSSProperties 替换为带命名空间的 React.CSSProperties(或在文件顶部显式导入 { CSSProperties } from 'react');具体定位到使用该类型的属性(例如 cardStyle 和 另一个在第 38 行使用 CSSProperties 的属性)并统一为 React.CSSProperties 或确保已从 'react' 导入 CSSProperties,以与文件中其它位置(第 23 行和第 55 行)保持一致。bricks/basic-bricks/dist-types/popover-container/index.d.ts-82-82 (1)
82-82:⚠️ Potential issue | 🟡 Minor
getPopupContainer属性的类型签名存在歧义当前写法
(triggerNode: HTMLElement) => HTMLElement | undefined会被解析为函数返回HTMLElement | undefined,而非属性本身可能为undefined。根据 Props 接口(第 32 行)和类中其他属性的模式,应明确属性可为undefined。🔧 建议修复
- getPopupContainer: (triggerNode: HTMLElement) => HTMLElement | undefined; + getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/popover-container/index.d.ts` at line 82, The getPopupContainer property is currently typed as a function returning HTMLElement | undefined, which is ambiguous; change its declaration so the property itself can be undefined by making its type a union with undefined (i.e., getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined) to match the Props pattern used elsewhere; update the exported declaration for getPopupContainer in the popover-container d.ts to reflect this union so consumers know the prop may be absent.bricks/presentational-bricks/dist-types/log-display/index.d.ts-1-7 (1)
1-7:⚠️ Potential issue | 🟡 Minor改用 type-only 导入和直接引用 React 类型。
.d.ts中应使用import type语法而非默认导入。当前代码在第1行使用import React from "react",然后通过React.CSSProperties引用类型,这在消费端可能产生兼容性问题。建议改为 type-only 导入并直接引用CSSProperties。建议修改
-import React from "react"; +import type { CSSProperties } from "react"; export interface LogDisplayProps { value?: string; loadingIcon?: boolean; hasBackspace?: boolean; - containerStyle?: React.CSSProperties; + containerStyle?: CSSProperties; } export declare class LogDisplayElement extends HTMLElement { value: string | undefined; loadingIcon: boolean | undefined; hasBackspace: boolean | undefined; - containerStyle: React.CSSProperties | undefined; + containerStyle: CSSProperties | undefined; }注:仓库中有29个
.d.ts文件存在同类问题,建议统一修复。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/log-display/index.d.ts` around lines 1 - 7, The d.ts uses a default React import and references React.CSSProperties which can cause consumption issues; change the top import to a type-only import (import type { CSSProperties } from "react") and update the LogDisplayProps definition so containerStyle?: CSSProperties; (i.e., remove the default import and stop using React.CSSProperties) — adjust the import and the LogDisplayProps interface accordingly (symbols: import React, LogDisplayProps, React.CSSProperties).bricks/presentational-bricks/dist-types/brick-general-search/index.d.ts-20-23 (1)
20-23:⚠️ Potential issue | 🟡 Minor类型定义与实现代码的拼写错误一致,不存在类型检查问题,但拼写错误确实需要修复
经验证,
bricks/presentational-bricks/src/brick-general-search/中的实现代码(index.tsx、BrickGeneralSearch.tsx)也使用了相同的拼写错误:
- Line 230 of index.tsx:
searchBoxStyleType: "defalut" | "round" = "defalut";- Line 150 of BrickGeneralSearch.tsx:
props.searchBoxStyleType === "defalut"- Line 316 of index.tsx:
this.alwaysFoucus && this.inputRef.focus();因此,当前 d.ts 与运行时实现是一致的,不存在类型错误的风险。然而,这些拼写错误("defalut" 应为 "default","alwaysFoucus" 应为 "alwaysFocus")仍然是代码质量问题,应该修复以遵循标准英文拼写。建议采用向后兼容的修复方案,同时更新实现代码和类型定义。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-general-search/index.d.ts` around lines 20 - 23, The exported prop names and values contain spelling mistakes ("defalut" and "alwaysFoucus") that are implemented in BrickGeneralSearch (props.searchBoxStyleType, searchBoxStyleType default, and this.alwaysFoucus with inputRef.focus) and in the d.ts; update the implementation and the type defs to the correct spellings ("default" and "alwaysFocus") and change the default value to "default", but keep backward compatibility by accepting the old misspellings (e.g., treat "defalut" as "default" and map props.alwaysFoucus to props.alwaysFocus) and add a console.warn or deprecation comment when the old keys are used; ensure index.tsx, BrickGeneralSearch.tsx and the .d.ts are all updated consistently and remove the temporary mappings in a future major release.
🧹 Nitpick comments (17)
bricks/presentational-bricks/dist-types/general-pagination/index.d.ts (1)
10-10: 考虑为fields提供更具体的类型。使用
any类型会削弱类型声明文件的价值。如果fields的结构已知,建议定义具体的接口类型;如果结构确实不确定,可以考虑使用unknown或Record<string, unknown>以保留类型检查能力。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/general-pagination/index.d.ts` at line 10, The property "fields" in the exported type/interface (symbol: fields) currently uses any; replace it with a more specific type to preserve type-safety—either define and reference a concrete interface describing the known shape of fields, or if shape is truly unknown use unknown or Record<string, unknown> instead; update the declaration for fields accordingly in the exported type/interface to reflect the chosen type.bricks/presentational-bricks/dist-types/statistic-card/index.d.ts (1)
12-19: 建议提取fields类型以消除重复定义。
fields对象类型在StatisticCardProps和StatisticCardElement中定义了两次,违反了 DRY 原则。提取为独立类型可提高可维护性。♻️ 建议的重构方案
import type { MenuIcon } from "@next-core/brick-types"; +export interface StatisticCardFields { + icon?: string; + disabled?: string; + tip?: string; + url?: string; + cardTitle?: string; + value?: string; +} + export interface StatisticCardProps { cardTitle?: string; value?: string | number; icon?: MenuIcon | string; url?: string; tip?: string; disabled?: boolean; showCard?: boolean; dataSource?: Record<string, any>; - fields?: { - icon?: string; - disabled?: string; - tip?: string; - url?: string; - cardTitle?: string; - value?: string; - }; + fields?: StatisticCardFields; urlTemplate?: string; iconType?: string; } export declare class StatisticCardElement extends HTMLElement { cardTitle: string | undefined; value: string | number | undefined; icon: MenuIcon | string | undefined; url: string | undefined; tip: string | undefined; disabled: boolean | undefined; showCard: boolean | undefined; dataSource: Record<string, any> | undefined; - fields: - | { - icon?: string; - disabled?: string; - tip?: string; - url?: string; - cardTitle?: string; - value?: string; - } - | undefined; + fields: StatisticCardFields | undefined; urlTemplate: string | undefined; iconType: string | undefined; }Also applies to: 33-42
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/statistic-card/index.d.ts` around lines 12 - 19, Extract the repeated inline object type for fields into a single named type (e.g., StatisticCardFields) and use that type in both StatisticCardProps and StatisticCardElement to remove duplication; update the declarations that currently declare fields?: { icon?: string; disabled?: string; tip?: string; url?: string; cardTitle?: string; value?: string; } so they reference the new StatisticCardFields type instead.bricks/presentational-bricks/dist-types/collapse-info-list/index.d.ts (2)
9-13: 可选:抽取重复的useBrick内联类型以降低维护成本。
titleBrick/extraBrick(以及下方元素类)都在重复同一结构,建议提取别名避免后续改动遗漏。建议修改
import type { UseBrickConf } from "@next-core/brick-types"; +type BrickRenderConf = { useBrick: UseBrickConf }; + export interface CollapseInfoListProps { dataSource?: InfoDetail[]; - titleBrick?: { useBrick: UseBrickConf }; - extraBrick?: { useBrick: UseBrickConf }; + titleBrick?: BrickRenderConf; + extraBrick?: BrickRenderConf; } @@ export declare class CollapseInfoListElement extends HTMLElement { dataSource: InfoDetail[] | undefined; - titleBrick: { useBrick: UseBrickConf } | undefined; - extraBrick: { useBrick: UseBrickConf } | undefined; + titleBrick: BrickRenderConf | undefined; + extraBrick: BrickRenderConf | undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/collapse-info-list/index.d.ts` around lines 9 - 13, Extract the repeated inline type { useBrick: UseBrickConf } into a named alias and use it for all props that share that shape (e.g., replace the inline types on CollapseInfoListProps.titleBrick and .extraBrick and any other elements that repeat the structure); update the interface to reference the new alias (name it something like BrickUseConf or UseBrickProp) and ensure any other exported types in this file that currently repeat { useBrick: UseBrickConf } are updated to use the new alias so future changes only need to be made in one place.
23-27: 建议补充自定义标签到HTMLElementTagNameMap以增强 TS 推断体验。这样
document.createElement("collapse-info-list")等场景可直接推断为CollapseInfoListElement。建议补充
export declare class CollapseInfoListElement extends HTMLElement { dataSource: InfoDetail[] | undefined; titleBrick: BrickRenderConf | undefined; extraBrick: BrickRenderConf | undefined; } + +declare global { + interface HTMLElementTagNameMap { + "collapse-info-list": CollapseInfoListElement; + } +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/collapse-info-list/index.d.ts` around lines 23 - 27, The declaration file should add a mapping from the custom element tag to the class so TS can infer types for DOM APIs; update the ambient/global declarations to extend/interface HTMLElementTagNameMap with "collapse-info-list": CollapseInfoListElement (so document.createElement("collapse-info-list") and querySelector calls are typed), making the change in the same d.ts near the CollapseInfoListElement declaration and ensuring the global interface name is HTMLElementTagNameMap.bricks/presentational-bricks/dist-types/qrcode-download/index.d.ts (1)
17-24: 建议让类实现QrcodeDownloadProps接口,减少重复声明带来的类型漂移风险。Lines 17-24 与
QrcodeDownloadProps重复维护同一组属性。当前代码库中所有 Element 类都采用独立声明方式,但若能在类声明中implements QrcodeDownloadProps,可以通过编译时检查确保接口和类的属性保持同步,从而降低后续维护中因属性增减而遗漏的风险。♻️ 建议修改
-export declare class QrcodeDownloadElement extends HTMLElement { - width: number | undefined; - downloadMaxNum: number | undefined; - colorDark: string | undefined; - colorLight: string | undefined; - domain: string | undefined; - isEnablePack: boolean | undefined; +export declare class QrcodeDownloadElement extends HTMLElement implements QrcodeDownloadProps { + width?: number; + downloadMaxNum?: number; + colorDark?: string; + colorLight?: string; + domain?: string; + isEnablePack?: boolean; downloadFile(data: QrCodeItem[], name?: string): void; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/qrcode-download/index.d.ts` around lines 17 - 24, The QrcodeDownloadElement class duplicates properties already defined in QrcodeDownloadProps; modify the class declaration to implement QrcodeDownloadProps (i.e., declare "class QrcodeDownloadElement implements QrcodeDownloadProps") and remove or align redundant property typings (width, downloadMaxNum, colorDark, colorLight, domain, isEnablePack, and downloadFile) so the class relies on the shared interface for shape and compilation will catch drift; ensure the downloadFile signature matches the interface's signature.bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts (1)
1-1: 在声明文件中使用类型专用导入以减少消费者编译耦合。Line 1 的
import React from "react"仅用于引用CSSProperties类型(在第 32 行和第 47 行使用)。建议改为import type { CSSProperties } from "react",并将所有React.CSSProperties替换为CSSProperties,避免对消费者的esModuleInterop/allowSyntheticDefaultImports形成隐式要求。建议改法
-import React from "react"; +import type { CSSProperties } from "react"; @@ - listStyle?: React.CSSProperties; + listStyle?: CSSProperties; @@ - listStyle: React.CSSProperties | undefined; + listStyle: CSSProperties | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts` at line 1, The d.ts currently imports the entire React default ("import React from 'react'") only to reference CSSProperties; change this to a type-only import and replace usages: import type { CSSProperties } from "react" and update all React.CSSProperties occurrences to plain CSSProperties (e.g., in the props/interfaces referenced at lines where React.CSSProperties appears) so the declaration file uses type-only imports and avoids imposing esModuleInterop/allowSyntheticDefaultImports requirements on consumers.bricks/presentational-bricks/dist-types/digital-number/index.d.ts (1)
18-31: 统一DigitalNumberElement属性声明为可选属性符号,与DigitalNumberProps保持一致。
DigitalNumberProps使用?表示可选属性,而DigitalNumberElement使用| undefined。两者语义相同但表达形式不统一,建议统一采用?的写法以降低心智负担。建议重构
export declare class DigitalNumberElement extends HTMLElement { - decimals: number | undefined; - decimal: string | undefined; - cellStyle: CSSProperties | undefined; - textStyle: CSSProperties | undefined; - easeSpeed: number | undefined; - delaySpeed: number | undefined; - maxLen: number | undefined; - value: number | undefined; - type: DigitalNumberType | undefined; - height: number | undefined; - width: number | undefined; - thousands: boolean | undefined; + decimals?: number; + decimal?: string; + cellStyle?: CSSProperties; + textStyle?: CSSProperties; + easeSpeed?: number; + delaySpeed?: number; + maxLen?: number; + value?: number; + type?: DigitalNumberType; + height?: number; + width?: number; + thousands?: boolean; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/digital-number/index.d.ts` around lines 18 - 31, The DigitalNumberElement declaration uses "| undefined" for many properties while DigitalNumberProps uses the "?" optional property syntax; update DigitalNumberElement to use the same optional-property syntax (e.g., replace "decimals: number | undefined;" with "decimals?: number;") for all listed properties (decimals, decimal, cellStyle, textStyle, easeSpeed, delaySpeed, maxLen, value, type, height, width, thousands) so the typings are consistent with DigitalNumberProps and reduce mental friction when locating the class DigitalNumberElement in the declaration file.bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts (2)
40-42:datetime.selected.v3建议改成“可判别联合”以提升消费端类型收窄体验。现在两个分支只能靠字段形态推断,建议加判别字段(例如
mode),可读性和类型提示会更稳定。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts` around lines 40 - 42, The current "datetime.selected.v3" CustomEvent payload is a union of { from: number; to: number } | { from: string } which relies on structural narrowing; change it to a discriminated union by adding a discriminator property (e.g., mode: "range" | "single") so consumers can reliably narrow types. Update the declaration for "datetime.selected.v3" in index.d.ts to use { mode: "range"; from: number; to: number } | { mode: "single"; from: string } and ensure any code that dispatches this CustomEvent (event emitters) sets the matching mode value when creating the payload so runtime shape matches the new types.
51-63: 建议让DatetimeSelectorElement显式implements DatetimeSelectorProps,降低声明漂移风险。当前 class 与 props 重复定义字段,后续改动时容易漏改其一。可通过
implements增加约束。♻️ 建议修改
-export declare class DatetimeSelectorElement extends HTMLElement { +export declare class DatetimeSelectorElement + extends HTMLElement + implements DatetimeSelectorProps +{🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts` around lines 51 - 63, Update the class declaration so DatetimeSelectorElement explicitly implements DatetimeSelectorProps (i.e., change the declaration of DatetimeSelectorElement to "implements DatetimeSelectorProps") to prevent drift; then reconcile the class property list with the DatetimeSelectorProps interface by removing any duplicate property declarations or ensuring their types exactly match the interface (use the class name DatetimeSelectorElement and the interface name DatetimeSelectorProps to locate and fix the declaration and duplicated fields).bricks/basic-bricks/dist-types/general-popup/index.d.ts (2)
1-1: 库的类型定义中应避免默认导入,改为类型导入以提高兼容性。第 1 行的
import React from "react";在库的声明文件中应改为类型命名导入。虽然当前仓库已启用esModuleInterop,但库类型定义应遵循最佳实践,使用类型导入import type { CSSProperties } from "react"避免对下游消费者的配置约束。建议修改
-import React from "react"; +import type { CSSProperties } from "react"; @@ - popupWidth?: React.CSSProperties["width"]; - popupHeight?: React.CSSProperties["height"]; + popupWidth?: CSSProperties["width"]; + popupHeight?: CSSProperties["height"]; @@ - popupWidth: React.CSSProperties["width"] | undefined; - popupHeight: React.CSSProperties["height"] | undefined; + popupWidth: CSSProperties["width"] | undefined; + popupHeight: CSSProperties["height"] | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-popup/index.d.ts` at line 1, Replace the default React import in the declaration file with type-only imports to avoid imposing esModuleInterop on consumers: remove `import React from "react"` and instead add `import type { ... } from "react"` for the specific types used (e.g., CSSProperties, ReactNode, ReactElement, FC, etc.), then update any type references that relied on the default React import to use those imported type names (or JSX.Element) so no runtime import is emitted from the .d.ts.
18-19: 收敛样式属性类型以提升类型安全性在 GeneralPopupProps 接口和 GeneralPopupElement 类中,dragHeaderStyle 和 dragWrapperStyle 两个属性均使用
Record<string, any>类型。由于这些属性直接用作 React 内联样式(第 205 和 211 行),建议改为React.CSSProperties以获得正确的类型检查和 IDE 智能提示。建议修改
import React from "react"; +import type { CSSProperties } from "react"; export interface GeneralPopupProps { // ... - dragHeaderStyle?: Record<string, any>; - dragWrapperStyle?: Record<string, any>; + dragHeaderStyle?: CSSProperties; + dragWrapperStyle?: CSSProperties; } export declare class GeneralPopupElement extends HTMLElement { // ... - dragHeaderStyle: Record<string, any> | undefined; - dragWrapperStyle: Record<string, any> | undefined; + dragHeaderStyle: CSSProperties | undefined; + dragWrapperStyle: CSSProperties | undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-popup/index.d.ts` around lines 18 - 19, Update the two style prop types from Record<string, any> to React.CSSProperties: change dragHeaderStyle and dragWrapperStyle in the GeneralPopupProps interface and the corresponding properties in the GeneralPopupElement class so they use React.CSSProperties (or import { CSSProperties } from 'react' and use that) because these values are passed as React inline styles; ensure the React type is available in the declaration file and update any related JSDoc/comments to reflect the stronger typing.bricks/presentational-bricks/dist-types/brick-button/index.d.ts (1)
1-1: 建议改用 antd 顶层导出替换深路径导入。该文件源码位置
bricks/presentational-bricks/src/brick-button/index.tsx第 5 行使用antd/lib/button深路径导入ButtonProps。在项目使用的 antd 4.12.3 版本中,虽然深路径导入仍可用,但项目内更推荐使用顶层导出:统计显示顶层导入(from "antd")使用频率为 396 次,而深路径导入仅 134 次。改为顶层导入可提高代码一致性,减少版本升级时的适配风险。♻️ 推荐调整
-import { ButtonProps } from "antd/lib/button"; +import type { ButtonProps } from "antd";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/brick-button/index.d.ts` at line 1, Replace the deep import of ButtonProps from "antd/lib/button" with the top-level antd export: locate the import of ButtonProps (symbol ButtonProps) and change its module specifier to "antd" so the declaration uses import type { ButtonProps } from "antd"; ensure any other type-only imports follow the same top-level pattern for consistency.bricks/presentational-bricks/dist-types/card-item/index.d.ts (1)
64-64: 代码注释使用了中文第 64 行和第 140 行的
//增加下逻辑注释应考虑使用英文以保持代码库一致性,或者如果这是临时注释,应当移除。Also applies to: 140-140
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/card-item/index.d.ts` at line 64, The inline comments "//增加下逻辑" on the isNotEqual?: boolean declaration (and the similar comment at the other occurrence) are in Chinese; replace them with an English comment or remove them if they are temporary. Locate the isNotEqual property in the type declaration (index.d.ts) and either translate the comment to something like "// add logic here" or delete the comment so the file remains consistent with the repository's English comment style.bricks/presentational-bricks/dist-types/general-carousel/index.d.ts (2)
39-39:carouselStyle类型不一致。
GeneralCarouselPropsInterface.carouselStyle使用Record<string, any>,但GeneralCarouselProps.carouselStyle在第 8 行使用React.CSSProperties。建议保持类型一致,使用React.CSSProperties以获得更好的类型检查。♻️ 建议统一类型
export interface GeneralCarouselPropsInterface { useBrick?: GeneralCarouselProps["useBrick"]; autoplay?: boolean; dots?: boolean; arrows?: boolean; dataSource?: GeneralCarouselProps["dataSource"]; - carouselStyle?: Record<string, any>; + carouselStyle?: React.CSSProperties;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/general-carousel/index.d.ts` at line 39, GeneralCarouselPropsInterface.carouselStyle 的类型与 GeneralCarouselProps.carouselStyle 不一致:当前接口使用 Record<string, any> 而实现使用 React.CSSProperties;将 GeneralCarouselPropsInterface 中的 carouselStyle 类型改为 React.CSSProperties(或确保引用 React 的类型别名)以统一类型签名并恢复严格的样式类型检查,调整任何相关导入或类型引用以匹配 React.CSSProperties。
69-69: 同样的类型不一致问题。
GeneralCarouselElement.carouselStyle也应使用React.CSSProperties以保持与GeneralCarouselProps的一致性。♻️ 建议修复
- carouselStyle: Record<string, any> | undefined; + carouselStyle: React.CSSProperties | undefined;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/general-carousel/index.d.ts` at line 69, Change the type of GeneralCarouselElement.carouselStyle from Record<string, any> to React.CSSProperties so it matches GeneralCarouselProps; locate the declaration of GeneralCarouselElement.carouselStyle in the general-carousel index.d.ts and replace the current Record<string, any> type with React.CSSProperties, ensuring React is imported or referenced appropriately in the d.ts if needed.bricks/presentational-bricks/dist-types/basic-progress/index.d.ts (1)
22-23: 建议确认doderblue是否为拼写笔误。Line 22 的
doderblue很像dodgerblue。若已对外发布,建议新增正确别名并保留旧值以兼容;若未发布,建议直接更正。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/basic-progress/index.d.ts` around lines 22 - 23, The enum value `doderblue` appears to be a typo of `dodgerblue`; locate the enum or type that declares `doderblue` (the exported color constants in basic-progress, e.g., the enum/union containing "doderblue" and "royalblue") and either rename it to the correct `dodgerblue` if this package has not been published, or introduce the correct `dodgerblue` value while keeping `doderblue` as a deprecated alias (map both to the same runtime value and mark `doderblue` as deprecated in the typings/comments) to preserve backwards compatibility.bricks/basic-bricks/dist-types/flex-layout/index.d.ts (1)
1-8: 可考虑使用更精确的 CSS 类型(可选优化)对于
flexDirection、justifyContent等 CSS 属性,可以考虑使用联合类型或React.CSSProperties中的类型以获得更好的类型安全性,例如:flexDirection?: "row" | "row-reverse" | "column" | "column-reverse";当前使用
string类型也是可接受的,提供了更大的灵活性。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/flex-layout/index.d.ts` around lines 1 - 8, Update FlexLayoutProps to use more specific CSS types instead of generic string for properties like flexDirection, justifyContent, alignItems, alignContent, flexWrap and gap; locate the FlexLayoutProps interface and replace those string types with either explicit unions (e.g. accepted values for flexDirection, flexWrap, justifyContent, alignItems, alignContent) or reference types from React.CSSProperties (e.g. React.CSSProperties['flexDirection'], etc.) to improve type safety while keeping compatibility.
| export interface AdvanceListContainerProps { | ||
| data: { | ||
| list: Record<string, any>[]; | ||
| page_size?: number | string; | ||
| page?: number | string; | ||
| }; | ||
| titleBrick: { useBrick: UseBrickConf }; | ||
| suffixBrick?: { useBrick: UseBrickConf }; | ||
| itemClick?: () => void; | ||
| selectable?: boolean; | ||
| defaultActiveIndex?: number; | ||
| } | ||
|
|
||
| export interface AdvanceListContainerProps { | ||
| data?: AdvanceListContainerProps["data"]; | ||
| titleBrick?: AdvanceListContainerProps["titleBrick"]; | ||
| suffixBrick?: AdvanceListContainerProps["suffixBrick"]; | ||
| showCard?: boolean; | ||
| defaultActiveIndex?: number; | ||
| notTriggerClickEventWhenInit?: boolean; | ||
| selectable?: boolean; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat bricks/basic-bricks/dist-types/advance-list-container/index.d.tsRepository: easyops-cn/next-basics
Length of output: 1341
同名接口重复声明,字段可选性冲突,导致类型合并错误。
AdvanceListContainerProps 被声明了两次,且字段定义不一致(data、titleBrick 分别在两处声明时可选性冲突)。TypeScript 接口合并会导致编译错误:第一处声明这些字段为必需,第二处声明为可选,两者合并时字段签名不匹配。建议拆分为独立的数据结构类型和组件属性类型。
建议修复
-export interface AdvanceListContainerProps {
- data: {
- list: Record<string, any>[];
- page_size?: number | string;
- page?: number | string;
- };
- titleBrick: { useBrick: UseBrickConf };
- suffixBrick?: { useBrick: UseBrickConf };
- itemClick?: () => void;
- selectable?: boolean;
- defaultActiveIndex?: number;
-}
+export interface AdvanceListContainerData {
+ list: Record<string, any>[];
+ page_size?: number | string;
+ page?: number | string;
+}
export interface AdvanceListContainerProps {
- data?: AdvanceListContainerProps["data"];
- titleBrick?: AdvanceListContainerProps["titleBrick"];
- suffixBrick?: AdvanceListContainerProps["suffixBrick"];
+ data?: AdvanceListContainerData;
+ titleBrick?: { useBrick: UseBrickConf };
+ suffixBrick?: { useBrick: UseBrickConf };
+ itemClick?: () => void;
showCard?: boolean;
defaultActiveIndex?: number;
notTriggerClickEventWhenInit?: boolean;
selectable?: boolean;
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/advance-list-container/index.d.ts` around
lines 1 - 22, There are two conflicting declarations of
AdvanceListContainerProps causing interface merge/type errors; replace the
duplicate interfaces with a clear separation: define a new type/interface
AdvanceListData (or similar) for the data shape (list, page_size, page) and keep
a single AdvanceListContainerProps that references AdvanceListData and declares
optional fields (data?, titleBrick?, suffixBrick?, showCard?,
defaultActiveIndex?, notTriggerClickEventWhenInit?, selectable?). Update all
references to use the new AdvanceListData type and ensure only one
AdvanceListContainerProps declaration remains so optionality is consistent.
| import type { AnchorProps } from "antd"; | ||
| import type { UseBrickConf } from "@next-core/brick-types"; | ||
|
|
||
| export interface AnchorListType extends AnchorLinkProps { |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n bricks/basic-bricks/dist-types/general-anchor/index.d.ts | head -20Repository: easyops-cn/next-basics
Length of output: 744
🏁 Script executed:
# Check if AnchorLinkProps is imported elsewhere in the codebase
rg "AnchorLinkProps" --type ts --type tsxRepository: easyops-cn/next-basics
Length of output: 93
🏁 Script executed:
# Check the package.json to see the antd version
fd package.json | xargs grep -l "antd" | head -5Repository: easyops-cn/next-basics
Length of output: 179
🏁 Script executed:
# Look for the source file (not dist-types) to understand the actual implementation
fd "general-anchor" -type dRepository: easyops-cn/next-basics
Length of output: 236
🏁 Script executed:
# Search for AnchorLinkProps in source TypeScript files
rg "AnchorLinkProps" --type ts -B 2 -A 2Repository: easyops-cn/next-basics
Length of output: 1429
🏁 Script executed:
# Check antd version in the root package.json
cat package.json | grep -A 20 '"antd"'Repository: easyops-cn/next-basics
Length of output: 630
🏁 Script executed:
# Find the source TypeScript file for general-anchor
find . -path "*/general-anchor/*.ts" ! -path "*/dist*" ! -path "*/node_modules/*"Repository: easyops-cn/next-basics
Length of output: 120
🏁 Script executed:
# View the source file to see the exact imports
cat -n bricks/basic-bricks/src/general-anchor/index.tsx | head -20Repository: easyops-cn/next-basics
Length of output: 741
🏁 Script executed:
# Double-check the antd module structure for versions ~4.12.3
rg "export.*AnchorLinkProps" --type tsRepository: easyops-cn/next-basics
Length of output: 287
🌐 Web query:
antd 4.12.3 AnchorLinkProps import path
💡 Result:
For antd v4.12.3, AnchorLinkProps is declared on the AnchorLink module, so you can import it via:
import type { AnchorLinkProps } from 'antd/es/anchor/AnchorLink'; // ESM build
// or
import type { AnchorLinkProps } from 'antd/lib/anchor/AnchorLink'; // CJS buildThis matches antd’s general “import types from antd/es/...” pattern (example shown in their docs) [1], and AnchorLink’s typings live at es/anchor/AnchorLink.d.ts / lib/anchor/AnchorLink.d.ts in the published package structure [2].
Sources: [1] (4x-ant-design.antgroup.com) [2] (jsdocs.io)
Citations:
- 1: https://4x-ant-design.antgroup.com/components/menu/?utm_source=openai
- 2: https://www.jsdocs.io/package/antd?utm_source=openai
缺少 AnchorLinkProps 类型的导入。
第 4 行 AnchorListType extends AnchorLinkProps,但 AnchorLinkProps 未被导入。需要从 antd 中导入该类型。
🔧 建议修复:添加缺失的导入
-import type { AnchorProps } from "antd";
+import type { AnchorProps, AnchorLinkProps } from "antd";
import type { UseBrickConf } from "@next-core/brick-types";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import type { AnchorProps } from "antd"; | |
| import type { UseBrickConf } from "@next-core/brick-types"; | |
| export interface AnchorListType extends AnchorLinkProps { | |
| import type { AnchorProps, AnchorLinkProps } from "antd"; | |
| import type { UseBrickConf } from "@next-core/brick-types"; | |
| export interface AnchorListType extends AnchorLinkProps { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/general-anchor/index.d.ts` around lines 1 - 4,
The type AnchorLinkProps is used by AnchorListType but not imported; update the
imports to also bring AnchorLinkProps from antd (alongside AnchorProps) so that
the declaration "export interface AnchorListType extends AnchorLinkProps"
resolves—modify the import line that currently imports AnchorProps to include
AnchorLinkProps.
| import React from "react"; | ||
| import type { ButtonProps } from "antd/lib/button"; | ||
|
|
||
| export declare type ButtonType = typeof ButtonTypes[number]; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# 检查 index.d.ts 文件内容
cat -n bricks/basic-bricks/dist-types/general-button/index.d.tsRepository: easyops-cn/next-basics
Length of output: 3127
🏁 Script executed:
# 搜索 ButtonTypes 在整个仓库中的声明
rg -n 'export\s+(declare\s+)?(const|type)\s+ButtonTypes|declare\s+const\s+ButtonTypes' --type=ts --type=tsx --type=js -A 2Repository: easyops-cn/next-basics
Length of output: 93
🏁 Script executed:
# 查看 general-button 源代码文件结构
fd -t f '(index|button)' bricks/basic-bricks/src --type f | head -20Repository: easyops-cn/next-basics
Length of output: 1231
🏁 Script executed:
# 修正查询:搜索 ButtonTypes 声明
rg -n 'ButtonTypes' bricks/basic-bricks/src --type ts -A 2 -B 2Repository: easyops-cn/next-basics
Length of output: 2492
🏁 Script executed:
# 查找 general-button 的实现文件
fd 'general-button' bricks/basic-bricks/src -type fRepository: easyops-cn/next-basics
Length of output: 236
🏁 Script executed:
# 检查 dist-types 中是否有其他文件声明了 ButtonTypes
rg -n 'ButtonTypes' bricks/basic-bricks/dist-types/ -A 2 -B 2Repository: easyops-cn/next-basics
Length of output: 948
ButtonTypes 在 d.ts 声明中缺失,导致类型别名无法编译。
export declare type ButtonType = typeof ButtonTypes[number]; 引用了值级标识符 ButtonTypes,但该符号在 index.d.ts 中未声明或导出。源代码中存在此声明,但生成的类型定义文件未包含它,将导致 TypeScript 编译失败。
需要在类型别名之前导出 ButtonTypes 的声明:
export declare const ButtonTypes: readonly ["default", "primary", "text", "dashed", "link", "nav", "icon"];
export declare type ButtonType = typeof ButtonTypes[number];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/general-button/index.d.ts` at line 4, Add an
exported declaration for the value-level symbol ButtonTypes before the
ButtonType alias so the d.ts exposes the referenced constant; specifically,
declare and export ButtonTypes as a readonly tuple matching the runtime values
(e.g., ["default","primary","text","dashed","link","nav","icon"]) and then keep
the existing export declare type ButtonType = typeof ButtonTypes[number] so the
type alias can compile against the declared constant.
| hasExtraSlot?: boolean; | ||
| hasFooter?: boolean; | ||
| isFixedFooter?: boolean; | ||
| operationButtons?: OperationButton[]; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, read the target file to see its contents
cat -n "bricks/basic-bricks/dist-types/general-card/index.d.ts"Repository: easyops-cn/next-basics
Length of output: 1136
🏁 Script executed:
#!/bin/bash
# Search for OperationButton type definition in the codebase
rg -n "export.*type.*OperationButton|export.*interface.*OperationButton|declare.*OperationButton" --type ts --type tsxRepository: easyops-cn/next-basics
Length of output: 93
🏁 Script executed:
#!/bin/bash
# Search for OperationButton usage across the codebase
rg -n "OperationButton" --type ts --type tsx -A 2 -B 2 | head -100Repository: easyops-cn/next-basics
Length of output: 93
🏁 Script executed:
#!/bin/bash
# Search for OperationButton type definition with corrected file type
rg -n "export.*type.*OperationButton|export.*interface.*OperationButton" --type tsRepository: easyops-cn/next-basics
Length of output: 153
🏁 Script executed:
#!/bin/bash
# More general search for OperationButton definition
rg -n "OperationButton" --type ts | grep -E "(interface|type|export|declare)" | head -20Repository: easyops-cn/next-basics
Length of output: 661
🏁 Script executed:
#!/bin/bash
# Check if there's a brick-types module or similar type definitions
find . -name "*types*" -type f \( -name "*.d.ts" -o -name "*.ts" \) | grep -v node_modules | grep -v dist | head -20Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Read the source index.tsx to see how it properly imports OperationButton
cat -n "bricks/basic-bricks/src/general-card/index.tsx" | head -20Repository: easyops-cn/next-basics
Length of output: 895
🏁 Script executed:
#!/bin/bash
# Read the OperationButton interface definition
cat -n "bricks/basic-bricks/src/interfaces/general-card.ts"Repository: easyops-cn/next-basics
Length of output: 388
🏁 Script executed:
#!/bin/bash
# Check if there's a dist-types file for interfaces
find bricks/basic-bricks/dist-types -name "*interface*" -o -name "*general-card*"Repository: easyops-cn/next-basics
Length of output: 109
🏁 Script executed:
#!/bin/bash
# List all files in dist-types directory
ls -la bricks/basic-bricks/dist-types/Repository: easyops-cn/next-basics
Length of output: 3263
🏁 Script executed:
#!/bin/bash
# Check files in the general-card dist-types directory
ls -la bricks/basic-bricks/dist-types/general-card/Repository: easyops-cn/next-basics
Length of output: 236
🏁 Script executed:
#!/bin/bash
# Check the main index.d.ts file to see if it re-exports OperationButton
cat -n bricks/basic-bricks/dist-types/index.d.tsRepository: easyops-cn/next-basics
Length of output: 2255
🏁 Script executed:
#!/bin/bash
# Check if there's a corresponding .d.ts file for interfaces
ls -la bricks/basic-bricks/dist-types/ | grep -i interfaceRepository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Check the build configuration to understand how .d.ts files are generated
find . -maxdepth 2 -name "tsconfig.json" -o -name "package.json" | head -5 | xargs grep -l "declaration\|dts"Repository: easyops-cn/next-basics
Length of output: 81
🏁 Script executed:
#!/bin/bash
# Check the tsconfig.json to understand the build configuration
cat -n ./tsconfig.json | head -50Repository: easyops-cn/next-basics
Length of output: 736
🏁 Script executed:
#!/bin/bash
# Check the build scripts in package.json
cat bricks/basic-bricks/package.json | grep -A 10 "scripts"Repository: easyops-cn/next-basics
Length of output: 1900
🏁 Script executed:
#!/bin/bash
# Check the tsconfig.types.json file
cat -n bricks/basic-bricks/tsconfig.types.json 2>/dev/null || echo "File not found in bricks/basic-bricks"Repository: easyops-cn/next-basics
Length of output: 559
🏁 Script executed:
#!/bin/bash
# Check if tsconfig.types.json exists at root
cat -n ./tsconfig.types.json 2>/dev/null || echo "Not found at root"Repository: easyops-cn/next-basics
Length of output: 83
🏁 Script executed:
#!/bin/bash
# Look for any scripts that generate dist-types
grep -r "dist-types" bricks/basic-bricks --include="*.json" --include="*.js" | head -10Repository: easyops-cn/next-basics
Length of output: 258
🏁 Script executed:
#!/bin/bash
# Check the post-build.js script to understand how dist-types are generated
cat -n bricks/basic-bricks/scripts/post-build.js 2>/dev/null || cat -n scripts/post-build.js 2>/dev/null | head -100Repository: easyops-cn/next-basics
Length of output: 174
🏁 Script executed:
#!/bin/bash
# Check for any declarations directory
ls -la bricks/basic-bricks/declarations/ 2>/dev/null || echo "No declarations dir"Repository: easyops-cn/next-basics
Length of output: 85
🏁 Script executed:
#!/bin/bash
# Look for the actual webpack config to understand how dist-types are built
grep -A 5 -B 5 "dist-types\|dist/types" bricks/basic-bricks/webpack.config.js 2>/dev/null | head -30Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Look at the jsx.ts file which is included in the declaration generation
cat -n bricks/basic-bricks/src/jsx.ts | head -100Repository: easyops-cn/next-basics
Length of output: 8579
🏁 Script executed:
#!/bin/bash
# Check what's in the dist-types/jsx.d.ts to understand the pattern
cat -n bricks/basic-bricks/dist-types/jsx.d.ts | head -50Repository: easyops-cn/next-basics
Length of output: 1843
🏁 Script executed:
#!/bin/bash
# Look for how other bricks handle this - check another brick's dist-types
ls bricks/basic-bricks/dist-types/general-button/ && cat -n bricks/basic-bricks/dist-types/general-button/index.d.tsRepository: easyops-cn/next-basics
Length of output: 3138
🏁 Script executed:
#!/bin/bash
# Check how the general-card source file is structured and what it exports
cat -n bricks/basic-bricks/src/general-card/index.tsxRepository: easyops-cn/next-basics
Length of output: 8293
🏁 Script executed:
#!/bin/bash
# Look at another brick's dist-types to see the pattern of type exports
grep -n "export" bricks/basic-bricks/dist-types/general-button/index.d.tsRepository: easyops-cn/next-basics
Length of output: 392
🏁 Script executed:
#!/bin/bash
# Check what's actually exported from the source file
grep -n "^export" bricks/basic-bricks/src/general-card/index.tsxRepository: easyops-cn/next-basics
Length of output: 207
🏁 Script executed:
#!/bin/bash
# Check if interfaces/index file re-exports OperationButton
cat -n bricks/basic-bricks/src/interfaces/index.ts 2>/dev/null || ls -la bricks/basic-bricks/src/interfaces/Repository: easyops-cn/next-basics
Length of output: 104
🏁 Script executed:
#!/bin/bash
# Check if OperationButton should be exported from a central location
grep -rn "export.*OperationButton" bricks/basic-bricks/dist-types/ --include="*.d.ts"Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# See how the post-build process generates dist-types
# Look for any build scripts that handle the .d.ts file generation
find bricks/basic-bricks -name "*.js" -type f | xargs grep -l "dist-types\|declaration" 2>/dev/null | head -5Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Check if there's an interfaces directory in dist-types
find bricks/basic-bricks/dist-types -name "*interface*" -o -name "*.ts" | grep -v node_modulesRepository: easyops-cn/next-basics
Length of output: 2691
🏁 Script executed:
#!/bin/bash
# Look at how other dist-types files handle type imports
grep -n "import.*from" bricks/basic-bricks/dist-types/general-button/index.d.ts | head -10Repository: easyops-cn/next-basics
Length of output: 148
🏁 Script executed:
#!/bin/bash
# Check if the source general-card file exports OperationButton
grep -n "OperationButton" bricks/basic-bricks/src/general-card/index.tsxRepository: easyops-cn/next-basics
Length of output: 326
🏁 Script executed:
#!/bin/bash
# Check if the source file should export OperationButton
cat bricks/basic-bricks/src/general-card/index.tsx | grep -A 5 -B 5 "export interface GeneralCardElementProps"Repository: easyops-cn/next-basics
Length of output: 440
🏁 Script executed:
#!/bin/bash
# Check how the build process handles these files - look at the post-build factory
find . -path ./node_modules -prune -o -name "build-config-factory" -type d -print | head -3Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
#!/bin/bash
# Look at the structure - is OperationButton supposed to be exported from general-card module?
grep -n "export" bricks/basic-bricks/src/general-card/index.tsx | catRepository: easyops-cn/next-basics
Length of output: 207
🏁 Script executed:
#!/bin/bash
# Check if the source interfaces directory re-exports types
cat bricks/basic-bricks/src/interfaces/general-card.tsRepository: easyops-cn/next-basics
Length of output: 311
🏁 Script executed:
#!/bin/bash
# Verify what the source interfaces/index.ts exports
cat bricks/basic-bricks/src/interfaces/index.tsRepository: easyops-cn/next-basics
Length of output: 97
🏁 Script executed:
#!/bin/bash
# Check if the source file should be exporting OperationButton for the generated .d.ts to pick it up
grep -n "^export\|^import" bricks/basic-bricks/src/general-card/index.tsx | head -20Repository: easyops-cn/next-basics
Length of output: 576
缺少 OperationButton 类型的导出。
OperationButton 类型在 GeneralCardElementProps 中使用,但未从源文件导出。在生成的 .d.ts 类型声明中,外部消费者无法访问此类型,导致 TypeScript 类型检查错误。
需要在源文件 bricks/basic-bricks/src/general-card/index.tsx 中添加 OperationButton 的重新导出,确保类型在发布的类型声明中可用。
🔧 建议修复
import { OperationButton } from "../interfaces";
+export type { OperationButton } from "../interfaces";将此行添加到 bricks/basic-bricks/src/general-card/index.tsx 中,使 OperationButton 在生成的类型声明中对外部消费者可用。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/general-card/index.d.ts` at line 12,
GeneralCardElementProps references the OperationButton type but OperationButton
is not exported, causing it to be missing from the generated .d.ts; open
bricks/basic-bricks/src/general-card/index.tsx and add a re-export for
OperationButton (the same named export used in the module that defines it) so
that OperationButton is exported alongside the GeneralCard component and
included in the generated type declarations.
| @@ -0,0 +1,147 @@ | |||
| import React from "react"; | |||
| import type { MenuIcon } from "@next-core/brick-types"; | |||
| import type { ButtonType } from "antd/lib/button"; | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 精确定位当前文件中的冲突与未定义引用
rg -n 'import type.*ButtonType.*antd/lib/button' bricks/basic-bricks/dist-types/general-custom-buttons/index.d.ts
rg -n 'export declare type ButtonType' bricks/basic-bricks/dist-types/general-custom-buttons/index.d.ts
rg -n '\b(ButtonTypes|ButtonShape|ButtonSize|TooltipPlacement)\b' bricks/basic-bricks/dist-types/general-custom-buttons/index.d.tsRepository: easyops-cn/next-basics
Length of output: 350
🏁 Script executed:
# 读取完整文件内容以了解上下文
wc -l bricks/basic-bricks/dist-types/general-custom-buttons/index.d.tsRepository: easyops-cn/next-basics
Length of output: 134
🏁 Script executed:
# 查找仓库内这些类型的实际定义位置
rg -n --type=ts --type=tsx 'export\s+(type|interface|const)\s+(ButtonType|ButtonTypes|ButtonShape|ButtonSize|TooltipPlacement)\b' --max-count=20Repository: easyops-cn/next-basics
Length of output: 93
🏁 Script executed:
cat -n bricks/basic-bricks/dist-types/general-custom-buttons/index.d.tsRepository: easyops-cn/next-basics
Length of output: 4327
🏁 Script executed:
# 在源码目录中搜索这些类型的定义(不限于 .d.ts)
rg -n 'ButtonShape|ButtonSize|TooltipPlacement|ButtonTypes' bricks/basic-bricks/src/general-custom-buttons/ 2>/dev/null || echo "Directory not found or no matches"Repository: easyops-cn/next-basics
Length of output: 1953
🏁 Script executed:
# 查找相关源文件
fd -t f 'index\.(ts|tsx|js)' bricks/basic-bricks/src/general-custom-buttons/ 2>/dev/null || echo "Source directory structure not found"Repository: easyops-cn/next-basics
Length of output: 122
🏁 Script executed:
sed -n '15,25p' bricks/basic-bricks/src/general-custom-buttons/GeneralCustomButtons.tsxRepository: easyops-cn/next-basics
Length of output: 230
🏁 Script executed:
# 验证 .d.ts 文件中 Line 96 的 ButtonTypes 是否在任何地方定义
rg -n 'declare const ButtonTypes' bricks/basic-bricks/dist-types/Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
head -20 bricks/basic-bricks/dist-types/general-custom-buttons/index.d.tsRepository: easyops-cn/next-basics
Length of output: 547
补齐缺失的导入声明;移除 Line 96 的冗余 ButtonType 声明。
.d.ts 文件缺少以下导入:
ButtonShape、ButtonSize应从antd/lib/button导入(行 49、61 使用)TooltipPlacement应从antd/lib/tooltip导入(行 77 使用)- Line 96 的
ButtonType声明与 Line 3 的导入冲突,且引用的ButtonTypes在此文件未定义
在 Line 3 后添加导入:
import type { ButtonShape, ButtonSize } from "antd/lib/button";
import type { TooltipPlacement } from "antd/lib/tooltip";删除 Line 96 的冗余声明 export declare type ButtonType = typeof ButtonTypes[number];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/general-custom-buttons/index.d.ts` at line 3,
Add missing type imports and remove the redundant conflicting type alias: import
ButtonShape and ButtonSize from "antd/lib/button" and TooltipPlacement from
"antd/lib/tooltip" by adding import type { ButtonShape, ButtonSize } from
"antd/lib/button"; and import type { TooltipPlacement } from "antd/lib/tooltip";
immediately after the existing import type { ButtonType } from
"antd/lib/button"; statement, and delete the redundant export declare type
ButtonType = typeof ButtonTypes[number]; declaration (which conflicts with the
imported ButtonType and references an undefined ButtonTypes).
a79de9d to
cc8b600
Compare
There was a problem hiding this comment.
Actionable comments posted: 31
Note
Due to the large number of review comments, Critical severity comments were prioritized as inline comments.
♻️ Duplicate comments (2)
bricks/basic-bricks/dist-types/general-anchor/index.d.ts (1)
1-4:⚠️ Potential issue | 🔴 Critical缺少
AnchorLinkProps导入,AnchorListType当前不可解析。Line 4 继承了
AnchorLinkProps,但 Line 1-2 未导入该类型,TS 会报未定义标识符。该问题在历史评论中已出现,建议本次直接修复。🔧 建议修复
import type { AnchorProps } from "antd"; +import type { AnchorLinkProps } from "antd/lib/anchor/AnchorLink"; import type { UseBrickConf } from "@next-core/brick-types";#!/bin/bash set -euo pipefail echo "== 1) 检查当前声明文件导入与使用 ==" sed -n '1,14p' bricks/basic-bricks/dist-types/general-anchor/index.d.ts | nl -ba echo echo "== 2) 检查源码中的 AnchorLinkProps 导入方式(若文件存在) ==" if [ -f bricks/basic-bricks/src/general-anchor/index.tsx ]; then sed -n '1,40p' bricks/basic-bricks/src/general-anchor/index.tsx | nl -ba | grep -nE 'AnchorLinkProps|from "antd|from '\''antd' || true else echo "未找到源码文件:bricks/basic-bricks/src/general-anchor/index.tsx" fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-anchor/index.d.ts` around lines 1 - 4, The declaration for AnchorListType extends AnchorLinkProps but AnchorLinkProps is not imported; add an import for AnchorLinkProps from "antd" at the top of the declaration file so the type resolves, e.g. include AnchorLinkProps in the existing import statement that currently imports AnchorProps; update the import line to import { AnchorProps, AnchorLinkProps } from "antd" and keep the rest of the AnchorListType and related declarations unchanged.bricks/basic-bricks/dist-types/general-button/index.d.ts (1)
5-5:⚠️ Potential issue | 🔴 Critical补齐
ButtonTypes声明,否则ButtonType无法解析。
Line [5]引用了未声明的ButtonTypes,会直接导致类型声明编译失败。建议修复
+export declare const ButtonTypes: readonly [ + "default", + "primary", + "text", + "dashed", + "link", + "nav", + "icon" +]; export declare type ButtonType = typeof ButtonTypes[number];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-button/index.d.ts` at line 5, The type alias ButtonType references an undeclared symbol ButtonTypes which breaks declaration compilation; add an exported declaration for ButtonTypes (e.g., export declare const ButtonTypes: readonly [...];) in the declaration file so ButtonType can resolve as typeof ButtonTypes[number]; ensure the declared array values match the runtime implementation (or use string literal union) and export it alongside ButtonType to restore correct type resolution.
🟠 Major comments (4)
bricks/basic-bricks/dist-types/popover-container/index.d.ts-34-34 (1)
34-34:⚠️ Potential issue | 🟠 Major统一
getPopupContainer的可选性语义,避免 Props 与 Element 契约冲突。Line 34 的 Props 接口将该属性声明为可选(使用
?),但 Line 84 的 Element 类声明为强制属性且返回值可空。建议改为属性可选,返回值必填。建议修改
- getPopupContainer: (triggerNode: HTMLElement) => HTMLElement | undefined; + getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;Also applies to: 84-84
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/popover-container/index.d.ts` at line 34, The Props interface currently declares getPopupContainer as optional (getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement) while the Element class declares it as required but returning nullable; unify them by making the property optional on the Props side and ensure the Element class method signature getPopupContainer returns a non-nullable HTMLElement (i.e., remove nullable union/optional from the Element declaration) so both declarations use the same optionality contract; update the declaration for getPopupContainer in the Element class to match the Props signature (optional prop, non-nullable return) and adjust any related types or null checks accordingly.bricks/basic-bricks/dist-types/general-popup/index.d.ts-1-2 (1)
1-2:⚠️ Potential issue | 🟠 Major移除
React值导入,声明文件仅保留 type-only 导入。Line 1 和 Line 2 存在
React的重复声明。该文件为.d.ts声明文件,且React仅用于类型(React.CSSProperties),应移除第 1 行的值导入,仅保留第 2 行的 type-only 导入。修复方案
-import React from "react"; import type React from "react";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/general-popup/index.d.ts` around lines 1 - 2, Remove the value import "import React from 'react';" and keep only the type-only import "import type React from 'react';" in the declaration file so React is imported solely for types (e.g. React.CSSProperties); delete the first import line and ensure no runtime React value import remains while leaving the type-only import intact.bricks/presentational-bricks/dist-types/jsx.d.ts-413-424 (1)
413-424:⚠️ Potential issue | 🟠 Major显式导入
Moment类型,避免隐式命名空间依赖
moment.Moment在.d.ts文件中使用但未显式导入,可能导致类型消费者面临隐式命名空间解析问题。brick-calendar/index.d.ts及由其导出的jsx.d.ts中都存在此问题。建议添加
import type { Moment } from "moment";并将所有moment.Moment替换为Moment。修改位置
bricks/presentational-bricks/dist-types/brick-calendar/index.d.ts
- 在文件顶部添加:
import type { Moment } from "moment";- 将
moment.Moment替换为Moment(4 处)bricks/presentational-bricks/dist-types/jsx.d.ts
- 在文件顶部添加:
import type { Moment } from "moment";- 将
moment.Moment替换为Moment(4 处,413-424 行)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/jsx.d.ts` around lines 413 - 424, The declaration uses moment.Moment without an explicit import which can break consumers; add an explicit type-only import "import type { Moment } from 'moment';" at the top of the affected declaration files and replace all occurrences of moment.Moment with the imported Moment type (e.g., in the JSX event props onPresentationalCalendarOnSelect, onPresentationalCalendarOnSelectV2, onPresentationalCalendarOnChange, onPresentationalCalendarOnChangeV2 and the corresponding types in brick-calendar/index.d.ts) so the signatures use Moment directly.bricks/presentational-bricks/dist-types/jsx.d.ts-346-349 (1)
346-349:⚠️ Potential issue | 🟠 MajorReact 19 兼容性需确认:JSX 扩展入口建议迁移到
React.JSX当前使用
declare global { namespace JSX { ... } }。若消费端升级到 React 19 类型,这种增强方式可能不再被正确拾取,导致自定义标签类型失效。#!/bin/bash set -euo pipefail echo "[1] 检查仓库内 react / `@types/react` 版本" fd -HI '^package\.json$' -x sh -c ' echo "## $1" rg -n "\"react\"|\"@types/react\"" "$1" || true ' sh {} echo echo "[2] 检查 d.ts 中 JSX 扩展写法" rg -n 'declare global\s*{\s*namespace JSX|declare module "react"\s*{\s*namespace JSX' -g '*.d.ts'💡 建议改法(兼容 React 19)
-declare global { - namespace JSX { - interface IntrinsicElements { +declare module "react" { + namespace JSX { + interface IntrinsicElements { // ...existing entries } } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/dist-types/jsx.d.ts` around lines 346 - 349, The JSX intrinsic element augmentation currently uses declare global { namespace JSX { interface IntrinsicElements { "presentational-bricks.agent-status": ... } } } which may not be picked up by consumers using React 19 types; add a module augmentation for React instead: create a declare module "react" { namespace JSX { interface IntrinsicElements { "presentational-bricks.agent-status": DetailedHTMLProps<...> } } } (you can keep the existing global augmentation for backward compatibility), ensuring the entry that defines "presentational-bricks.agent-status" and the IntrinsicElements interface is duplicated under the declare module "react" block so both React <19 and React 19+ consumers resolve the custom tag.
🧹 Nitpick comments (2)
bricks/basic-bricks/dist-types/interfaces/general-card.d.ts (1)
3-11: 接口定义结构清晰,有一处注释可以改进。整体接口设计良好。第 4 行的注释
// to listen for不够完整,建议补充说明id和eventName字段的具体用途,以提高代码可读性。📝 建议完善注释
export interface OperationButton { - // to listen for + /** 按钮唯一标识 */ id: string; + /** 按钮点击时触发的事件名称 */ eventName: string; configProps: ButtonProps & { icon?: string }; tooltip?: string; text?: string; needData?: boolean; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/interfaces/general-card.d.ts` around lines 3 - 11, 注释过于简略:在 OperationButton 接口中将第 4 行的注释 “// to listen for” 改为更明确的说明,表明 id 是该操作按钮的唯一标识符(用于在列表或回调中区分按钮),而 eventName 是按钮触发时向外部或父组件发出的事件名称(供外部监听与处理);在注释中也可简短说明触发时是否会携带 configProps 或 needData 的含义以便阅读,修改位置参考 OperationButton、id 和 eventName 标识符。bricks/basic-bricks/dist-types/bootstrap.d.ts (1)
1-44: 建议将 bootstrap 导入清单改为生成式维护。该清单较长且全手工维护,后续新增/重命名组件时容易漏改。建议通过脚本按目录自动生成,减少类型面漂移风险。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/basic-bricks/dist-types/bootstrap.d.ts` around lines 1 - 44, 当前 bootstrap.d.ts 中的长列表手工维护(一系列 "./<component>/index.js" 导入)容易遗漏新增或重命名的组件;请改为生成式维护:实现一个脚本(例如 scripts/generate-bootstrap.js)在构建或发布前扫描组件目录(匹配每个子目录下存在 index.js 的项),按 "./<dir>/index.js" 模式生成并覆盖 bootstrap.d.ts 的导入列表(保留文件头/尾如有必要),并将该脚本挂到 npm prebuild/prepublish 或 CI 步骤中以保证每次构建前自动更新,从而避免手工同步差异。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bricks/basic-bricks/dist-types/advance-list-container/index.d.ts`:
- Line 44: Replace the incorrect type name AdvanceListContainerProps1 with the
correct, defined type AdvanceListContainerProps for the data property in the
AdvanceListContainer declaration; locate the line declaring "data:
AdvanceListContainerProps1['data'] | undefined" and change it so it references
AdvanceListContainerProps['data'] to restore correct typing for the
AdvanceListContainer interface.
In `@bricks/basic-bricks/dist-types/app-bar-setting/index.d.ts`:
- Around line 1-2: 当前文件重复导入了 React(默认导入和类型导入),导致编译错误;删除这两条导入并替换为单一的类型导入:import
type { CSSProperties } from "react";然后在本文件中把所有出现的
React.CSSProperties(在原评论提到的标识位置:有关样式类型的位置)替换为 CSSProperties,确保不再使用默认 React
导入且仅以类型方式引用样式类型。
In `@bricks/basic-bricks/dist-types/app-bar-wrapper/index.d.ts`:
- Around line 1-2: 移除重复的 React 声明:删除“import React from
'react'”并替换为类型导入(例如“import type { CSSProperties } from 'react'”),然后在声明中将所有对
React 的类型引用改为直接使用 CSSProperties(修改 index.d.ts 中原先在第7行和第13行使用 React.CSSProperties
的地方),以避免重复声明 React 导致的 “Cannot redeclare block-scoped variable 'React'” 错误。
In `@bricks/basic-bricks/dist-types/app-document-link/index.d.ts`:
- Around line 1-2: 移除重复运行时导入:删除第一行的 import React from "react";,将第二行改为类型导入 import
type { CSSProperties } from "react";,并把文件中所有以 React.CSSProperties 的类型引用(在当前 diff
中提到的第 5、6、11、12 行)改为直接使用 CSSProperties;确保没有其他对运行时 React 的引用以避免引入未使用的值导致编译错误。
In `@bricks/basic-bricks/dist-types/easy-view/index.d.ts`:
- Around line 1-2: Remove the duplicate React runtime import and keep only type
imports: delete the non-type `import React from "react";`, replace with a type
import for CSS types (e.g. `import type { CSSProperties } from "react";`), and
then update all occurrences of `React.CSSProperties` in this declaration file to
use `CSSProperties` instead so the duplicate identifier error is resolved.
In `@bricks/basic-bricks/dist-types/general-button/index.d.ts`:
- Around line 1-3: Remove the duplicate runtime import of React and keep only a
type-only import so TypeScript doesn’t report a duplicate identifier;
specifically delete or convert the first import "import React from 'react';" and
retain "import type React from 'react';" (or replace with the narrower type
import for CSSProperties) so symbols like React, ButtonProps, and usages such as
React.CSSProperties in the index.d.ts are resolved as types only.
In `@bricks/basic-bricks/dist-types/general-custom-buttons/index.d.ts`:
- Around line 1-5: Remove the duplicate React import (the two React imports at
the top) so React is imported only once, and change the imports that are used
solely for types—MenuIcon, ButtonType, ButtonShape, ButtonSize, and
TooltipPlacement—to use "import type" instead of value imports; specifically,
keep a single import React from "react" (or use "import type React" if React is
only used as a type) and convert the lines importing MenuIcon, ButtonType,
ButtonShape, ButtonSize, and TooltipPlacement to "import type" statements so the
declaration file only contains type-only imports.
In `@bricks/basic-bricks/dist-types/list-container/index.d.ts`:
- Around line 1-3: 当前声明同时存在运行时导入 `import React from "react"` 和类型导入 `import type
React from "react"` 导致 TypeScript 重声明错误;在只使用类型(例如
`React.CSSProperties`)的情况下,删除运行时导入并保留类型导入即可; locate the duplicate `React`
imports in the module (the lines with `import React from "react"` and `import
type React from "react"`) and remove the runtime `import React from "react"`
while keeping `import type React from "react"` (ensure other imports like
`UseBrickConf` remain unchanged).
In `@bricks/basic-bricks/dist-types/micro-app/index.d.ts`:
- Around line 1-2: 重复导入 React 导致类型错误:删除默认导入并保留类型导入。定位到文件中出现的两个导入声明(import React
from "react" 和 import type React from "react"),移除或注释掉普通值导入 import React from
"react",只保留 import type React from "react",以在 .d.ts 声明文件中避免同一标识符的重复定义并通过类型检查。
In `@bricks/basic-bricks/dist-types/popover-container/index.d.ts`:
- Around line 1-5: There are duplicate imports of the types MenuIcon and
UseBrickConf (they are already imported at the top); remove the redundant import
lines that re-import MenuIcon and UseBrickConf so each type is imported only
once (keep the original import statements that include MenuIcon and UseBrickConf
and delete the repeated ones).
In `@bricks/basic-bricks/dist-types/resizable-box/index.d.ts`:
- Around line 1-2: Remove the duplicate value import of React and keep only the
type-only import: delete the plain "import React from 'react';" and keep "import
type React from 'react';" so TypeScript doesn't re-declare React when only types
like React.CSSProperties are used; update any references relying on a runtime
React import (e.g., components or JSX) to use a proper runtime import if needed,
otherwise ensure all uses in this declaration file are type-only.
In `@bricks/basic-bricks/dist-types/sub-menu/index.d.ts`:
- Around line 1-2: Remove the duplicate type import of UseBrickConf: keep a
single import from "@next-core/brick-types" that includes both SidebarMenu and
UseBrickConf (e.g., import type { SidebarMenu, UseBrickConf } from
"@next-core/brick-types";) and delete the second line that re-imports
UseBrickConf to avoid the TypeScript redeclaration error.
In `@bricks/presentational-bricks/dist-types/brick-divider/index.d.ts`:
- Around line 1-2: The file contains duplicate React imports — a value import
and a type-only import — causing TypeScript errors; remove the non-type import
and keep only the type-only import (import type React from "react") so type
references like React.CSSProperties used in the declarations compile correctly;
update the import statements in index.d.ts to only use the type-only import and
ensure no other code requires the runtime React symbol.
In `@bricks/presentational-bricks/dist-types/brick-list/index.d.ts`:
- Around line 1-4: The ItemProps interface references the missing type
ListItemProps which causes a TS2304 error; add an import for ListItemProps from
"antd/lib/list/Item" alongside the existing imports (so the top-of-file imports
include ListItemProps) and ensure ItemProps extends that imported ListItemProps
type.
In `@bricks/presentational-bricks/dist-types/brick-quick-entries/index.d.ts`:
- Around line 1-3: The file contains duplicate imports of React (both `import
React from "react";` and `import type React from "react";`) which causes a
noRedeclare TypeScript error; remove the redundant import so only one React
import remains (prefer keeping the value import `import React from "react";` if
React is used as a value, or `import type React from "react";` if used purely
for types) and ensure the `UseBrickConf` type import remains unchanged.
In `@bricks/presentational-bricks/dist-types/brick-result/index.d.ts`:
- Line 1: Declaration file uses the CSSProperties type but it's not imported;
update the type references in
bricks/presentational-bricks/dist-types/brick-result/index.d.ts to either import
CSSProperties from React (add an `import type { CSSProperties } from "react"`
alongside the existing React import) or change the usage at the place where
CSSProperties is referenced (e.g., the type on line ~26) to use the React
namespace prefix (React.CSSProperties); pick one approach and apply it
consistently so the d.ts compiles without missing type errors.
In `@bricks/presentational-bricks/dist-types/brick-tag/index.d.ts`:
- Around line 1-4: 在声明文件中存在重复的 React 导入(两个 import React/ import type React),导致
TypeScript noRedeclare 错误;请删除重复的类型导入语句(即移除第二个 "import type React from
\"react\""),保留首行的普通导入 `import React from "react";`,并确认没有其它重复的 React 导入声明(检查
`index.d.ts` 中的导入块如 `import React from "react";` 和 `import type { TooltipProps }
from "antd";`)。
In `@bricks/presentational-bricks/dist-types/brick-tree/index.d.ts`:
- Line 8: The type name AntTreeNodeProps is undefined in this declaration;
replace it with the already-imported TreeNodeProps (i.e. change the referenced
type in BrickTreeNodeProps from AntTreeNodeProps to TreeNodeProps) so the export
uses the correct imported type and the declaration file compiles.
In `@bricks/presentational-bricks/dist-types/collapsible-card-item/index.d.ts`:
- Around line 1-3: 文件中存在重复导入 React(重复声明)并且未导入 CSSProperties,导致类型错误;请删除重复的
`import type React from "react";`,改为在顶部添加 `import type { CSSProperties } from
"react";`(或合并到现有 React 导入),并将所有类型引用 `React.CSSProperties` 统一替换为
`CSSProperties`,重点修复声明符号 `operatingAreaStyle?: CSSProperties;` 和
`operatingAreaStyle: CSSProperties | undefined;`(以及文件中其他相同用法),以消除重复声明和未定义类型引用。
In `@bricks/presentational-bricks/dist-types/cost-time/index.d.ts`:
- Around line 1-2: 当前声明了两个同名 React 导入(import React from "react" 与 import type
React from "react"),导致重复声明错误;删除或移除非类型导入并仅保留类型导入 (保留 import type React from
"react"),因为该模块仅用于类型注解(如 React.CSSProperties);在代码中检查所有导出/引用是否仍能通过类型导入解析(例如在类型位置使用
React)并运行 TypeScript 编译以验证问题已解决。
In `@bricks/presentational-bricks/dist-types/digital-number/index.d.ts`:
- Around line 1-24: The file uses the CSSProperties type but never defines or
imports it; update the type references in DigitalNumberProps and
DigitalNumberElement to a valid React type (e.g., change CSSProperties to
React.CSSProperties) or import the CSSProperties type from React and use it
(affecting the properties cellStyle, textStyle and their declarations in
DigitalNumberProps and DigitalNumberElement); locate usages by the symbols
DigitalNumberProps and DigitalNumberElement and modify their type annotations
accordingly so the file compiles.
In `@bricks/presentational-bricks/dist-types/dynamic-grid-container/index.d.ts`:
- Around line 1-3: Remove the duplicate React imports and instead import the
CSSProperties type from React; specifically delete the duplicate "import React
from 'react'" statements, add "import type { CSSProperties } from 'react'", and
replace any occurrences of React.CSSProperties at the two usage sites (the ones
referenced in the diff) with CSSProperties while keeping the existing
UseBrickConf import intact so there is no TypeScript noRedeclare error.
In `@bricks/presentational-bricks/dist-types/entry-card-item/index.d.ts`:
- Around line 1-3: 删除重复的 React 导入:移除值导入语句 "import React from 'react';" 并保留类型导入
"import type React from 'react';"(以便继续使用 React.CSSProperties 作为类型),同时保留已有的
"import type { MenuIcon } from '@next-core/brick-types';" 导入,确保不会造成重复声明导致的
TypeScript 编译错误。
In `@bricks/presentational-bricks/dist-types/general-badge/index.d.ts`:
- Around line 1-3: 移除重复的类型导入:保留唯一的 import type { MenuIcon, UseBrickConf } from
"@next-core/brick-types"; 并删除额外的重复声明(当前重复的 import type { MenuIcon } 和 import
type { UseBrickConf }),确保只对 MenuIcon 和 UseBrickConf 进行一次导入以消除 TypeScript
的重复声明错误。
In `@bricks/presentational-bricks/dist-types/general-image/index.d.ts`:
- Around line 1-4: Remove the duplicate value import of React and make
ImageProps a type-only import: delete the line "import React from 'react'" and
keep "import type React from 'react'" (since React is only used for types like
React.CSSProperties), and change "import { ImageProps } from 'rc-image'" to
"import type { ImageProps } from 'rc-image'"; ensure any interfaces or
declarations that extend ImageProps (and usages of UseBrickConf) continue to
reference these types correctly.
In `@bricks/presentational-bricks/dist-types/general-tooltip/index.d.ts`:
- Around line 1-2: 文件同时存在两个导入声明(import React from "react"; 和 import type React
from "react";),导致重复声明错误;保留单一的类型导入并删除值导入:删除或替换掉非类型导入行(the plain import
React),只保留类型导入(import type React from "react";)或改为命名空间类型导入(import type * as
React from "react";)以满足对 React.CSSProperties 等类型的引用。
In `@bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts`:
- Around line 1-4: Remove the duplicate React import by replacing the default
import ("import React from 'react'") with a single type-only import ("import
type React from 'react'") so TypeScript doesn't see duplicate identifier
'React'; ensure any usages like React.CSSProperties remain typed via the type
import and keep other imports (UseBrickConf, MenuIcon) unchanged — update the
import statements at the top of the file accordingly.
In `@bricks/presentational-bricks/dist-types/log-display/index.d.ts`:
- Around line 1-2: 删除重复的值导入:移除第一行的 `import React from "react";`,仅保留 `import type
React from "react";`,因为代码中只使用了 `React` 作为类型(例如
`React.CSSProperties`),这样可消除同名冲突并修复 TypeScript 编译错误。
In `@bricks/presentational-bricks/dist-types/markdown-editor/index.d.ts`:
- Around line 1-2: Remove the runtime import "import React from 'react'" and
keep the type-only import "import type React from 'react'" to avoid the
duplicate declaration; update the top of the declaration file so only the type
import remains (used for symbols like React.CSSProperties or React.ReactNode)
and ensure no runtime React references are required by any exported types in
this .d.ts.
In `@bricks/presentational-bricks/dist-types/table-transfer/index.d.ts`:
- Around line 1-3: Remove the runtime React import and keep a type-only import
to fix the duplicate declaration in the declaration file: replace the top-level
import React from "react" with import type React from "react"; also add/import
the CSSProperties type (e.g., import type { CSSProperties } from "react") and
update any references to React.CSSProperties in the declarations to use the
imported CSSProperties type; ensure ColumnsType import stays as-is and adjust
any affected exported types in this module (e.g., props or table column type
annotations) to reference the new type-only React and CSSProperties imports.
In `@bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts`:
- Around line 1-3: 删除重复的 React 导入:在该模块中保留一处 import React from "react"; 并移除重复的
type 导入 import type React from "react";(即删除第三行的重复声明),以消除 TypeScript 的
noRedeclare 错误并恢复类型检查。
---
Major comments:
In `@bricks/basic-bricks/dist-types/general-popup/index.d.ts`:
- Around line 1-2: Remove the value import "import React from 'react';" and keep
only the type-only import "import type React from 'react';" in the declaration
file so React is imported solely for types (e.g. React.CSSProperties); delete
the first import line and ensure no runtime React value import remains while
leaving the type-only import intact.
In `@bricks/basic-bricks/dist-types/popover-container/index.d.ts`:
- Line 34: The Props interface currently declares getPopupContainer as optional
(getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement) while the
Element class declares it as required but returning nullable; unify them by
making the property optional on the Props side and ensure the Element class
method signature getPopupContainer returns a non-nullable HTMLElement (i.e.,
remove nullable union/optional from the Element declaration) so both
declarations use the same optionality contract; update the declaration for
getPopupContainer in the Element class to match the Props signature (optional
prop, non-nullable return) and adjust any related types or null checks
accordingly.
In `@bricks/presentational-bricks/dist-types/jsx.d.ts`:
- Around line 413-424: The declaration uses moment.Moment without an explicit
import which can break consumers; add an explicit type-only import "import type
{ Moment } from 'moment';" at the top of the affected declaration files and
replace all occurrences of moment.Moment with the imported Moment type (e.g., in
the JSX event props onPresentationalCalendarOnSelect,
onPresentationalCalendarOnSelectV2, onPresentationalCalendarOnChange,
onPresentationalCalendarOnChangeV2 and the corresponding types in
brick-calendar/index.d.ts) so the signatures use Moment directly.
- Around line 346-349: The JSX intrinsic element augmentation currently uses
declare global { namespace JSX { interface IntrinsicElements {
"presentational-bricks.agent-status": ... } } } which may not be picked up by
consumers using React 19 types; add a module augmentation for React instead:
create a declare module "react" { namespace JSX { interface IntrinsicElements {
"presentational-bricks.agent-status": DetailedHTMLProps<...> } } } (you can keep
the existing global augmentation for backward compatibility), ensuring the entry
that defines "presentational-bricks.agent-status" and the IntrinsicElements
interface is duplicated under the declare module "react" block so both React <19
and React 19+ consumers resolve the custom tag.
---
Duplicate comments:
In `@bricks/basic-bricks/dist-types/general-anchor/index.d.ts`:
- Around line 1-4: The declaration for AnchorListType extends AnchorLinkProps
but AnchorLinkProps is not imported; add an import for AnchorLinkProps from
"antd" at the top of the declaration file so the type resolves, e.g. include
AnchorLinkProps in the existing import statement that currently imports
AnchorProps; update the import line to import { AnchorProps, AnchorLinkProps }
from "antd" and keep the rest of the AnchorListType and related declarations
unchanged.
In `@bricks/basic-bricks/dist-types/general-button/index.d.ts`:
- Line 5: The type alias ButtonType references an undeclared symbol ButtonTypes
which breaks declaration compilation; add an exported declaration for
ButtonTypes (e.g., export declare const ButtonTypes: readonly [...];) in the
declaration file so ButtonType can resolve as typeof ButtonTypes[number]; ensure
the declared array values match the runtime implementation (or use string
literal union) and export it alongside ButtonType to restore correct type
resolution.
---
Nitpick comments:
In `@bricks/basic-bricks/dist-types/bootstrap.d.ts`:
- Around line 1-44: 当前 bootstrap.d.ts 中的长列表手工维护(一系列 "./<component>/index.js"
导入)容易遗漏新增或重命名的组件;请改为生成式维护:实现一个脚本(例如
scripts/generate-bootstrap.js)在构建或发布前扫描组件目录(匹配每个子目录下存在 index.js 的项),按
"./<dir>/index.js" 模式生成并覆盖 bootstrap.d.ts 的导入列表(保留文件头/尾如有必要),并将该脚本挂到 npm
prebuild/prepublish 或 CI 步骤中以保证每次构建前自动更新,从而避免手工同步差异。
In `@bricks/basic-bricks/dist-types/interfaces/general-card.d.ts`:
- Around line 3-11: 注释过于简略:在 OperationButton 接口中将第 4 行的注释 “// to listen for”
改为更明确的说明,表明 id 是该操作按钮的唯一标识符(用于在列表或回调中区分按钮),而 eventName
是按钮触发时向外部或父组件发出的事件名称(供外部监听与处理);在注释中也可简短说明触发时是否会携带 configProps 或 needData
的含义以便阅读,修改位置参考 OperationButton、id 和 eventName 标识符。
ℹ️ Review info
Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 44214099-9675-4dd1-96ec-2e8deb11e676
📒 Files selected for processing (134)
.gitignorebricks/basic-bricks/dist-types/advance-list-container/index.d.tsbricks/basic-bricks/dist-types/app-bar-breadcrumb/index.d.tsbricks/basic-bricks/dist-types/app-bar-setting/index.d.tsbricks/basic-bricks/dist-types/app-bar-wrapper/index.d.tsbricks/basic-bricks/dist-types/app-bar/index.d.tsbricks/basic-bricks/dist-types/app-document-link/index.d.tsbricks/basic-bricks/dist-types/bootstrap.d.tsbricks/basic-bricks/dist-types/brick-error/index.d.tsbricks/basic-bricks/dist-types/delete-confirm-modal/index.d.tsbricks/basic-bricks/dist-types/easy-view/index.d.tsbricks/basic-bricks/dist-types/export-json-file/index.d.tsbricks/basic-bricks/dist-types/flex-layout/index.d.tsbricks/basic-bricks/dist-types/fold-brick-v2/index.d.tsbricks/basic-bricks/dist-types/fold-brick/index.d.tsbricks/basic-bricks/dist-types/general-anchor/index.d.tsbricks/basic-bricks/dist-types/general-button/index.d.tsbricks/basic-bricks/dist-types/general-card/index.d.tsbricks/basic-bricks/dist-types/general-custom-buttons/index.d.tsbricks/basic-bricks/dist-types/general-drawer/index.d.tsbricks/basic-bricks/dist-types/general-heading/index.d.tsbricks/basic-bricks/dist-types/general-hotkeys/index.d.tsbricks/basic-bricks/dist-types/general-modal/index.d.tsbricks/basic-bricks/dist-types/general-notification/index.d.tsbricks/basic-bricks/dist-types/general-popup/index.d.tsbricks/basic-bricks/dist-types/general-text/index.d.tsbricks/basic-bricks/dist-types/general-timer/index.d.tsbricks/basic-bricks/dist-types/general-title/index.d.tsbricks/basic-bricks/dist-types/header-bar/index.d.tsbricks/basic-bricks/dist-types/index-card/index.d.tsbricks/basic-bricks/dist-types/index.d.tsbricks/basic-bricks/dist-types/interfaces/general-card.d.tsbricks/basic-bricks/dist-types/interfaces/index.d.tsbricks/basic-bricks/dist-types/jsx.d.tsbricks/basic-bricks/dist-types/list-container/index.d.tsbricks/basic-bricks/dist-types/magic-brick/index.d.tsbricks/basic-bricks/dist-types/menu-bar/index.d.tsbricks/basic-bricks/dist-types/micro-app/index.d.tsbricks/basic-bricks/dist-types/multiple-columns-card/index.d.tsbricks/basic-bricks/dist-types/page-error/index.d.tsbricks/basic-bricks/dist-types/page-not-found/index.d.tsbricks/basic-bricks/dist-types/page-title/index.d.tsbricks/basic-bricks/dist-types/popover-container/index.d.tsbricks/basic-bricks/dist-types/print-button/index.d.tsbricks/basic-bricks/dist-types/quick-visit-menu/index.d.tsbricks/basic-bricks/dist-types/resizable-box/index.d.tsbricks/basic-bricks/dist-types/script-brick/index.d.tsbricks/basic-bricks/dist-types/sub-menu-filter/index.d.tsbricks/basic-bricks/dist-types/sub-menu/index.d.tsbricks/basic-bricks/dist-types/virtual-list-container/index.d.tsbricks/basic-bricks/package.jsonbricks/presentational-bricks/dist-types/agent-status/index.d.tsbricks/presentational-bricks/dist-types/avatar-upload/index.d.tsbricks/presentational-bricks/dist-types/banner-display-card-list/index.d.tsbricks/presentational-bricks/dist-types/basic-icon/index.d.tsbricks/presentational-bricks/dist-types/basic-progress/index.d.tsbricks/presentational-bricks/dist-types/bootstrap.d.tsbricks/presentational-bricks/dist-types/brick-alert-level/index.d.tsbricks/presentational-bricks/dist-types/brick-alert-number/index.d.tsbricks/presentational-bricks/dist-types/brick-alert-status/index.d.tsbricks/presentational-bricks/dist-types/brick-alert-value/index.d.tsbricks/presentational-bricks/dist-types/brick-alert/index.d.tsbricks/presentational-bricks/dist-types/brick-button/index.d.tsbricks/presentational-bricks/dist-types/brick-calendar/index.d.tsbricks/presentational-bricks/dist-types/brick-cluster-type/index.d.tsbricks/presentational-bricks/dist-types/brick-code-display/index.d.tsbricks/presentational-bricks/dist-types/brick-collapse-card/index.d.tsbricks/presentational-bricks/dist-types/brick-conditional-display/index.d.tsbricks/presentational-bricks/dist-types/brick-delete-confirm/index.d.tsbricks/presentational-bricks/dist-types/brick-descriptions/index.d.tsbricks/presentational-bricks/dist-types/brick-display-structs/index.d.tsbricks/presentational-bricks/dist-types/brick-divider/index.d.tsbricks/presentational-bricks/dist-types/brick-form/index.d.tsbricks/presentational-bricks/dist-types/brick-general-search/index.d.tsbricks/presentational-bricks/dist-types/brick-humanize-time/index.d.tsbricks/presentational-bricks/dist-types/brick-illustration/index.d.tsbricks/presentational-bricks/dist-types/brick-input/index.d.tsbricks/presentational-bricks/dist-types/brick-link/index.d.tsbricks/presentational-bricks/dist-types/brick-list/index.d.tsbricks/presentational-bricks/dist-types/brick-placeholder/index.d.tsbricks/presentational-bricks/dist-types/brick-quick-entries/index.d.tsbricks/presentational-bricks/dist-types/brick-rate/index.d.tsbricks/presentational-bricks/dist-types/brick-result/index.d.tsbricks/presentational-bricks/dist-types/brick-table/index.d.tsbricks/presentational-bricks/dist-types/brick-tag/index.d.tsbricks/presentational-bricks/dist-types/brick-timeline/index.d.tsbricks/presentational-bricks/dist-types/brick-tree/index.d.tsbricks/presentational-bricks/dist-types/brick-user-group/index.d.tsbricks/presentational-bricks/dist-types/brick-user/index.d.tsbricks/presentational-bricks/dist-types/brick-utils/index.d.tsbricks/presentational-bricks/dist-types/brick-value-mapping/index.d.tsbricks/presentational-bricks/dist-types/button-wrapper/index.d.tsbricks/presentational-bricks/dist-types/card-item/index.d.tsbricks/presentational-bricks/dist-types/code-editor/index.d.tsbricks/presentational-bricks/dist-types/collapse-info-list/index.d.tsbricks/presentational-bricks/dist-types/collapsible-card-item/index.d.tsbricks/presentational-bricks/dist-types/copyable-text/index.d.tsbricks/presentational-bricks/dist-types/cost-time/index.d.tsbricks/presentational-bricks/dist-types/crontab-display/index.d.tsbricks/presentational-bricks/dist-types/datetime-selector/index.d.tsbricks/presentational-bricks/dist-types/digital-number/index.d.tsbricks/presentational-bricks/dist-types/dropdown-button/index.d.tsbricks/presentational-bricks/dist-types/dropdown-select/index.d.tsbricks/presentational-bricks/dist-types/dynamic-content/index.d.tsbricks/presentational-bricks/dist-types/dynamic-grid-container/index.d.tsbricks/presentational-bricks/dist-types/entry-card-item/index.d.tsbricks/presentational-bricks/dist-types/general-badge/index.d.tsbricks/presentational-bricks/dist-types/general-carousel/index.d.tsbricks/presentational-bricks/dist-types/general-image/index.d.tsbricks/presentational-bricks/dist-types/general-label/index.d.tsbricks/presentational-bricks/dist-types/general-list/index.d.tsbricks/presentational-bricks/dist-types/general-pagination/index.d.tsbricks/presentational-bricks/dist-types/general-preview-image/index.d.tsbricks/presentational-bricks/dist-types/general-slider/index.d.tsbricks/presentational-bricks/dist-types/general-tooltip/index.d.tsbricks/presentational-bricks/dist-types/general-transfer/index.d.tsbricks/presentational-bricks/dist-types/general-video/index.d.tsbricks/presentational-bricks/dist-types/index.d.tsbricks/presentational-bricks/dist-types/info-display-card-list/index.d.tsbricks/presentational-bricks/dist-types/interfaces/common.d.tsbricks/presentational-bricks/dist-types/jsx.d.tsbricks/presentational-bricks/dist-types/log-display/index.d.tsbricks/presentational-bricks/dist-types/markdown-display/index.d.tsbricks/presentational-bricks/dist-types/markdown-editor/index.d.tsbricks/presentational-bricks/dist-types/modal-confirm/index.d.tsbricks/presentational-bricks/dist-types/qrcode-download/index.d.tsbricks/presentational-bricks/dist-types/rank-table/index.d.tsbricks/presentational-bricks/dist-types/single-field-edit/index.d.tsbricks/presentational-bricks/dist-types/statistic-card/index.d.tsbricks/presentational-bricks/dist-types/table-transfer/index.d.tsbricks/presentational-bricks/dist-types/template-breadcrumb/index.d.tsbricks/presentational-bricks/dist-types/text-collapse/index.d.tsbricks/presentational-bricks/dist-types/tree-transfer/index.d.tsbricks/presentational-bricks/package.json
💤 Files with no reviewable changes (1)
- .gitignore
✅ Files skipped from review due to trivial changes (1)
- bricks/basic-bricks/dist-types/interfaces/index.d.ts
🚧 Files skipped from review as they are similar to previous changes (57)
- bricks/basic-bricks/dist-types/export-json-file/index.d.ts
- bricks/presentational-bricks/dist-types/brick-cluster-type/index.d.ts
- bricks/presentational-bricks/dist-types/general-transfer/index.d.ts
- bricks/presentational-bricks/dist-types/qrcode-download/index.d.ts
- bricks/presentational-bricks/package.json
- bricks/basic-bricks/dist-types/quick-visit-menu/index.d.ts
- bricks/basic-bricks/dist-types/general-notification/index.d.ts
- bricks/presentational-bricks/dist-types/brick-user-group/index.d.ts
- bricks/presentational-bricks/dist-types/brick-user/index.d.ts
- bricks/presentational-bricks/dist-types/general-video/index.d.ts
- bricks/presentational-bricks/dist-types/single-field-edit/index.d.ts
- bricks/presentational-bricks/dist-types/brick-rate/index.d.ts
- bricks/presentational-bricks/dist-types/general-slider/index.d.ts
- bricks/presentational-bricks/dist-types/basic-icon/index.d.ts
- bricks/presentational-bricks/dist-types/basic-progress/index.d.ts
- bricks/basic-bricks/dist-types/page-title/index.d.ts
- bricks/presentational-bricks/dist-types/markdown-display/index.d.ts
- bricks/presentational-bricks/dist-types/brick-alert/index.d.ts
- bricks/presentational-bricks/dist-types/brick-button/index.d.ts
- bricks/basic-bricks/dist-types/virtual-list-container/index.d.ts
- bricks/basic-bricks/package.json
- bricks/presentational-bricks/dist-types/avatar-upload/index.d.ts
- bricks/presentational-bricks/dist-types/brick-conditional-display/index.d.ts
- bricks/presentational-bricks/dist-types/dropdown-button/index.d.ts
- bricks/presentational-bricks/dist-types/brick-alert-number/index.d.ts
- bricks/basic-bricks/dist-types/delete-confirm-modal/index.d.ts
- bricks/presentational-bricks/dist-types/brick-calendar/index.d.ts
- bricks/presentational-bricks/dist-types/collapse-info-list/index.d.ts
- bricks/basic-bricks/dist-types/app-bar-breadcrumb/index.d.ts
- bricks/basic-bricks/dist-types/general-timer/index.d.ts
- bricks/presentational-bricks/dist-types/brick-input/index.d.ts
- bricks/basic-bricks/dist-types/multiple-columns-card/index.d.ts
- bricks/presentational-bricks/dist-types/general-pagination/index.d.ts
- bricks/presentational-bricks/dist-types/brick-alert-level/index.d.ts
- bricks/presentational-bricks/dist-types/datetime-selector/index.d.ts
- bricks/presentational-bricks/dist-types/general-list/index.d.ts
- bricks/presentational-bricks/dist-types/button-wrapper/index.d.ts
- bricks/basic-bricks/dist-types/general-modal/index.d.ts
- bricks/basic-bricks/dist-types/general-text/index.d.ts
- bricks/presentational-bricks/dist-types/brick-illustration/index.d.ts
- bricks/basic-bricks/dist-types/fold-brick/index.d.ts
- bricks/basic-bricks/dist-types/script-brick/index.d.ts
- bricks/presentational-bricks/dist-types/brick-placeholder/index.d.ts
- bricks/presentational-bricks/dist-types/dynamic-content/index.d.ts
- bricks/presentational-bricks/dist-types/rank-table/index.d.ts
- bricks/presentational-bricks/dist-types/template-breadcrumb/index.d.ts
- bricks/presentational-bricks/dist-types/brick-form/index.d.ts
- bricks/presentational-bricks/dist-types/brick-display-structs/index.d.ts
- bricks/presentational-bricks/dist-types/brick-code-display/index.d.ts
- bricks/basic-bricks/dist-types/index.d.ts
- bricks/presentational-bricks/dist-types/brick-link/index.d.ts
- bricks/presentational-bricks/dist-types/code-editor/index.d.ts
- bricks/basic-bricks/dist-types/print-button/index.d.ts
- bricks/presentational-bricks/dist-types/brick-utils/index.d.ts
- bricks/basic-bricks/dist-types/general-card/index.d.ts
- bricks/presentational-bricks/dist-types/index.d.ts
- bricks/presentational-bricks/dist-types/bootstrap.d.ts
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -name "index.d.ts" -path "*/app-bar-setting/*" | head -5Repository: easyops-cn/next-basics
Length of output: 125
🏁 Script executed:
cat -n bricks/basic-bricks/dist-types/app-bar-setting/index.d.tsRepository: easyops-cn/next-basics
Length of output: 502
移除 React 重复导入声明。
Line 1 和 Line 2 对同一标识符 React 进行了重复声明,会导致 TypeScript 编译错误。Line 1 导入默认导出(运行时),Line 2 导入类型,这在同一文件中不允许。由于代码仅使用 React.CSSProperties 这一类型,建议合并为单一的类型导入。
修复方案:移除两条现有导入,改为 import type { CSSProperties } from "react",并将 Lines 5、6、10、11 中的 React.CSSProperties 替换为 CSSProperties。
🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/app-bar-setting/index.d.ts` around lines 1 -
2, 当前文件重复导入了 React(默认导入和类型导入),导致编译错误;删除这两条导入并替换为单一的类型导入:import type {
CSSProperties } from "react";然后在本文件中把所有出现的
React.CSSProperties(在原评论提到的标识位置:有关样式类型的位置)替换为 CSSProperties,确保不再使用默认 React
导入且仅以类型方式引用样式类型。
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -name "index.d.ts" -path "*/app-bar-wrapper/*" | head -20Repository: easyops-cn/next-basics
Length of output: 125
🏁 Script executed:
cat -n bricks/basic-bricks/dist-types/app-bar-wrapper/index.d.tsRepository: easyops-cn/next-basics
Length of output: 557
🏁 Script executed:
# Check if this is a generated file or source file
head -20 bricks/basic-bricks/src/app-bar-wrapper/index.ts 2>/dev/null || echo "Source file not found or different location"Repository: easyops-cn/next-basics
Length of output: 109
🏁 Script executed:
# Verify TypeScript compilation would fail with this
# Check if there are any tsconfig or build configs
find . -name "tsconfig.json" -path "*/bricks/basic-bricks/*" | head -5Repository: easyops-cn/next-basics
Length of output: 101
🏁 Script executed:
# Check the actual TypeScript error by examining dist-types structure
ls -la bricks/basic-bricks/dist-types/ | head -20Repository: easyops-cn/next-basics
Length of output: 1303
🏁 Script executed:
# Verify that this is indeed a problematic duplicate
# Check if there are other similar files with same pattern
rg 'import React from.*\nimport type React' bricks/basic-bricks/dist-types/ -U | head -10Repository: easyops-cn/next-basics
Length of output: 908
移除重复的 React 声明。
第 1 行和第 2 行对同一符号的重复绑定会导致 TypeScript 报错 "Cannot redeclare block-scoped variable 'React'"。建议只保留 CSSProperties 类型导入,并更新第 7 和第 13 行的使用方式:
建议修复
-import React from "react";
-import type React from "react";
+import type { CSSProperties } from "react";
export interface AppBarWrapperProps {
isFixed?: boolean;
displayCenter?: boolean;
- extraAppBarContentStyle?: React.CSSProperties;
+ extraAppBarContentStyle?: CSSProperties;
}
export declare class AppBarWrapperElement extends HTMLElement {
isFixed: boolean | undefined;
displayCenter: boolean | undefined;
- extraAppBarContentStyle: React.CSSProperties | undefined;
+ extraAppBarContentStyle: CSSProperties | undefined;
}🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/app-bar-wrapper/index.d.ts` around lines 1 -
2, 移除重复的 React 声明:删除“import React from 'react'”并替换为类型导入(例如“import type {
CSSProperties } from 'react'”),然后在声明中将所有对 React 的类型引用改为直接使用 CSSProperties(修改
index.d.ts 中原先在第7行和第13行使用 React.CSSProperties 的地方),以避免重复声明 React 导致的 “Cannot
redeclare block-scoped variable 'React'” 错误。
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n "bricks/basic-bricks/dist-types/app-document-link/index.d.ts"Repository: easyops-cn/next-basics
Length of output: 565
移除重复的 React 导入,避免 TypeScript 编译失败。
第 1-2 行对 React 重复声明。由于文件仅使用 React.CSSProperties 类型,建议:
- 移除第 1 行的运行时导入
- 将第 2 行改为直接导入
CSSProperties类型 - 更新第 5、6、11、12 行的类型引用
建议修复
-import React from "react";
-import type React from "react";
+import type { CSSProperties } from "react";- iconStyle?: React.CSSProperties;
- buttonStyle?: React.CSSProperties;
+ iconStyle?: CSSProperties;
+ buttonStyle?: CSSProperties;- iconStyle: React.CSSProperties | undefined;
- buttonStyle: React.CSSProperties | undefined;
+ iconStyle: CSSProperties | undefined;
+ buttonStyle: CSSProperties | undefined;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import React from "react"; | |
| import type React from "react"; | |
| import type { CSSProperties } from "react"; |
🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/app-document-link/index.d.ts` around lines 1 -
2, 移除重复运行时导入:删除第一行的 import React from "react";,将第二行改为类型导入 import type {
CSSProperties } from "react";,并把文件中所有以 React.CSSProperties 的类型引用(在当前 diff 中提到的第
5、6、11、12 行)改为直接使用 CSSProperties;确保没有其他对运行时 React 的引用以避免引入未使用的值导致编译错误。
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# 首先检查文件是否存在并查看其内容
cat -n bricks/basic-bricks/dist-types/easy-view/index.d.ts | head -50Repository: easyops-cn/next-basics
Length of output: 952
🏁 Script executed:
# 使用提供的验证命令检查重复的React导入
rg -n 'import( type)? React from "react";' bricks/basic-bricks/dist-types/easy-view/index.d.tsRepository: easyops-cn/next-basics
Length of output: 128
移除重复的 React 声明导入,修复 TypeScript 编译错误。
第 1 行和第 2 行存在同名标识符重复声明,会触发 TypeScript 错误。建议统一为仅保留类型导入,并将所有 React.CSSProperties 引用替换为直接的 CSSProperties:
建议修改
-import React from "react";
-import type React from "react";
+import type { CSSProperties } from "react";
@@
- containerStyle?: React.CSSProperties;
- styleByAreas?: Record<string, React.CSSProperties>;
+ containerStyle?: CSSProperties;
+ styleByAreas?: Record<string, CSSProperties>;
@@
- containerStyle: React.CSSProperties | undefined;
- styleByAreas: Record<string, React.CSSProperties> | undefined;
+ containerStyle: CSSProperties | undefined;
+ styleByAreas: Record<string, CSSProperties> | undefined;🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/basic-bricks/dist-types/easy-view/index.d.ts` around lines 1 - 2,
Remove the duplicate React runtime import and keep only type imports: delete the
non-type `import React from "react";`, replace with a type import for CSS types
(e.g. `import type { CSSProperties } from "react";`), and then update all
occurrences of `React.CSSProperties` in this declaration file to use
`CSSProperties` instead so the duplicate identifier error is resolved.
| import React from "react"; | ||
| import type { UseBrickConf } from "@next-core/brick-types"; | ||
| import type React from "react"; | ||
| import type { MenuIcon } from "@next-core/brick-types"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -path "*bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts" -type fRepository: easyops-cn/next-basics
Length of output: 141
🏁 Script executed:
cat -n bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts | head -20Repository: easyops-cn/next-basics
Length of output: 700
🏁 Script executed:
# Check if React is used anywhere in this d.ts file
grep -n "React" bricks/presentational-bricks/dist-types/info-display-card-list/index.d.tsRepository: easyops-cn/next-basics
Length of output: 215
🏁 Script executed:
# Look for the source .ts/.tsx file for this declaration
find . -path "*bricks/presentational-bricks*" -name "index.ts*" | grep -E "info-display-card-list" | head -10Repository: easyops-cn/next-basics
Length of output: 133
🏁 Script executed:
# Check if there are other files in the same directory to understand the structure
ls -la bricks/presentational-bricks/dist-types/info-display-card-list/Repository: easyops-cn/next-basics
Length of output: 239
🏁 Script executed:
cat -n bricks/presentational-bricks/src/info-display-card-list/index.tsx | head -40Repository: easyops-cn/next-basics
Length of output: 1471
🏁 Script executed:
# Verify TypeScript behavior by checking if there are any build/tsconfig files
find . -maxdepth 2 -name "tsconfig*.json" -o -name "tsconfig*.json" | head -5Repository: easyops-cn/next-basics
Length of output: 81
🏁 Script executed:
# Check if this is part of a build process and how it's generated
find . -path "*dist-types*" -name "package.json" -o -path "*dist-types*" -name "*.json" | head -10Repository: easyops-cn/next-basics
Length of output: 48
🏁 Script executed:
# Check how React namespace is used in the declarations
grep -n "React\." bricks/presentational-bricks/dist-types/info-display-card-list/index.d.tsRepository: easyops-cn/next-basics
Length of output: 152
🏁 Script executed:
# Check if there are similar patterns in other .d.ts files to understand the intended pattern
rg "import React from.*react.*" bricks/presentational-bricks/dist-types --type ts -A 2 | head -30Repository: easyops-cn/next-basics
Length of output: 2417
🏁 Script executed:
# Check how many files have this duplicate React import pattern
rg "import React from.*react.*" bricks/presentational-bricks/dist-types -A 2 | grep -c "import type React from"Repository: easyops-cn/next-basics
Length of output: 68
🏁 Script executed:
# Let's verify if TypeScript actually errors on this pattern by checking the tsconfig
cat tsconfig.json | grep -A 5 '"strict"'Repository: easyops-cn/next-basics
Length of output: 250
🏁 Script executed:
# Check if there's a build script or compile process documented
cat -n package.json | head -50 | grep -E "scripts|build"Repository: easyops-cn/next-basics
Length of output: 914
🏁 Script executed:
# Let's check the actual React usage pattern - is React used as a value in these d.ts files?
# Get more context around the React usage
cat -n bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts | tail -30Repository: easyops-cn/next-basics
Length of output: 1343
移除重复的 React 导入声明,修复类型检查错误。
第 1 行的默认导入与第 3 行的类型导入冲突,TypeScript 会报错"Cannot have duplicate identifier 'React'"。由于 React 仅用于类型注解(React.CSSProperties),应该使用单一的类型导入。
建议修复
-import React from "react";
import type { UseBrickConf } from "@next-core/brick-types";
-import type React from "react";
import type { MenuIcon } from "@next-core/brick-types";
+import type React from "react";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import React from "react"; | |
| import type { UseBrickConf } from "@next-core/brick-types"; | |
| import type React from "react"; | |
| import type { MenuIcon } from "@next-core/brick-types"; | |
| import type { UseBrickConf } from "@next-core/brick-types"; | |
| import type { MenuIcon } from "@next-core/brick-types"; | |
| import type React from "react"; |
🧰 Tools
🪛 Biome (2.4.4)
[error] 3-3: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/presentational-bricks/dist-types/info-display-card-list/index.d.ts`
around lines 1 - 4, Remove the duplicate React import by replacing the default
import ("import React from 'react'") with a single type-only import ("import
type React from 'react'") so TypeScript doesn't see duplicate identifier
'React'; ensure any usages like React.CSSProperties remain typed via the type
import and keep other imports (UseBrickConf, MenuIcon) unchanged — update the
import statements at the top of the file accordingly.
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 验证重复 React 导入
cat -n bricks/presentational-bricks/dist-types/log-display/index.d.ts | head -20
echo "---"
rg -n '^import.*React from "react"' bricks/presentational-bricks/dist-types/log-display/index.d.tsRepository: easyops-cn/next-basics
Length of output: 667
删除重复的值导入,仅保留 React 类型导入
第 1 行的值导入与第 2 行的类型导入存在同名冲突,导致 TypeScript 编译错误。由于代码中仅在类型注解中使用 React(如 React.CSSProperties),应删除第 1 行的值导入。
建议修复
-import React from "react";
import type React from "react";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import React from "react"; | |
| import type React from "react"; | |
| import type React from "react"; |
🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/presentational-bricks/dist-types/log-display/index.d.ts` around lines
1 - 2, 删除重复的值导入:移除第一行的 `import React from "react";`,仅保留 `import type React from
"react";`,因为代码中只使用了 `React` 作为类型(例如 `React.CSSProperties`),这样可消除同名冲突并修复
TypeScript 编译错误。
| import React from "react"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and check if the file exists
find . -name "index.d.ts" -path "*markdown-editor*" 2>/dev/null | head -20Repository: easyops-cn/next-basics
Length of output: 134
🏁 Script executed:
# List files in the path mentioned
git ls-files "bricks/presentational-bricks/dist-types/markdown-editor/" 2>/dev/null || echo "Path not found in git"Repository: easyops-cn/next-basics
Length of output: 132
🏁 Script executed:
# More general search for the markdown-editor directory
find . -type d -name "markdown-editor" 2>/dev/nullRepository: easyops-cn/next-basics
Length of output: 174
🏁 Script executed:
# Read the actual file to verify the imports
cat -n bricks/presentational-bricks/dist-types/markdown-editor/index.d.ts | head -20Repository: easyops-cn/next-basics
Length of output: 706
🏁 Script executed:
# Check if there's any runtime usage of React (beyond type annotations)
cat bricks/presentational-bricks/dist-types/markdown-editor/index.d.tsRepository: easyops-cn/next-basics
Length of output: 1497
🏁 Script executed:
# Also check the source file to understand the actual implementation
cat -n bricks/presentational-bricks/src/markdown-editor/index.tsx | head -30Repository: easyops-cn/next-basics
Length of output: 1006
删除行 1 的 React 运行时导入,保留行 2 的类型导入。
.d.ts 文件中第 1 和第 2 行的导入声明重复。行 1 的 import React from "react" 和行 2 的 import type React from "react" 会造成同名重声明错误。由于该文件仅在类型注解中使用 React(如 React.CSSProperties),不需要运行时导入,应保留类型导入即可。
建议修复
-import React from "react";
import type React from "react";🧰 Tools
🪛 Biome (2.4.4)
[error] 2-2: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/presentational-bricks/dist-types/markdown-editor/index.d.ts` around
lines 1 - 2, Remove the runtime import "import React from 'react'" and keep the
type-only import "import type React from 'react'" to avoid the duplicate
declaration; update the top of the declaration file so only the type import
remains (used for symbols like React.CSSProperties or React.ReactNode) and
ensure no runtime React references are required by any exported types in this
.d.ts.
| import React from "react"; | ||
| import type { ColumnsType } from "antd/es/table/interface"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if file exists and read its content
if [ -f "bricks/presentational-bricks/dist-types/table-transfer/index.d.ts" ]; then
echo "=== File exists, reading content ==="
cat -n "bricks/presentational-bricks/dist-types/table-transfer/index.d.ts"
else
echo "File not found at bricks/presentational-bricks/dist-types/table-transfer/index.d.ts"
# Try to find the file
find . -name "index.d.ts" -path "*table-transfer*" 2>/dev/null
fiRepository: easyops-cn/next-basics
Length of output: 1753
🏁 Script executed:
#!/bin/bash
# Run the verification script from the review comment
rg -n 'import( type)? React from "react";' bricks/presentational-bricks/dist-types/table-transfer/Repository: easyops-cn/next-basics
Length of output: 260
修复 React 的重复导入声明(阻断 TypeScript 类型构建)。
第 1 行与第 3 行同时声明 React,触发重复声明错误。由于这是 .d.ts 类型定义文件,应移除运行时导入,仅保留类型导入。建议引入 CSSProperties 类型并更新调用处。
建议修改
-import React from "react";
import type { ColumnsType } from "antd/es/table/interface";
-import type React from "react";
+import type { CSSProperties } from "react";
@@
- listStyle?: React.CSSProperties;
+ listStyle?: CSSProperties;
@@
- listStyle: React.CSSProperties | undefined;
+ listStyle: CSSProperties | undefined;🧰 Tools
🪛 Biome (2.4.4)
[error] 3-3: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/presentational-bricks/dist-types/table-transfer/index.d.ts` around
lines 1 - 3, Remove the runtime React import and keep a type-only import to fix
the duplicate declaration in the declaration file: replace the top-level import
React from "react" with import type React from "react"; also add/import the
CSSProperties type (e.g., import type { CSSProperties } from "react") and update
any references to React.CSSProperties in the declarations to use the imported
CSSProperties type; ensure ColumnsType import stays as-is and adjust any
affected exported types in this module (e.g., props or table column type
annotations) to reference the new type-only React and CSSProperties imports.
| import React from "react"; | ||
| import type { DataNode } from "rc-tree-select/lib/interface"; | ||
| import type React from "react"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
find . -type f -name "index.d.ts" | grep tree-transferRepository: easyops-cn/next-basics
Length of output: 132
🏁 Script executed:
cat -n bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts | head -20Repository: easyops-cn/next-basics
Length of output: 749
移除重复的 React 导入声明
Line 1 和 Line 3 对 React 进行了同名重复声明,触发 TypeScript noRedeclare 错误并阻断类型检查。删除 Line 3 的重复导入即可解决。
建议修复
import React from "react";
import type { DataNode } from "rc-tree-select/lib/interface";
-import type React from "react";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import React from "react"; | |
| import type { DataNode } from "rc-tree-select/lib/interface"; | |
| import type React from "react"; | |
| import React from "react"; | |
| import type { DataNode } from "rc-tree-select/lib/interface"; |
🧰 Tools
🪛 Biome (2.4.4)
[error] 3-3: Shouldn't redeclare 'React'. Consider to delete it or rename it.
(lint/suspicious/noRedeclare)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bricks/presentational-bricks/dist-types/tree-transfer/index.d.ts` around
lines 1 - 3, 删除重复的 React 导入:在该模块中保留一处 import React from "react"; 并移除重复的 type 导入
import type React from "react";(即删除第三行的重复声明),以消除 TypeScript 的 noRedeclare
错误并恢复类型检查。
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat作为提交类型。BREAKING CHANGE: 你的变更说明。新特性:
feat作为提交类型。问题修复:
fix作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore,docs,test等作为提交类型。Summary by CodeRabbit