diff --git a/scripts/apidoc/generate.ts b/scripts/apidoc/generate.ts
index e3047131133..aa33a46e831 100644
--- a/scripts/apidoc/generate.ts
+++ b/scripts/apidoc/generate.ts
@@ -22,14 +22,14 @@ export async function generate(): Promisebar
and baz
.",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L336",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L345",
"throws": undefined,
}
`;
@@ -325,7 +326,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "1.0.0",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L345",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L354",
"throws": undefined,
}
`;
@@ -342,7 +343,7 @@ exports[`signature > analyzeSignature() > methodWithThrows 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L287",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L296",
"throws": "a Faker error",
}
`;
@@ -491,7 +492,7 @@ It also has a more complex description.
Test with a function parameters.
+ "description": "Test with an options parameter.
", "examples": "optionsParamMethod(options: {
a: number,
@@ -552,7 +553,7 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = `
"parameters": [
{
"default": undefined,
- "description": "The function parameter.
+ "description": "The options parameter.
",
"name": "options",
"type": "{ ... }",
@@ -596,7 +597,7 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L187",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L196",
"throws": undefined,
}
`;
@@ -635,7 +636,32 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`]
"returns": "number",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L235",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L244",
+ "throws": undefined,
+}
+`;
+
+exports[`signature > analyzeSignature() > recordParamMethod 1`] = `
+{
+ "deprecated": undefined,
+ "description": "Test with a Record parameter.
+",
+ "examples": "tsrecordParamMethod(object: Record<string, number>): number
+",
+ "name": "recordParamMethod",
+ "parameters": [
+ {
+ "default": undefined,
+ "description": "The Record parameter.
+",
+ "name": "object",
+ "type": "Record",
+ },
+ ],
+ "returns": "number",
+ "seeAlsos": [],
+ "since": "",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L182",
"throws": undefined,
}
`;
diff --git a/test/scripts/apidoc/signature.debug.ts b/test/scripts/apidoc/signature.debug.ts
index 52b6976aa65..d72709b0754 100644
--- a/test/scripts/apidoc/signature.debug.ts
+++ b/test/scripts/apidoc/signature.debug.ts
@@ -11,10 +11,10 @@ import { loadExampleMethods } from './utils';
const methods = loadExampleMethods();
initMarkdownRenderer()
- .then(() => {
+ .then(async () => {
for (const [name, method] of Object.entries(methods)) {
console.log('Analyzing:', name);
- const result = analyzeSignature(method, '', method.name);
+ const result = await analyzeSignature(method, '', method.name);
console.log('Result:', result);
}
})
diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts
index a4849e304a5..724f687d3a6 100644
--- a/test/scripts/apidoc/signature.example.ts
+++ b/test/scripts/apidoc/signature.example.ts
@@ -175,9 +175,18 @@ export class SignatureTest {
}
/**
- * Test with a function parameters.
+ * Test with a Record parameter.
*
- * @param options The function parameter.
+ * @param object The Record parameter.
+ */
+ recordParamMethod(object: Record): number {
+ return object.a;
+ }
+
+ /**
+ * Test with an options parameter.
+ *
+ * @param options The options parameter.
* @param options.a The number parameter.
* @param options.b The string parameter.
* @param options.c The boolean parameter.