文件名是ComponentNode,属性是id: string 要生成的代码如下 export type SerializedComponentNode = Spread< {…
- User
文件名是ComponentNode,属性是id: string 要生成的代码如下 export type SerializedComponentNode = Spread< { id: string }, SerializedWhiteboardNode
;
/** * 在白板上有坐标、大小、id的对象 */ export class ComponentNode extends DecoratorNode { static getType(): string { return 'component-node' }
static clone(node: ComponentNode): ComponentNode { const componentNode = new ComponentNode(node._id) return componentNode }
//region 属性 /** * 自身的id */ _id: string
getId() : string { const self = this.getLatest() return self._id } setX(id: string): this { const self = this.getWritable() self._id = id return this }
//endregion
constructor(id: string, key?: NodeKey) { super(key); this._id = id }
//region json static importJSON(serializedNode: SerializedComponentNode): ComponentNode { const node = $createComponentNode( serializedNode.id ); return node; }
exportJSON(): SerializedComponentNode { return { id: this.getId(), type: 'component-node', version: 1, }; }
//endregion
}
export function $createComponentNode(id: string) { return new ComponentNode(id) }
export function $isComponentNode( node: WhiteboardNode | null | undefined, ): node is ComponentNode { return node instanceof ComponentNode; } 接下来我告诉你文件名是TextNode,属性是name: string 帮我生成对应的代码
- Assistant
Sure, here is the generated code for the TextNode file:
typescript - User
接下来我告诉你文件名是TextNode,属性是name: string,isOneLine: boolean 帮我生成对应的代码
- Assistant
Sure, here's the generated code for the updated TextNode file:
kotlin
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.