From 8cc47e6774cdb9caa36a92ffef4d70b83a44f37d Mon Sep 17 00:00:00 2001
From: ST-DDT
Date: Fri, 17 Mar 2023 00:01:06 +0100
Subject: docs: fix nested parameter defaults (#1931)
---
.../apidoc/__snapshots__/signature.spec.ts.snap | 28 ++++++++++++++--------
test/scripts/apidoc/signature.example.ts | 6 +++++
2 files changed, 24 insertions(+), 10 deletions(-)
(limited to 'test/scripts')
diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
index cfdbce2f..e7add7c6 100644
--- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
+++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
@@ -44,7 +44,7 @@ exports[`signature > analyzeSignature() > complexArrayParameter 1`] = `
"returns": "T",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L295",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L301",
"title": "Complex Array Parameter",
}
`;
@@ -201,7 +201,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = `
"test.apidoc.methodWithExample()",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L254",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L260",
"title": "Method With Deprecated",
}
`;
@@ -220,7 +220,7 @@ exports[`signature > analyzeSignature() > methodWithExample 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L243",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L249",
"title": "Method With Example",
}
`;
@@ -241,7 +241,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = `
"test.apidoc.methodWithDeprecated()",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L264",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L270",
"title": "Method With Multiple See Markers",
}
`;
@@ -262,7 +262,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic
"test.apidoc.methodWithDeprecated() with parameter bar and baz.",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L274",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L280",
"title": "Method With Multiple See Markers And Backticks",
}
`;
@@ -280,7 +280,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "1.0.0",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L283",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L289",
"title": "Method With Since Marker",
}
`;
@@ -433,7 +433,7 @@ It also has a more complex description.
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L193",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L199",
"title": "Options Inline Param Method With Defaults",
}
`;
@@ -473,7 +473,7 @@ exports[`signature > analyzeSignature() > optionsInterfaceParamMethodWithDefault
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L229",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L235",
"title": "Options Interface Param Method With Defaults",
}
`;
@@ -487,7 +487,8 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = `
a: number,
b: string,
c: boolean,
- d: () => string
+ d: () => string,
+ e: 'a' | 'b' | string
}): number
",
@@ -528,6 +529,13 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = `
"name": "options.d",
"type": "() => string",
},
+ {
+ "default": "'a'",
+ "description": "A parameter with inline documentation.
+",
+ "name": "options.e",
+ "type": "'a' | 'b' | string",
+ },
],
"returns": "number",
"seeAlsos": [],
@@ -572,7 +580,7 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`]
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L211",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L217",
"title": "Options Type Param Method With Defaults",
}
`;
diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts
index 13372ffb..2d3010ae 100644
--- a/test/scripts/apidoc/signature.example.ts
+++ b/test/scripts/apidoc/signature.example.ts
@@ -171,6 +171,12 @@ export class SignatureTest {
b?: string;
c: boolean;
d: () => string;
+ /**
+ * A parameter with inline documentation.
+ *
+ * @default 'a'
+ */
+ e: LiteralUnion<'a' | 'b'>;
}): number {
return options.c ? options.a : +options.b;
}
--
cgit v1.2.3