isEdge()
测试一个对象是否可以作为Edge使用。在 TypeScript 中,这是一个类型保护,如果返回true,它将把传入的任何内容的类型缩小到Edge。
🌐 Test whether an object is usable as an Edge. In TypeScript
this is a type guard that will narrow the type of whatever you pass in to
Edge if it returns true.
import { isEdge } from '@xyflow/react';
const edge = {
id: 'edge-a',
source: 'a',
target: 'b',
};
if (isEdge(edge)) {
// ...
}签名
🌐 Signature
Parameters:| Name | Type | Default |
|---|---|---|
element | unknownThe element to test |
Last updated on