react-docgen-typescript-loader
react-docgen-typescript-loader copied to clipboard
defaultValue value without double quotes
There is \\"defaultValue\\": { value: 123 }
without without double quotes around value key in your test snapshots. Do you know why and is there a way to add "
around value key?
I ran to strange bug because of this and that can be fixable here probably.
Let's say I have component Note
which has docgenInfo like this.
Note.__docgenInfo = {
"description": "",
"displayName": "Note",
"props": {
"type": {
"defaultValue": {
value: "info"
},
"description": "",
"name": "type",
"required": false,
"type": {
"name": "\"error\" | \"info\" | undefined"
}
}
}
};
Then I passing this Note.__docgenInfo
in Note.mdx file to component which generate table from it. There it goes wrong because I will get "defaultValue": null
instead of "defaultValue": { value: "info" }
.
If I do this Note.__docgenInfo = JSON.parse(JSON.stringify(Note.__docgenInfo));
before passing to MDX, I will get "defaultValue": { "value": "info" }
which is what I want.
I know there must be some problem with MDX parser discarding that { value: "info" }
, but if I can get valid JSON object in __docgenInfo
from this loader, that is probably better.
What do you think? I tried to hack the code around to get there that quotes, but without success.
Thank you for your time.