diff options
| author | ST-DDT <[email protected]> | 2023-01-21 20:38:51 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-01-21 19:38:51 +0000 |
| commit | f839ae23270773b476ee39610a0b399e1432bac7 (patch) | |
| tree | 79bfa17779fbd6e7abdefcfbf040bab1166f6583 /test/scripts | |
| parent | 440325eb0f53d6fd1c13e2c955984accd8f76143 (diff) | |
| download | faker-f839ae23270773b476ee39610a0b399e1432bac7.tar.xz faker-f839ae23270773b476ee39610a0b399e1432bac7.zip | |
docs: unwrap complex array params (#1753)
Diffstat (limited to 'test/scripts')
| -rw-r--r-- | test/scripts/apidoc/__snapshots__/signature.spec.ts.snap | 46 | ||||
| -rw-r--r-- | test/scripts/apidoc/signature.example.ts | 23 |
2 files changed, 69 insertions, 0 deletions
diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap index 1a3612da..0d34cb7a 100644 --- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap +++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap @@ -1,5 +1,50 @@ // Vitest Snapshot v1 +exports[`signature > analyzeSignature() > complexArrayParameter 1`] = ` +{ + "deprecated": false, + "description": "<p>Complex array parameter.</p> +", + "examples": "<div class=\\"language-ts\\"><button title=\\"Copy Code\\" class=\\"copy\\"></button><span class=\\"lang\\">ts</span><pre v-pre class=\\"shiki material-palenight\\"><code><span class=\\"line\\"><span style=\\"color:#A6ACCD\\">faker</span><span style=\\"color:#89DDFF\\">.</span><span style=\\"color:#82AAFF\\">complexArrayParameter</span><span style=\\"color:#89DDFF\\"><</span><span style=\\"color:#FFCB6B\\">T</span><span style=\\"color:#89DDFF\\">></span><span style=\\"color:#A6ACCD\\">(array: readonly Object[]): T</span></span> +<span class=\\"line\\"></span></code></pre> +</div>", + "name": "complexArrayParameter", + "parameters": [ + { + "description": "<p>The type of the entries to pick from.</p> +", + "name": "<T>", + "type": undefined, + }, + { + "default": undefined, + "description": "<p>Array to pick the value from.</p> +", + "name": "array", + "type": "readonly Object[]", + }, + { + "default": undefined, + "description": "<p>The value to pick.</p> +", + "name": "array[].value", + "type": "T", + }, + { + "default": undefined, + "description": "<p>The weight of the value.</p> +", + "name": "array[].weight", + "type": "number", + }, + ], + "returns": "T", + "seeAlsos": [], + "since": "", + "title": "Complex Array Parameter", +} +`; + exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = ` { "deprecated": false, @@ -27,6 +72,7 @@ exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = ` exports[`signature > analyzeSignature() > expected and actual methods are equal 1`] = ` [ + "complexArrayParameter", "defaultBooleanParamMethod", "functionParamMethod", "literalUnionParamMethod", diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 83bf5ce3..2c93b1af 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -259,4 +259,27 @@ export class SignatureTest { methodWithSinceMarker(): number { return 0; } + + /** + * Complex array parameter. + * + * @template T The type of the entries to pick from. + * @param array Array to pick the value from. + * @param array[].weight The weight of the value. + * @param array[].value The value to pick. + */ + complexArrayParameter<T>( + array: ReadonlyArray<{ + /** + * The weight of the value. + */ + weight: number; + /** + * The value to pick. + */ + value: T; + }> + ): T { + return array[0].value; + } } |
