diff --git a/src/docs/pages/components/returns.tsx b/src/docs/pages/components/returns.tsx index 8c81657..c495d79 100644 --- a/src/docs/pages/components/returns.tsx +++ b/src/docs/pages/components/returns.tsx @@ -5,7 +5,7 @@ import { PagePropsType } from "../../../types/page.types"; import { getTag } from "../utils/tags.utils"; import { getTypePresentation } from "../utils/types.utils"; import { Code } from "./code"; -import { NonParsing } from "./non-parsing"; +// import { NonParsing } from "./non-parsing"; export const Returns: React.FC< PagePropsType @@ -19,13 +19,14 @@ export const Returns: React.FC< return (
- {returnTag?.description && ( + {/* Cause bugs because of postprocessing cannot correctly parse code block */} + {/* {returnTag?.description && ( {"\n"} {returnTag.description} {"\n"} - )} + )} */} {!disableReturn && {getTypePresentation(reflection, reflectionsTree)}}
); diff --git a/src/docs/pages/utils/types.utils.ts b/src/docs/pages/utils/types.utils.ts index a172965..d8cdff2 100644 --- a/src/docs/pages/utils/types.utils.ts +++ b/src/docs/pages/utils/types.utils.ts @@ -25,6 +25,16 @@ export const getTypeValue = ( return reflection; }; +const stringify = (value: unknown) => { + if (value === null) { + return String(value); + } + if (typeof value === "object") { + return JSON.stringify(value); + } + return String(value); +}; + export const getType = ( reflection: JSONOutput.DeclarationReflection | JSONOutput.SomeType | undefined, reflectionsTree: JSONOutput.ProjectReflection[], @@ -293,7 +303,7 @@ export const getType = ( const type = reflection as unknown as JSONOutput.UnionType; return `${type.types - .map((t) => JSON.stringify(getType(t, reflectionsTree, { deepScan }))) + .map((t) => stringify(getType(t, reflectionsTree, { deepScan }))) .join(" | ")}`; } @@ -319,7 +329,7 @@ export const getType = ( (t) => `$\{${getType(t[0], reflectionsTree, { deepScan: false })}}${t[1]}`, ); - return `\`${head}${tail}\``; + return `${head}${tail}`; } default: {