fix(types): allow evaluate functions to take a readonly array as an argument (#7072)
This commit is contained in:
parent
723052d5bb
commit
491614c7f8
@ -54,7 +54,7 @@ export type Serializable =
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type JSONArray = Serializable[];
|
||||
export type JSONArray = readonly Serializable[];
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
@ -79,6 +79,17 @@ describe('Frame specs', function () {
|
||||
'Execution context is not available in detached frame'
|
||||
);
|
||||
});
|
||||
|
||||
it('allows readonly array to be an argument', async () => {
|
||||
const { page, server } = getTestState();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const mainFrame = page.mainFrame();
|
||||
|
||||
// This test checks if Frame.evaluate allows a readonly array to be an argument.
|
||||
// See https://github.com/puppeteer/puppeteer/issues/6953.
|
||||
const readonlyArray: readonly string[] = ['a', 'b', 'c'];
|
||||
mainFrame.evaluate((arr) => arr, readonlyArray);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Frame Management', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user