mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 04:40:32 +00:00
use undef for null
This commit is contained in:
parent
9c8f492d03
commit
bb698e7b99
@ -109,11 +109,11 @@ export class Prop implements IPropParent {
|
||||
}
|
||||
return this.items!.map((prop) => {
|
||||
const v = prop.export(stage);
|
||||
return v === UNSET ? null : v;
|
||||
return v === UNSET ? undefined : v;
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private _code: string | null = null;
|
||||
@ -176,7 +176,7 @@ export class Prop implements IPropParent {
|
||||
this._code = null;
|
||||
const t = typeof val;
|
||||
if (val == null) {
|
||||
this._value = null;
|
||||
this._value = undefined;
|
||||
this._type = 'literal';
|
||||
} else if (t === 'string' || t === 'number' || t === 'boolean') {
|
||||
this._type = 'literal';
|
||||
@ -192,7 +192,6 @@ export class Prop implements IPropParent {
|
||||
} else {
|
||||
this._type = 'map';
|
||||
}
|
||||
this._type = 'map';
|
||||
} else {
|
||||
this._type = 'expression';
|
||||
this._value = {
|
||||
@ -206,7 +205,7 @@ export class Prop implements IPropParent {
|
||||
@computed getValue(): CompositeValue {
|
||||
const v = this.export(TransformStage.Serilize);
|
||||
if (v === UNSET) {
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ export class Props implements IPropParent {
|
||||
this.items.forEach(item => {
|
||||
let value = item.export(stage);
|
||||
if (value === UNSET) {
|
||||
value = null;
|
||||
value = undefined;
|
||||
}
|
||||
let name = item.key as string;
|
||||
if (name && typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
||||
@ -129,7 +129,7 @@ export class Props implements IPropParent {
|
||||
}
|
||||
let value = item.export(stage);
|
||||
if (value === UNSET) {
|
||||
value = null;
|
||||
value = undefined;
|
||||
}
|
||||
if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
||||
name = getOriginalExtraKey(name);
|
||||
|
||||
@ -27,7 +27,7 @@ export interface JSBlock {
|
||||
}
|
||||
|
||||
// JSON 基本类型
|
||||
export type JSONValue = boolean | string | number | null | JSONArray | JSONObject;
|
||||
export type JSONValue = boolean | string | number | null | undefined | JSONArray | JSONObject;
|
||||
export type JSONArray = JSONValue[];
|
||||
export interface JSONObject {
|
||||
[key: string]: JSONValue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user