(source: ConnectionType, target: ConnectionType)
| 68 | }; |
| 69 | |
| 70 | const comparePortTypes = (source: ConnectionType, target: ConnectionType): boolean => { |
| 71 | if (target.kind === 'any' || source.kind === 'any') { |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | if (isPrimitive(source) && isPrimitive(target)) { |
| 76 | return canCoercePrimitive(source, target); |
| 77 | } |
| 78 | |
| 79 | if (isContract(source) && isContract(target)) { |
| 80 | return source.name === target.name && source.credential === target.credential; |
| 81 | } |
| 82 | |
| 83 | if (isList(source) && isList(target)) { |
| 84 | return comparePortTypes(normalizePortType(source.element), normalizePortType(target.element)); |
| 85 | } |
| 86 | |
| 87 | if (isMap(source) && isMap(target)) { |
| 88 | return comparePortTypes(normalizePortType(source.element), normalizePortType(target.element)); |
| 89 | } |
| 90 | |
| 91 | return false; |
| 92 | }; |
| 93 | |
| 94 | export const arePortTypesCompatible = (source: PortLike, target: PortLike): boolean => |
| 95 | comparePortTypes(normalizePortType(source), normalizePortType(target)); |
no test coverage detected