From 0dfe9a3bd457b8ceaabd20e67a2a71a6a2cabc9a Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 8 Apr 2022 20:06:01 +0200 Subject: docs: nice string literals (#814) --- test/scripts/apidoc/signature.example.ts | 9 +++++++++ test/scripts/apidoc/signature.expected.json | 20 ++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'test/scripts') diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 2219b072..de1cd79a 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -115,6 +115,15 @@ export class SignatureTest { return fn('a'); } + /** + * Test with string union. + * + * @param value `'a'` or `'b'`. + */ + stringUnionParamMethod(value: 'a' | 'b'): string { + return value; + } + /** * Test with LiteralUnion. * diff --git a/test/scripts/apidoc/signature.expected.json b/test/scripts/apidoc/signature.expected.json index 5e4f913a..32920f78 100644 --- a/test/scripts/apidoc/signature.expected.json +++ b/test/scripts/apidoc/signature.expected.json @@ -39,12 +39,12 @@ "parameters": [ { "name": "value", - "type": "\"a\" | \"b\" | string", + "type": "'a' | 'b' | string", "description": "

'a' or 'b'.

\n" } ], "returns": "string", - "examples": "
faker.literalUnionParamMethod(value: \"a\" | \"b\" | string): string\n
\n
", + "examples": "
faker.literalUnionParamMethod(value: 'a' | 'b' | string): string\n
\n
", "deprecated": false, "seeAlsos": [] }, @@ -272,5 +272,21 @@ "examples": "
faker.requiredNumberParamMethod(a: number): number\n
\n
", "deprecated": false, "seeAlsos": [] + }, + "stringUnionParamMethod": { + "name": "stringUnionParamMethod", + "title": "String Union Param Method", + "description": "

Test with string union.

\n", + "parameters": [ + { + "name": "value", + "type": "'a' | 'b'", + "description": "

'a' or 'b'.

\n" + } + ], + "returns": "string", + "examples": "
faker.stringUnionParamMethod(value: 'a' | 'b'): string\n
\n
", + "deprecated": false, + "seeAlsos": [] } } -- cgit v1.2.3