fix
This commit is contained in:
parent
b6b849d902
commit
6b5f21a420
|
|
@ -389,8 +389,15 @@ const propTypings = (prop: FNCompDef | undefined, types: any, meta: any) => {
|
|||
"active",
|
||||
"_meta",
|
||||
`\
|
||||
${
|
||||
prop.typings
|
||||
? `
|
||||
${prop.typings};
|
||||
return typings;`
|
||||
return typings;
|
||||
`
|
||||
: ""
|
||||
}
|
||||
`
|
||||
);
|
||||
try {
|
||||
const typings = typings_fn(active, meta);
|
||||
|
|
@ -406,7 +413,7 @@ return typings;`
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(typings_fn.toString());
|
||||
console.log('WARNING: typings prasi error, bilang mas rizky plis...');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@ export const declareScope = (p: PG, meta: IMeta, monaco: Monaco) => {
|
|||
const comp_types = {} as Record<string, string>;
|
||||
|
||||
for (const m of cur_path) {
|
||||
if (m.item.component?.props) {
|
||||
for (const [name, prop] of Object.entries(m.item.component.props)) {
|
||||
if (prop.meta?.type === "content-element") {
|
||||
vars[name] = { mode: "prop", val: "ReactElement" };
|
||||
} else {
|
||||
vars[name] = { mode: "prop", val: prop.value };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m.mitem?.parent && (m.mitem?.parent as any).get("meta")) {
|
||||
let prop_name = "";
|
||||
const parent = m.mitem?.parent.parent as unknown as TypedArray<any>;
|
||||
|
|
@ -49,7 +59,9 @@ export const declareScope = (p: PG, meta: IMeta, monaco: Monaco) => {
|
|||
if (prop_name && m_prev && m_prev.item.component) {
|
||||
const prop_typings = m_prev.item.component.props[prop_name].typings;
|
||||
try {
|
||||
const typings_src = prop_typings.substring(`const typings = `.length);
|
||||
const typings_src = prop_typings?.substring(
|
||||
`const typings = `.length
|
||||
);
|
||||
const typings_fn = new Function(`return ${typings_src}`);
|
||||
const typings = typings_fn();
|
||||
if (typeof typings === "object") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue