mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 13:03:07 +00:00
fix: make isJSExpression more robust
This commit is contained in:
parent
43b2175792
commit
01ce70c06c
@ -128,8 +128,18 @@ export interface CompositeObject {
|
||||
[key: string]: CompositeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了避免把 { type: 'JSExpression', extType: 'function' } 误判为表达式,故增加如下逻辑。
|
||||
*
|
||||
* 引擎中关于函数的表达:
|
||||
* 开源版本:{ type: 'JSFunction', source: '', value: '' }
|
||||
* 内部版本:{ type: 'JSExpression', source: '', value: '', extType: 'function' }
|
||||
* 能力是对标的,不过开源的 react-renderer 只认识第一种,而内部只识别第二种(包括 Java 代码、RE)。
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export function isJSExpression(data: any): data is JSExpression {
|
||||
return data && data.type === 'JSExpression';
|
||||
return data && data.type === 'JSExpression' && data.extType !== 'function';
|
||||
}
|
||||
|
||||
export function isJSFunction(x: any): x is JSFunction {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user