diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 12b5800f24ef06..22f91462ebf67f 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -567,7 +567,7 @@ await browser.close(); ```python async context = await browser.new_context() page = await context.new_page() -await context.route(r"(\.png$)|(\.jpg$)", lambda route: route.abort()) +await context.route(re.compile(r"(\.png$)|(\.jpg$)"), lambda route: route.abort()) page = await context.new_page() await page.goto("https://example.com") await browser.close() @@ -576,7 +576,7 @@ await browser.close() ```python sync context = browser.new_context() page = context.new_page() -context.route(r"(\.png$)|(\.jpg$)", lambda route: route.abort()) +context.route(re.compile(r"(\.png$)|(\.jpg$)"), lambda route: route.abort()) page = await context.new_page() page = context.new_page() page.goto("https://example.com") @@ -736,24 +736,30 @@ A glob pattern, regex pattern or predicate receiving [URL] used to register a ro Optional handler function used to register a routing with [`method: BrowserContext.route`]. ## async method: BrowserContext.waitForEvent +* langs: + - alias-python: expect_event - returns: <[any]> Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the context closes before the event is fired. Returns the event data value. ```js -const context = await browser.newContext(); -await context.grantPermissions(['geolocation']); +const [page, _] = await Promise.all([ + context.waitForEvent('page'), + page.click('button') +]); ``` ```python async -context = await browser.new_context() -await context.grant_permissions(["geolocation"]) +async with context.expect_event("page") as event_info: + await page.click("button") +page = await event_info.value ``` ```python sync -context = browser.new_context() -context.grant_permissions(["geolocation"]) +with context.expect_event("page") as event_info: + page.click("button") +page = event_info.value ``` ### param: BrowserContext.waitForEvent.event diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md index 1bf04d1d102742..38f22f31522abf 100644 --- a/docs/src/api/class-frame.md +++ b/docs/src/api/class-frame.md @@ -1135,11 +1135,13 @@ frame.wait_for_load_state() # the promise resolves after "load" event. ### option: Frame.waitForLoadState.timeout = %%-navigation-timeout-%% ## async method: Frame.waitForNavigation +* langs: + * alias-python: expect_navigation - returns: <[null]|[Response]> -Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the -last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will -resolve with `null`. +Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation +will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to +History API usage, the navigation will resolve with `null`. This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause the frame to navigate. Consider this example: diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 63432c9304e376..c9fc53ab993fe7 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -1783,14 +1783,14 @@ await browser.close(); ```python async page = await browser.new_page() -await page.route(r"(\.png$)|(\.jpg$)", lambda route: route.abort()) +await page.route(re.compile(r"(\.png$)|(\.jpg$)"), lambda route: route.abort()) await page.goto("https://example.com") await browser.close() ``` ```python sync page = browser.new_page() -page.route(r"(\.png$)|(\.jpg$)", lambda route: route.abort()) +page.route(re.compile(r"(\.png$)|(\.jpg$)"), lambda route: route.abort()) page.goto("https://example.com") browser.close() ``` @@ -2163,12 +2163,31 @@ Video object associated with this page. - `height` <[int]> page height in pixels. ## async method: Page.waitForEvent +* langs: + - alias-python: expect_event - returns: <[any]> -Returns the event data value. - Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy -value. Will throw an error if the page is closed before the event is fired. +value. Will throw an error if the page is closed before the event is fired. Returns the event data value. + +```js +const [frame, _] = await Promise.all([ + page.waitForEvent('framenavigated'), + page.click('button') +]); +``` + +```python async +async with page.expect_event("framenavigated") as event_info: + await page.click("button") +frame = await event_info.value +``` + +```python sync +with page.expect_event("framenavigated") as event_info: + page.click("button") +frame = event_info.value +``` ### param: Page.waitForEvent.event = %%-wait-for-event-event-%% @@ -2329,11 +2348,13 @@ Shortcut for main frame's [`method: Frame.waitForLoadState`]. ### option: Page.waitForLoadState.timeout = %%-navigation-timeout-%% ## async method: Page.waitForNavigation +* langs: + * alias-python: expect_navigation - returns: <[null]|[Response]> -Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the -last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will -resolve with `null`. +Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the navigation +will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to +History API usage, the navigation will resolve with `null`. This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`. @@ -2372,6 +2393,8 @@ Shortcut for main frame's [`method: Frame.waitForNavigation`]. ### option: Page.waitForNavigation.waitUntil = %%-navigation-wait-until-%% ## async method: Page.waitForRequest +* langs: + * alias-python: expect_request - returns: <[Request]> Waits for the matching request and returns it. @@ -2383,15 +2406,23 @@ return firstRequest.url(); ``` ```python async -first_request = await page.wait_for_request("http://example.com/resource") -final_request = await page.wait_for_request(lambda request: request.url == "http://example.com" and request.method == "get") -return first_request.url +async with page.expect_request("http://example.com/resource") as first: + await page.click('button') +first_request = await first.value + +async with page.expect_request(lambda request: request.url == "http://example.com" and request.method == "get") as second: + await page.click('img') +second_request = await second.value ``` ```python sync -first_request = page.wait_for_request("http://example.com/resource") -final_request = page.wait_for_request(lambda request: request.url == "http://example.com" and request.method == "get") -return first_request.url +with page.expect_request("http://example.com/resource") as first: + page.click('button') +first_request = first.value + +with page.expect_request(lambda request: request.url == "http://example.com" and request.method == "get") as second: + page.click('img') +second_request = second.value ``` ```js @@ -2410,6 +2441,8 @@ Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable t changed by using the [`method: Page.setDefaultTimeout`] method. ## async method: Page.waitForResponse +* langs: + * alias-python: expect_response - returns: <[Response]> Returns the matched response. diff --git a/docs/src/api/class-request.md b/docs/src/api/class-request.md index 97decd69f16963..c25664e8897f04 100644 --- a/docs/src/api/class-request.md +++ b/docs/src/api/class-request.md @@ -17,7 +17,6 @@ If request gets a 'redirect' response, the request is successfully finished with request is issued to a redirected url. ## method: Request.failure -* langs: js - returns: <[null]|[Object]> - `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`. diff --git a/docs/src/api/class-response.md b/docs/src/api/class-response.md index 96cd8011c34e1e..8b1519e75c1f81 100644 --- a/docs/src/api/class-response.md +++ b/docs/src/api/class-response.md @@ -8,7 +8,6 @@ Returns the buffer with response body. ## async method: Response.finished -* langs: js - returns: <[null]|[Error]> Waits for this response to finish, returns failure error if request failed. diff --git a/docs/src/api/class-websocket.md b/docs/src/api/class-websocket.md index 434e1e642fb65f..a0851f41b47cbc 100644 --- a/docs/src/api/class-websocket.md +++ b/docs/src/api/class-websocket.md @@ -34,12 +34,12 @@ Indicates that the web socket has been closed. Contains the URL of the WebSocket. ## async method: WebSocket.waitForEvent +* langs: + - alias-python: expect_event - returns: <[any]> -Returns the event data value. - Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy -value. Will throw an error if the webSocket is closed before the event is fired. +value. Will throw an error if the webSocket is closed before the event is fired. Returns the event data value. ### param: WebSocket.waitForEvent.event - `event` <[string]> diff --git a/docs/src/api/python.md b/docs/src/api/python.md index 164bcb54b5f5d0..7d81382e600d05 100644 --- a/docs/src/api/python.md +++ b/docs/src/api/python.md @@ -1,22 +1,3 @@ -## async method: Playwright.start -* langs: python - -Starts a new instance of Playwright without using the Python context manager. This is useful in REPL applications. Requires [`method: Playwright.stop`] to be called to cleanup resources. - -```py ->>> from playwright.sync_api import sync_playwright - ->>> playwright = sync_playwright().start() - ->>> browser = playwright.chromium.launch() ->>> page = browser.newPage() ->>> page.goto("http://whatsmyuseragent.org/") ->>> page.screenshot(path="example.png") ->>> browser.close() - ->>> playwright.stop() -``` - ## async method: Playwright.stop * langs: python @@ -120,160 +101,27 @@ Raw script content. * langs: python - returns: <[null]|[string]> -Returns human-readable error message, e.g. `'net::ERR_FAILED'`. The method returns `None` unless this request has -failed, as reported by `requestfailed` event. - -Example of logging of all the failed requests: - -```py -page.on('requestfailed', lambda request: print(request.url + ' ' + request.failure); -``` - ## async method: Response.finished * langs: python - returns: <[null]|[string]> -Waits for this response to finish, returns failure error if request failed. - -## async method: Page.expectEvent +## async method: Page.waitForEvent * langs: python - returns: <[EventContextManager]> +### option: Page.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% +### option: Page.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% -Performs action and waits for given `event` to fire. If predicate is provided, it passes -event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. -Will throw an error if the page is closed before the `event` is fired. - -```python async -async with page.expect_event(event_name) as event_info: - await page.click("button") -value = await event_info.value -``` - -```python sync -with page.expect_event(event_name) as event_info: - page.click("button") -value = event_info.value -``` - -### param: Page.expectEvent.event = %%-wait-for-event-event-%% -### option: Page.expectEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: Page.expectEvent.timeout = %%-python-wait-for-event-timeout-%% - -## async method: BrowserContext.expectEvent -* langs: python -- returns: <[EventContextManager]> - -Performs action and waits for given `event` to fire. If predicate is provided, it passes -event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. -Will throw an error if browser context is closed before the `event` is fired. - -```python async -async with context.expect_event("page") as event_info: - await context.click("button") -page = await event_info.value -``` - -```python sync -with context.expect_event("page") as event_info: - context.click("button") -page = event_info.value -``` - -### param: BrowserContext.expectEvent.event = %%-wait-for-event-event-%% -### option: BrowserContext.expectEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: BrowserContext.expectEvent.timeout = %%-python-wait-for-event-timeout-%% - -## async method: WebSocket.expectEvent +## async method: BrowserContext.waitForEvent * langs: python - returns: <[EventContextManager]> +### option: BrowserContext.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% +### option: BrowserContext.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% -Performs action and waits for given `event` to fire. If predicate is provided, it passes -event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. -Will throw an error if the socket is closed before the `event` is fired. - -```python async -async with ws.expect_event(event_name) as event_info: - await ws.click("button") -value = await event_info.value -``` - -```python sync -with ws.expect_event(event_name) as event_info: - ws.click("button") -value = event_info.value -``` - -### param: WebSocket.expectEvent.event = %%-wait-for-event-event-%% -### option: WebSocket.expectEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: WebSocket.expectEvent.timeout = %%-python-wait-for-event-timeout-%% - -## async method: Page.expectNavigation +## async method: WebSocket.waitForEvent * langs: python - returns: <[EventContextManager]> - -Performs action and waits for the next navigation. In case of multiple redirects, the navigation will resolve with -the response of the last redirect. In case of navigation to a different anchor or navigation due to History API -usage, the navigation will resolve with `null`. - -This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will -indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation -from a `setTimeout`. Consider this example: - -```python async -async with page.expect_navigation(): - await page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation -# Context manager waited for the navigation to happen. -``` - -```python sync -with page.expect_navigation(): - page.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation -# Context manager waited for the navigation to happen. -``` - -:::note -Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation. -::: - -Shortcut for main frame's [`method: Frame.expectNavigation`]. - -### option: Page.expectNavigation.timeout = %%-navigation-timeout-%% -### option: Page.expectNavigation.url = %%-wait-for-navigation-url-%% -### option: Page.expectNavigation.waitUntil = %%-navigation-wait-until-%% - -## async method: Frame.expectNavigation -* langs: python -- returns: <[EventContextManager[Response]]> - -Performs action and waits for the next navigation. In case of multiple redirects, the navigation will resolve with -the response of the last redirect. In case of navigation to a different anchor or navigation due to History API -usage, the navigation will resolve with `null`. - -This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will -indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation -from a `setTimeout`. Consider this example: - -```python async -async with frame.expect_navigation(): - await frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation -# Context manager waited for the navigation to happen. -``` - -```python sync -with frame.expect_navigation(): - frame.click("a.delayed-navigation") # Clicking the link will indirectly cause a navigation -# Context manager waited for the navigation to happen. -``` - -:::note -Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the -URL is considered a navigation. -::: - -### option: Frame.expectNavigation.timeout = %%-navigation-timeout-%% -### option: Frame.expectNavigation.url = %%-wait-for-navigation-url-%% -### option: Frame.expectNavigation.waitUntil = %%-navigation-wait-until-%% - +### option: WebSocket.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% +### option: WebSocket.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% ## async method: Page.expectDownload * langs: python @@ -376,46 +224,72 @@ Receives the [Page] object and resolves to truthy value when the waiting should ### option: BrowserContext.expectPage.timeout = %%-python-wait-for-event-timeout-%% +## async method: Frame.waitForNavigation +* langs: python +- returns: <[EventContextManager]<[Response]>> + +## async method: Page.waitForNavigation +* langs: python +- returns: <[EventContextManager]<[Response]>> -## async method: Page.expectRequest +## async method: Page.waitForRequest * langs: python - returns: <[EventContextManager]<[Request]>> -Performs action and waits for `response` event to fire. If predicate is provided, it passes -[Request] value into the `predicate` function and waits for `predicate(event)` to return a truthy value. -Will throw an error if the page is closed before the download event is fired. +## async method: Page.waitForResponse +* langs: python +- returns: <[EventContextManager]<[Response]>> -### param: Page.expectRequest.url_or_predicate = +## async method: BrowserContext.waitForEvent2 * langs: python -- `url_or_predicate` <[str]|[RegExp]|[function]\([Request]\):[bool]> + - alias-python: wait_for_event +- returns: <[Any]> -Receives the [Request] object and resolves to truthy value when the waiting should resolve. +:::note +In most cases, you should use [`method: WebSocket.waitForEvent`]. +::: + +Waits for given `event` to fire. If predicate is provided, it passes +event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. +Will throw an error if the socket is closed before the `event` is fired. -### option: Page.expectRequest.timeout = %%-python-wait-for-event-timeout-%% +### param: BrowserContext.waitForEvent2.event = %%-wait-for-event-event-%% +### option: BrowserContext.waitForEvent2.predicate = %%-python-wait-for-event-predicate-%% +### option: BrowserContext.waitForEvent2.timeout = %%-python-wait-for-event-timeout-%% -## async method: Page.expectResponse +## async method: Page.waitForEvent2 * langs: python -- returns: <[EventContextManager]<[Response]>> + - alias-python: wait_for_event +- returns: <[Any]> -Performs action and waits for `response` event to fire. If predicate is provided, it passes -[Response] value into the `predicate` function and waits for `predicate(event)` to return a truthy value. -Will throw an error if the page is closed before the download event is fired. +:::note +In most cases, you should use [`method: WebSocket.waitForEvent`]. +::: -### param: Page.expectResponse.url_or_predicate = -* langs: python -- `url_or_predicate` <[str]|[RegExp]|[function]\([Response]\):[bool]> +Waits for given `event` to fire. If predicate is provided, it passes +event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. +Will throw an error if the socket is closed before the `event` is fired. -Receives the [Response] object and resolves to truthy value when the waiting should resolve. +### param: Page.waitForEvent2.event = %%-wait-for-event-event-%% +### option: Page.waitForEvent2.predicate = %%-python-wait-for-event-predicate-%% +### option: Page.waitForEvent2.timeout = %%-python-wait-for-event-timeout-%% -### option: Page.expectResponse.timeout = %%-python-wait-for-event-timeout-%% +## async method: WebSocket.waitForEvent2 +* langs: python + - alias-python: wait_for_event +- returns: <[Any]> +:::note +In most cases, you should use [`method: WebSocket.waitForEvent`]. +::: -### option: BrowserContext.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: BrowserContext.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% -### option: Page.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: Page.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% -### option: WebSocket.waitForEvent.predicate = %%-python-wait-for-event-predicate-%% -### option: WebSocket.waitForEvent.timeout = %%-python-wait-for-event-timeout-%% +Waits for given `event` to fire. If predicate is provided, it passes +event's value into the `predicate` function and waits for `predicate(event)` to return a truthy value. +Will throw an error if the socket is closed before the `event` is fired. + +### param: WebSocket.waitForEvent2.event = %%-wait-for-event-event-%% +### option: WebSocket.waitForEvent2.predicate = %%-python-wait-for-event-predicate-%% +### option: WebSocket.waitForEvent2.timeout = %%-python-wait-for-event-timeout-%% ### param: ElementHandle.$eval.expression = %%-python-evaluate-expression-%% ### param: ElementHandle.$$eval.expression = %%-python-evaluate-expression-%% diff --git a/docs/src/navigations.md b/docs/src/navigations.md index 9fc233e8441e7b..8a9ada6483dfc4 100644 --- a/docs/src/navigations.md +++ b/docs/src/navigations.md @@ -208,7 +208,7 @@ page.fill("#username", "John Doe") ### Asynchronous navigation -Clicking an element could trigger asychronous processing before initiating the navigation. In these cases, it is +Clicking an element could trigger asynchronous processing before initiating the navigation. In these cases, it is recommended to explicitly call [`method: Page.waitForNavigation`]. For example: * Navigation is triggered from a `setTimeout` * Page waits for network requests before navigation diff --git a/docs/src/network.md b/docs/src/network.md index 6f6a82d22c0231..1559e654976ba5 100644 --- a/docs/src/network.md +++ b/docs/src/network.md @@ -205,7 +205,7 @@ const [response] = await Promise.all([ ``` ```python async -# Use a regular expresison +# Use a regular expression async with page.expect_response(re.compile(r"\.jpeg$")) as response_info: await page.click("button#update") response = await response_info.value @@ -217,7 +217,7 @@ response = await response_info.value ``` ```python sync -# Use a regular expresison +# Use a regular expression with page.expect_response(re.compile(r"\.jpeg$")) as response_info: page.click("button#update") response = response_info.value diff --git a/types/types.d.ts b/types/types.d.ts index 89796153c00244..b275c3c1cc2822 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -3051,9 +3051,9 @@ export interface Page { }): Promise; /** - * Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the - * last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will - * resolve with `null`. + * Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the + * navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or + * navigation due to History API usage, the navigation will resolve with `null`. * * This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly * cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from a `setTimeout`. @@ -4431,9 +4431,9 @@ export interface Frame { }): Promise; /** - * Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the - * last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will - * resolve with `null`. + * Waits for the frame navigation and returns the main resource response. In case of multiple redirects, the navigation + * will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to + * History API usage, the navigation will resolve with `null`. * * This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause * the frame to navigate. Consider this example: diff --git a/utils/doclint/api_parser.js b/utils/doclint/api_parser.js index 1d8317ecf1239e..682d20300b27b1 100644 --- a/utils/doclint/api_parser.js +++ b/utils/doclint/api_parser.js @@ -99,7 +99,15 @@ class ApiParser { member.async = true; } const clazz = this.classes.get(match[2]); - clazz.membersArray.push(member); + const existingMember = clazz.membersArray.find(m => m.name === name && m.kind === "method"); + if (existingMember) { + for (const lang of member.langs.only) { + existingMember.langs.types = existingMember.langs.types || {}; + existingMember.langs.types[lang] = returnType; + } + } else { + clazz.membersArray.push(member); + } } /** @@ -293,7 +301,8 @@ function extractLangs(spec) { } return { only: only ? only.split(',') : undefined, - aliases + aliases, + types: {} }; } return {}; diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js index 92f49c3303d849..a0a599dd799fea 100644 --- a/utils/doclint/documentation.js +++ b/utils/doclint/documentation.js @@ -34,7 +34,8 @@ const md = require('../markdown'); /** * @typedef {{ * only?: string[], - * aliases?: Object + * aliases?: Object, + * types?: Object, * }} Langs */ @@ -197,8 +198,6 @@ Documentation.Class = class { for (const member of this.membersArray) { if (member.langs.only && !member.langs.only.includes(lang)) continue; - if (member.langs.aliases && member.langs.aliases[lang]) - member.alias = member.langs.aliases[lang]; member.filterForLanguage(lang); membersArray.push(member); } @@ -312,6 +311,11 @@ Documentation.Member = class { * @param {string} lang */ filterForLanguage(lang) { + if (this.langs.aliases && this.langs.aliases[lang]) + this.alias = this.langs.aliases[lang]; + if (this.langs.types && this.langs.types[lang]) + this.type = this.langs.types[lang]; + this.type.filterForLanguage(lang); const argsArray = []; for (const arg of this.argsArray) { if (arg.langs.only && !arg.langs.only.includes(lang)) diff --git a/utils/doclint/generateApiJson.js b/utils/doclint/generateApiJson.js index 4eeae947b31e5a..55e328bfce307c 100644 --- a/utils/doclint/generateApiJson.js +++ b/utils/doclint/generateApiJson.js @@ -53,6 +53,10 @@ function serializeClass(clazz) { if (clazz.extends) result.extends = clazz.extends; result.langs = clazz.langs; + if (result.langs && result.langs.types) { + for (const key in result.langs.types) + result.langs.types[key] = serializeType(result.langs.types[key]); + } if (clazz.comment) result.comment = clazz.comment; result.members = clazz.membersArray.map(serializeMember);