Skip to content

fix(*): hotfix typescript demo docs #955

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,27 @@ module.exports = {

if (componentIndexPath && componentIndexPath.endsWith('.ts')) {
const componentPath = path.resolve(dirPath, `${componentName}.tsx`);
const docs = typescriptDocReader.parse(componentPath)[0];

Object.keys(docs.props).forEach((key) => {

const defaultValue = docs.props[key].defaultValue;

if (
defaultValue &&
defaultValue.value !== undefined &&
typeof defaultValue.value !== 'string') {
// TODO: постараться убрать после обновления styleguidist
// почему-то react styleguidist в недрах ожидает string;
// А тут, как и должно приходит true/false
// хачим чтоб работало
defaultValue.value = String(defaultValue.value);
}

});

return docs;

return typescriptDocReader.parse(componentPath);
}

return reactDoc(componentPath);
Expand Down