MCPcopy Create free account
hub / github.com/astercloud/aster / getComponentProps

Function getComponentProps

ui/src/types/ui-protocol.ts:794–801  ·  view source on GitHub ↗
(spec: ComponentSpec)

Source from the content-addressed store, hash-verified

792 * 获取组件 Props
793 */
794export function getComponentProps<T = unknown>(spec: ComponentSpec): T {
795 const typeName = getComponentTypeName(spec);
796 const props = (spec as unknown as Record<string, T>)[typeName];
797 if (props === undefined) {
798 throw new Error(`Invalid ComponentSpec: no props found for type ${typeName}`);
799 }
800 return props;
801}
802
803/**
804 * 标准组件类型白名单

Callers 2

buildComponentNodeMethod · 0.90
buildTemplateInstanceMethod · 0.90

Calls 1

getComponentTypeNameFunction · 0.85

Tested by

no test coverage detected