xinnix 76aacf6c21
解决后端使用simple-json 和 simple-array列类型时前端无法创建eps的问题
后端使用此两个类型后,创建eps.d.ts会把这两个类型直接指定为成员类型,但是由于该两种类型并未ts原生类型。所以前端创建eps总是失败,导致一系列问题。增加这两个转换的配置即可解决该问题。
2023-02-20 17:05:58 +08:00

36 lines
756 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export default {
entity: {
mapping: [
{
// 自定义匹配
custom: ({ entityName, propertyName, type }) => {
// status 原本是tinyint如果是1的话== true 是可以的,但是不能 === true请谨慎使用
if (propertyName === "status" && type == "tinyint") return "boolean";
// 如果没有返回null或者不返回则继续遍历其他匹配规则
return null;
}
},
{
type: "string",
test: ["varchar", "text","simple-json"]
},
{
type: "string[]",
test: ["simple-array"]
},
{
type: "Date",
test: ["datetime", "date"]
},
{
type: "number",
test: ["tinyint", "int", "decimal"]
},
{
type: "BigInt",
test: ["bigint"]
}
]
}
};