From 16383bbed55f3fdea8958f013f92f4fe9550d8cb Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 24 Mar 2023 10:12:58 +0100 Subject: docs: mark deprecated parameter options (#1962) --- .../apidoc/__snapshots__/signature.spec.ts.snap | 62 ++++++++++++++++++++-- test/scripts/apidoc/signature.example.ts | 29 ++++++++++ 2 files changed, 87 insertions(+), 4 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 e7add7c6..533d13da 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#L301", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L330", "title": "Complex Array Parameter", } `; @@ -82,6 +82,7 @@ exports[`signature > analyzeSignature() > expected and actual methods are equal "functionParamMethod", "literalUnionParamMethod", "methodWithDeprecated", + "methodWithDeprecatedOption", "methodWithExample", "methodWithMultipleSeeMarkers", "methodWithMultipleSeeMarkersAndBackticks", @@ -206,6 +207,59 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = ` } `; +exports[`signature > analyzeSignature() > methodWithDeprecatedOption 1`] = ` +{ + "deprecated": undefined, + "description": "

Test with deprecated option.

+", + "examples": "
ts
faker.methodWithDeprecatedOption(option: {
+  a: string,
+  b: () => number,
+  c: number
+}): number
+
+
", + "name": "methodWithDeprecatedOption", + "parameters": [ + { + "default": undefined, + "description": "

The options.

+", + "name": "option", + "type": "{ ... }", + }, + { + "default": undefined, + "description": "

Some deprecated option.

+

DEPRECATED: do something else.

+", + "name": "option.a", + "type": "string", + }, + { + "default": undefined, + "description": "

Some other deprecated option.

+

DEPRECATED: do something else.

+", + "name": "option.b", + "type": "() => number", + }, + { + "default": undefined, + "description": "

Some other option.

+", + "name": "option.c", + "type": "number", + }, + ], + "returns": "number", + "seeAlsos": [], + "since": "", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L272", + "title": "Method With Deprecated Option", +} +`; + exports[`signature > analyzeSignature() > methodWithExample 1`] = ` { "deprecated": undefined, @@ -241,7 +295,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = ` "test.apidoc.methodWithDeprecated()", ], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L270", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L299", "title": "Method With Multiple See Markers", } `; @@ -262,7 +316,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic "test.apidoc.methodWithDeprecated() with parameter bar and baz.", ], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L280", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L309", "title": "Method With Multiple See Markers And Backticks", } `; @@ -280,7 +334,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = ` "returns": "number", "seeAlsos": [], "since": "1.0.0", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L289", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L318", "title": "Method With Since Marker", } `; diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 2d3010ae..1013365f 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -261,6 +261,35 @@ export class SignatureTest { return 0; } + /** + * Test with deprecated option. + * + * @param option The options. + * @param option.a Some deprecated option. + * @param option.b Some other deprecated option. + * @param option.c Some other option. + */ + methodWithDeprecatedOption(option: { + /** + * Some deprecated option. + * + * @deprecated do something else. + */ + a: string; + /** + * Some other deprecated option. + * + * @deprecated do something else. + */ + b: () => number; + /** + * Some other option. + */ + c: number; + }): number { + return option.c; + } + /** * Test with multiple see markers. * -- cgit v1.2.3