Skip to content

Commit 14a3431

Browse files
committed
chore: filter async apis to print once
1 parent 69d5f05 commit 14a3431

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

etc/print_async_api.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
const { stat, readFile, writeFile } = require('fs/promises');
77
const { join: joinPath } = require('path');
88
const { spawn } = require('child_process');
9-
const typescript = require('typescript');
109

1110
class APIPrinterError extends Error {}
1211

@@ -54,11 +53,11 @@ async function getDriverAPI() {
5453
async function main() {
5554
const api = await getDriverAPI();
5655

57-
console.log(api.name);
5856
const packageMembers = api.members[0].members;
5957

6058
for (const classDescription of packageMembers.filter(m => m.kind === 'Class')) {
6159
const className = classDescription.name;
60+
const methodsPrinted = new Set();
6261
for (const methodDescription of classDescription.members.filter(m => m.kind === 'Method')) {
6362
/** @type {string} */
6463
const returnType = methodDescription.excerptTokens
@@ -68,7 +67,8 @@ async function main() {
6867
)
6968
.map(token => token.text.replaceAll('\n', '').replace(/\s\s+/g, ' '))
7069
.join('');
71-
if (returnType.includes('Promise')) {
70+
if (returnType.includes('Promise<') && !methodsPrinted.has(methodDescription.name)) {
71+
methodsPrinted.add(methodDescription.name);
7272
const apiString = `${className}.${methodDescription.name}(): ${returnType}`;
7373
console.log(apiString);
7474
}

0 commit comments

Comments
 (0)