wip prop
This commit is contained in:
parent
a71800d7e5
commit
9532590735
|
|
@ -47,7 +47,13 @@ export const extractProp = (prop: {
|
|||
|
||||
for (const [k, v] of Object.entries(props)) {
|
||||
if (v.type) {
|
||||
propTypes.push(`const ${k}: ${trim(v.type, "; \n")};`);
|
||||
let const_or_type = "const";
|
||||
let str = v.type;
|
||||
if (v.type.startsWith("type:")) {
|
||||
str = v.type.substring("type:".length);
|
||||
const_or_type = "type";
|
||||
}
|
||||
propTypes.push(`${const_or_type} ${k}: ${trim(str, "; \n")};`);
|
||||
} else if (v.val) {
|
||||
if (typeof v.val === "object" && isValidElement(v.val)) {
|
||||
propTypes.push(`const ${k}: ReactElement;`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue