From d48b321f4a8233a43cc0a36862ab644aa8fee660 Mon Sep 17 00:00:00 2001 From: Markus Greystone Date: Thu, 26 Feb 2026 12:27:59 -0500 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74483=20Update?= =?UTF-8?q?=20types=20for=20whatwg-mimetype=20v5=20by=20@mgreystone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/data-urls/package.json | 2 +- types/whatwg-mimetype/index.d.ts | 30 +++++++++++-- types/whatwg-mimetype/package.json | 2 +- .../whatwg-mimetype/whatwg-mimetype-tests.ts | 44 ++++++++++++++++++- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/types/data-urls/package.json b/types/data-urls/package.json index 4ae82e617ba777..b39cd9a5bcc27a 100644 --- a/types/data-urls/package.json +++ b/types/data-urls/package.json @@ -6,7 +6,7 @@ "https://github.com/jsdom/data-urls#readme" ], "dependencies": { - "@types/whatwg-mimetype": "*", + "@types/whatwg-mimetype": "<=3.0.0", "@types/whatwg-url": "*" }, "devDependencies": { diff --git a/types/whatwg-mimetype/index.d.ts b/types/whatwg-mimetype/index.d.ts index f47af944d0d150..fe1d1c7dab3c70 100644 --- a/types/whatwg-mimetype/index.d.ts +++ b/types/whatwg-mimetype/index.d.ts @@ -1,5 +1,3 @@ -export = MIMEType; - /** * This class will parse [MIME types](https://mimesniff.spec.whatwg.org/#understanding-mime-types) into a * structured format, which can then be manipulated and serialized. @@ -23,7 +21,7 @@ export = MIMEType; * console.assert(mimeType.isHTML() === true); * console.assert(mimeType.isXML() === false); */ -declare class MIMEType { +export class MIMEType { /** * the MIME type's [type](https://mimesniff.spec.whatwg.org/#mime-type-type), e.g. `"text"` */ @@ -75,7 +73,7 @@ declare class MIMEType { isJavaScript(opts?: { prohibitParameters?: boolean | undefined }): boolean; } -declare namespace MIMEType { +export namespace MIMEType { /** * The `MIMETypeParameters` class, instances of which are returned by `mimeType.parameters`, has equivalent * surface API to a [JavaScript `Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map). @@ -121,3 +119,27 @@ declare namespace MIMEType { [Symbol.iterator](): IterableIterator<[string, string]>; } } + +/** + * Determine the computed MIME type of a resource. + * https://mimesniff.spec.whatwg.org/#determining-the-computed-mime-type-of-a-resource + * + * @param resource - The resource bytes + * @returns The computed MIME type + */ +export function computedMIMEType( + resource: Uint8Array, + options?: { + /** The Content-Type header value (for HTTP resources) */ + contentTypeHeader?: string; + + /** MIME type from filesystem or other protocol (for non-HTTP resources) */ + providedType?: string; + + /** Whether the X-Content-Type-Options: nosniff header was present */ + noSniff?: boolean; + + /** Predicate to check if an image/audio/video MIME type is supported */ + isSupported?: (mimeType: MIMEType) => boolean; + }, +): MIMEType; diff --git a/types/whatwg-mimetype/package.json b/types/whatwg-mimetype/package.json index 18b2ee892a89d1..d679cd57b152eb 100644 --- a/types/whatwg-mimetype/package.json +++ b/types/whatwg-mimetype/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/whatwg-mimetype", - "version": "3.0.9999", + "version": "5.0.9999", "projects": [ "https://github.com/jsdom/whatwg-mimetype#readme" ], diff --git a/types/whatwg-mimetype/whatwg-mimetype-tests.ts b/types/whatwg-mimetype/whatwg-mimetype-tests.ts index b3759af4193824..f9a07e523e5f5a 100644 --- a/types/whatwg-mimetype/whatwg-mimetype-tests.ts +++ b/types/whatwg-mimetype/whatwg-mimetype-tests.ts @@ -1,4 +1,4 @@ -import MIMEType = require("whatwg-mimetype"); +import { computedMIMEType, MIMEType } from "whatwg-mimetype"; // test type exports type MT = MIMEType; @@ -39,3 +39,45 @@ if (mt != null) { mt.parameters.entries(); // $ExpectType IterableIterator<[string, string]> mt.parameters[Symbol.iterator](); // $ExpectType IterableIterator<[string, string]> } + +// test computedMIMEType function +const resource = new Uint8Array([0x00, 0x01, 0x02]); + +// Test basic call with resource only +computedMIMEType(resource); // $ExpectType MIMEType + +// Test with all options provided +// $ExpectType MIMEType +computedMIMEType(resource, { + contentTypeHeader: "text/html", + providedType: "text/plain", + noSniff: true, + isSupported: (mimeType: MIMEType) => true, +}); + +// Test with partial options +computedMIMEType(resource, { contentTypeHeader: "text/html" }); // $ExpectType MIMEType +computedMIMEType(resource, { providedType: "text/plain" }); // $ExpectType MIMEType +computedMIMEType(resource, { noSniff: false }); // $ExpectType MIMEType +// +// $ExpectType MIMEType +computedMIMEType(resource, { + isSupported: (mimeType) => { + mimeType; // $ExpectType MIMEType + return false; + }, +}); + +// Test that invalid parameters are rejected +// @ts-expect-error +computedMIMEType(); +// @ts-expect-error +computedMIMEType("not a Uint8Array"); +// @ts-expect-error +computedMIMEType(resource, { invalidOption: true }); +// @ts-expect-error +computedMIMEType(resource, { contentTypeHeader: 123 }); +// @ts-expect-error +computedMIMEType(resource, { noSniff: "true" }); +// @ts-expect-error +computedMIMEType(resource, { isSupported: "not a function" }); From 97f31a6b2415956dc41bab27b9c95226682f2b03 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 26 Feb 2026 12:41:24 -0500 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74542=20Fix=20?= =?UTF-8?q?dagre=20graph=20successors=20type=20to=20return=20a=20string=20?= =?UTF-8?q?array=20by=20@tvelich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/dagre/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dagre/index.d.ts b/types/dagre/index.d.ts index d669fecccba42a..dc31d35ac26ba6 100644 --- a/types/dagre/index.d.ts +++ b/types/dagre/index.d.ts @@ -39,7 +39,7 @@ export namespace graphlib { setParent(childName: string, parentName: string): void; sinks(): string[]; sources(): string[]; - successors(name: string): Array> | undefined; + successors(name: string): string[] | undefined; } namespace json { From 1f049455526b369aa360d2015f6940adeb18e511 Mon Sep 17 00:00:00 2001 From: Aaron Burmeister <48975739+aaronburmeister@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:03:22 -0700 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74589=20[aws-l?= =?UTF-8?q?ambda]=20Add=20Cognito=20InboundFederation=20trigger=20types=20?= =?UTF-8?q?by=20@aaronburmeister?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/aws-lambda/test/cognito-tests.ts | 32 ++++++++++++++- .../inbound-federation.d.ts | 40 +++++++++++++++++++ .../cognito-user-pool-trigger/index.d.ts | 4 +- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 types/aws-lambda/trigger/cognito-user-pool-trigger/inbound-federation.d.ts diff --git a/types/aws-lambda/test/cognito-tests.ts b/types/aws-lambda/test/cognito-tests.ts index 9ea643d30090f4..058bb6fdc52cb1 100644 --- a/types/aws-lambda/test/cognito-tests.ts +++ b/types/aws-lambda/test/cognito-tests.ts @@ -9,6 +9,8 @@ import { DefineAuthChallengeTriggerEvent, DefineAuthChallengeTriggerHandler, Handler, + InboundFederationTriggerEvent, + InboundFederationTriggerHandler, PostAuthenticationTriggerEvent, PostAuthenticationTriggerHandler, PostConfirmationTriggerEvent, @@ -42,7 +44,8 @@ type CognitoTriggerEvent = | PreTokenGenerationV3TriggerEvent | UserMigrationTriggerEvent | CustomMessageTriggerEvent - | CustomEmailSenderTriggerEvent; + | CustomEmailSenderTriggerEvent + | InboundFederationTriggerEvent; const baseTest: Handler = async (event: CognitoTriggerEvent, _, callback) => { str = event.version; @@ -399,3 +402,30 @@ const customSmsSender: CustomSMSSenderTriggerHandler = async (event, _, callback triggerSource === "CustomSMSSender_SignUp"; triggerSource === "CustomSMSSender_Authentication"; }; + +const inboundFederation: InboundFederationTriggerHandler = async (event, _, callback) => { + const { request, response, triggerSource } = event; + + str = request.providerName; + str = request.providerType; + request.providerType === "OIDC"; + request.providerType === "SAML"; + request.providerType === "Facebook"; + request.providerType === "Google"; + request.providerType === "SignInWithApple"; + request.providerType === "LoginWithAmazon"; + + objectOrUndefined = request.attributes.tokenResponse; + objectOrUndefined = request.attributes.idToken; + objectOrUndefined = request.attributes.userInfo; + objectOrUndefined = request.attributes.samlResponse; + strOrUndefined = request.attributes.idToken?.["email"]; + strOrUndefined = request.attributes.samlResponse?.["given_name"]; + + obj = response.userAttributesToMap; + str = response.userAttributesToMap["email"]; + response.userAttributesToMap = {}; + response.userAttributesToMap = { email: "user@example.com", given_name: "Jane" }; + + triggerSource === "InboundFederation_ExternalProvider"; +}; diff --git a/types/aws-lambda/trigger/cognito-user-pool-trigger/inbound-federation.d.ts b/types/aws-lambda/trigger/cognito-user-pool-trigger/inbound-federation.d.ts new file mode 100644 index 00000000000000..3c9ac688f2e70c --- /dev/null +++ b/types/aws-lambda/trigger/cognito-user-pool-trigger/inbound-federation.d.ts @@ -0,0 +1,40 @@ +import { Handler } from "../../handler"; +import { BaseTriggerEvent, StringMap } from "./_common"; + +export type InboundFederationProviderType = + | "OIDC" + | "SAML" + | "Facebook" + | "Google" + | "SignInWithApple" + | "LoginWithAmazon"; + +/** + * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-inbound-federation.html + */ +export interface InboundFederationTriggerEvent extends BaseTriggerEvent<"InboundFederation_ExternalProvider"> { + request: { + providerName: string; + providerType: InboundFederationProviderType; + attributes: { + /** OAuth token response. Present for OIDC and social providers. */ + tokenResponse?: StringMap | undefined; + /** Decoded JWT claims. Present for OIDC and social providers. */ + idToken?: StringMap | undefined; + /** Extended profile info. Present for OIDC and social providers. */ + userInfo?: StringMap | undefined; + /** SAML assertion attributes. Present for SAML providers. */ + samlResponse?: StringMap | undefined; + }; + }; + response: { + /** + * User attributes to apply to the user profile. + * All attributes to be retained must be included; omitted attributes are dropped. + * Return an empty object `{}` to retain all original attributes unchanged. + */ + userAttributesToMap: StringMap; + }; +} + +export type InboundFederationTriggerHandler = Handler; diff --git a/types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts b/types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts index 1b21770b6aae19..2e5a7796cd97a2 100644 --- a/types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +++ b/types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts @@ -32,7 +32,8 @@ export interface CognitoUserPoolTriggerEvent { | "TokenGeneration_RefreshTokens" | "TokenGeneration_ClientCredentials" | "UserMigration_Authentication" - | "UserMigration_ForgotPassword"; + | "UserMigration_ForgotPassword" + | "InboundFederation_ExternalProvider"; region: string; userPoolId: string; userName?: string | undefined; @@ -119,6 +120,7 @@ export * from "./custom-email-sender"; export * from "./custom-message"; export * from "./custom-sms-sender"; export * from "./define-auth-challenge"; +export * from "./inbound-federation"; export * from "./post-authentication"; export * from "./post-confirmation"; export * from "./pre-authentication"; From f43107da9566bb2dab17b8bb0e58abcd5c0f84f6 Mon Sep 17 00:00:00 2001 From: YevheniiKotyrlo <44449990+YevheniiKotyrlo@users.noreply.github.com> Date: Thu, 26 Feb 2026 20:17:58 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74581=20[node]?= =?UTF-8?q?=20ProcessEnv:=20remove=20TZ=20property,=20fall=20back=20to=20i?= =?UTF-8?q?ndex=20signature=20by=20@YevheniiKotyrlo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/process.d.ts | 7 +------ types/node/v20/process.d.ts | 7 +------ types/node/v22/process.d.ts | 7 +------ types/node/v24/process.d.ts | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/types/node/process.d.ts b/types/node/process.d.ts index 6974c48e4b70d2..fea9dd5e9a7d81 100644 --- a/types/node/process.d.ts +++ b/types/node/process.d.ts @@ -465,12 +465,7 @@ declare module "node:process" { isTTY?: true | undefined; } // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string | undefined; - } + interface ProcessEnv extends Dict {} interface HRTime { /** * This is the legacy version of {@link process.hrtime.bigint()} diff --git a/types/node/v20/process.d.ts b/types/node/v20/process.d.ts index a120b0e5b4c678..1d5b73885d7f17 100644 --- a/types/node/v20/process.d.ts +++ b/types/node/v20/process.d.ts @@ -321,12 +321,7 @@ declare module "process" { isTTY?: true | undefined; } // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string | undefined; - } + interface ProcessEnv extends Dict {} interface HRTime { /** * This is the legacy version of {@link process.hrtime.bigint()} diff --git a/types/node/v22/process.d.ts b/types/node/v22/process.d.ts index 8dd1d1de61c057..1073839889c2de 100644 --- a/types/node/v22/process.d.ts +++ b/types/node/v22/process.d.ts @@ -346,12 +346,7 @@ declare module "process" { isTTY?: true | undefined; } // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string | undefined; - } + interface ProcessEnv extends Dict {} interface HRTime { /** * This is the legacy version of {@link process.hrtime.bigint()} diff --git a/types/node/v24/process.d.ts b/types/node/v24/process.d.ts index b6576885a98324..509a3077f05c40 100644 --- a/types/node/v24/process.d.ts +++ b/types/node/v24/process.d.ts @@ -344,12 +344,7 @@ declare module "process" { isTTY?: true | undefined; } // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string | undefined; - } + interface ProcessEnv extends Dict {} interface HRTime { /** * This is the legacy version of {@link process.hrtime.bigint()} From c83706e28361b3631bb31e03fdadd7dc18b3fd52 Mon Sep 17 00:00:00 2001 From: David Chesnut Date: Thu, 26 Feb 2026 10:24:22 -0800 Subject: [PATCH 5/7] [office-js,office-js-preview] Update based on autoopen change (#74585) --- types/office-js-preview/index.d.ts | 2 ++ types/office-js/index.d.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index fa8f8fc78baab0..9ec79da1d451c2 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -3331,6 +3331,8 @@ declare namespace Office { * @returns A promise that is resolved when the UI is shown. * * @remarks + * This method applies only to centrally deployed or sideloaded add-ins. For add-ins published in the Microsoft Marketplace, the method is ignored and the task pane doesn't open. + * * **Requirement set**: {@link https://learn.microsoft.com/javascript/api/requirement-sets/common/shared-runtime-requirement-sets | SharedRuntime 1.1} */ showAsTaskpane(): Promise; diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 0fba69269f5689..972b1bb16843db 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -3331,6 +3331,8 @@ declare namespace Office { * @returns A promise that is resolved when the UI is shown. * * @remarks + * This method applies only to centrally deployed or sideloaded add-ins. For add-ins published in the Microsoft Marketplace, the method is ignored and the task pane doesn't open. + * * **Requirement set**: {@link https://learn.microsoft.com/javascript/api/requirement-sets/common/shared-runtime-requirement-sets | SharedRuntime 1.1} */ showAsTaskpane(): Promise; From beb472ce1cf69149088e675b1a6349980551e46e Mon Sep 17 00:00:00 2001 From: Tiago Sanona <40792244+tsanona@users.noreply.github.com> Date: Thu, 26 Feb 2026 20:30:09 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74573=20add=20?= =?UTF-8?q?throttle=20and=20retry=20types=20for=20hafas-client=20by=20@tsa?= =?UTF-8?q?nona?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/hafas-client/retry.d.ts | 31 +++++++++++++++++++++++++++++++ types/hafas-client/throttle.d.ts | 9 +++++++++ types/hafas-client/tsconfig.json | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 types/hafas-client/retry.d.ts create mode 100644 types/hafas-client/throttle.d.ts diff --git a/types/hafas-client/retry.d.ts b/types/hafas-client/retry.d.ts new file mode 100644 index 00000000000000..f189983d24f758 --- /dev/null +++ b/types/hafas-client/retry.d.ts @@ -0,0 +1,31 @@ +import { Profile } from "."; + +/** + * Retry options. + * + * Further opts could be used. Check {@link https://github.com/sindresorhus/p-retry | p-retry} for more info. + */ +export interface RetryOpts { + /** + * The maximum amount of times to retry the operation. + * @default 3 + */ + retries?: number; + /** + * The exponential factor to use. + * @default 3 + */ + factor?: number; + /** + * The number of milliseconds before starting the first retry. + * @default 5000 + */ + minTimeout?: number; +} + +/** + * Use {@link Profile} opt-in for retrying failed requests to the endpoint. + * @param profile - The base {@link Profile} + * @param retryOpts - The {@link RetryOpts} + */ +export function withRetrying(profile: Profile, retryOpts?: RetryOpts): Profile; diff --git a/types/hafas-client/throttle.d.ts b/types/hafas-client/throttle.d.ts new file mode 100644 index 00000000000000..1fa67800c3071a --- /dev/null +++ b/types/hafas-client/throttle.d.ts @@ -0,0 +1,9 @@ +import { Profile } from "."; + +/** + * Use {@link Profile} opt-in for throttling requests to the endpoint. + * @param profile - The base {@link Profile} + * @param [limit=5] - The maximum number of calls within an {@link interval}. + * @param [interval=1000] - The timespan for {@link limit} in milliseconds. + */ +export function withThrottling(profile: Profile, limit?: number, interval?: number): Profile; diff --git a/types/hafas-client/tsconfig.json b/types/hafas-client/tsconfig.json index 6fc5b3e7fe8abc..d995984f2dd97a 100644 --- a/types/hafas-client/tsconfig.json +++ b/types/hafas-client/tsconfig.json @@ -15,6 +15,8 @@ }, "files": [ "index.d.ts", + "throttle.d.ts", + "retry.d.ts", "hafas-client-tests.ts" ] } From 1d3f350f334edd444f4d500ca8911e355e28b965 Mon Sep 17 00:00:00 2001 From: Toberumono Date: Thu, 26 Feb 2026 14:40:40 -0600 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74594=20[@word?= =?UTF-8?q?press/block-editor]=20Updating=20the=20Store=20object=20to=20ma?= =?UTF-8?q?tch=20official=20maintainer=20commentary=20by=20@Toberumono?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/wordpress__block-editor/index.d.ts | 17 +- .../wordpress__block-editor-tests.tsx | 184 +++++++++++++++--- 2 files changed, 167 insertions(+), 34 deletions(-) diff --git a/types/wordpress__block-editor/index.d.ts b/types/wordpress__block-editor/index.d.ts index c027d065c5fb58..05dc00f90f9c05 100644 --- a/types/wordpress__block-editor/index.d.ts +++ b/types/wordpress__block-editor/index.d.ts @@ -1,5 +1,5 @@ import { BlockIconNormalized } from "@wordpress/blocks"; -import { dispatch, select, StoreDescriptor } from "@wordpress/data"; +import { ReduxStoreConfig, StoreDescriptor } from "@wordpress/data"; export * from "./components"; export * from "./hooks"; @@ -8,14 +8,27 @@ export { SETTINGS_DEFAULTS } from "./store/defaults"; export * from "./utils"; declare module "@wordpress/data" { + /** + * @deprecated Use the version that takes a store descriptor object instead + */ function dispatch(key: "core/block-editor"): typeof import("./store/actions"); + /** + * @deprecated Use the version that takes a store descriptor object instead + */ function select(key: "core/block-editor"): typeof import("./store/selectors"); function useDispatch(key: "core/block-editor"): typeof import("./store/actions"); function useSelect(key: "core/block-editor"): typeof import("./store/selectors"); } -export interface BlockEditorStoreDescriptor extends StoreDescriptor { +type Decurry any }> = { + [key in keyof S]: (state: any, ...args: Parameters) => ReturnType; +}; +export interface BlockEditorStoreDescriptor extends + StoreDescriptor< + ReduxStoreConfig> + > +{ name: "core/block-editor"; } diff --git a/types/wordpress__block-editor/wordpress__block-editor-tests.tsx b/types/wordpress__block-editor/wordpress__block-editor-tests.tsx index 23100d4d0e1511..00564355c45acc 100644 --- a/types/wordpress__block-editor/wordpress__block-editor-tests.tsx +++ b/types/wordpress__block-editor/wordpress__block-editor-tests.tsx @@ -600,41 +600,161 @@ for (const dispatchOrUseDispatch of [dispatch, useDispatch]) { }); } -// $ExpectType boolean -select("core/block-editor").canInsertBlockType("core/paragraph"); -select("core/block-editor").canInsertBlockType("core/paragraph", "foo"); - -// $ExpectType boolean -useSelect("core/block-editor").canInsertBlockType("core/paragraph"); -useSelect("core/block-editor").canInsertBlockType("core/paragraph", "foo"); - -// $ExpectType string | null -select("core/block-editor").getAdjacentBlockClientId(); -select("core/block-editor").getAdjacentBlockClientId("foo"); -select("core/block-editor").getAdjacentBlockClientId("foo", -1); -select("core/block-editor").getAdjacentBlockClientId("foo", 1); - -// $ExpectType string | null -useSelect("core/block-editor").getAdjacentBlockClientId(); -useSelect("core/block-editor").getAdjacentBlockClientId("foo"); -useSelect("core/block-editor").getAdjacentBlockClientId("foo", -1); -useSelect("core/block-editor").getAdjacentBlockClientId("foo", 1); +for (const dispatchOrUseDispatch of [dispatch, useDispatch]) { + // $ExpectType Promise + dispatchOrUseDispatch(be.store).insertBlock(BLOCK_INSTANCE); + dispatchOrUseDispatch(be.store).insertBlock(BLOCK_INSTANCE, 4); + dispatchOrUseDispatch(be.store).insertBlock(BLOCK_INSTANCE, 4, "foo"); + dispatchOrUseDispatch(be.store).insertBlock(BLOCK_INSTANCE, 4, "foo", false); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).insertBlocks([BLOCK_INSTANCE]); + dispatchOrUseDispatch(be.store).insertBlocks([BLOCK_INSTANCE], 5); + dispatchOrUseDispatch(be.store).insertBlocks([BLOCK_INSTANCE], 5, "foo"); + dispatchOrUseDispatch(be.store).insertBlocks([BLOCK_INSTANCE], 5, "foo", false); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).insertDefaultBlock(); + dispatchOrUseDispatch(be.store).insertDefaultBlock({ foo: "bar" }); + dispatchOrUseDispatch(be.store).insertDefaultBlock({ foo: "bar" }, "foo"); + dispatchOrUseDispatch(be.store).insertDefaultBlock({ foo: "bar" }, "foo", 5); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).mergeBlocks("foo", "bar"); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).moveBlocksUp("foo", "bar"); + dispatchOrUseDispatch(be.store).moveBlocksUp(["foo", "baz"], "bar"); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).moveBlockToPosition("foo", "bar", "baz", 1); + dispatchOrUseDispatch(be.store).moveBlockToPosition(undefined, "foo", undefined, 5); + dispatchOrUseDispatch(be.store).moveBlockToPosition(undefined, undefined, undefined, 5); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).multiSelect("foo", "bar"); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).receiveBlocks([BLOCK_INSTANCE]); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).removeBlock("foo"); + dispatchOrUseDispatch(be.store).removeBlock("foo", true); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).removeBlocks("foo"); + dispatchOrUseDispatch(be.store).removeBlocks("foo", false); + dispatchOrUseDispatch(be.store).removeBlocks(["foo"]); + dispatchOrUseDispatch(be.store).removeBlocks(["foo"], false); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).replaceBlock("foo", BLOCK_INSTANCE); + dispatchOrUseDispatch(be.store).replaceBlock("foo", [BLOCK_INSTANCE]); + dispatchOrUseDispatch(be.store).replaceBlock(["foo"], BLOCK_INSTANCE); + dispatchOrUseDispatch(be.store).replaceBlock(["foo"], [BLOCK_INSTANCE]); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).replaceBlocks("foo", BLOCK_INSTANCE); + dispatchOrUseDispatch(be.store).replaceBlocks("foo", [BLOCK_INSTANCE], 3); + dispatchOrUseDispatch(be.store).replaceBlocks(["foo"], BLOCK_INSTANCE); + dispatchOrUseDispatch(be.store).replaceBlocks(["foo"], [BLOCK_INSTANCE], 0); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).replaceInnerBlocks("foo", [BLOCK_INSTANCE]); + dispatchOrUseDispatch(be.store).replaceInnerBlocks("foo", [BLOCK_INSTANCE], true); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).resetBlocks([BLOCK_INSTANCE]); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).selectBlock("foo"); + dispatchOrUseDispatch(be.store).selectBlock("foo", 5); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).selectionChange("foo", "bar", 0, 5); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).selectNextBlock("foo"); + + // $ExpectType Promise> + dispatchOrUseDispatch(be.store).selectPreviousBlock("foo"); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).setTemplateValidity(false); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).showInsertionPoint(); + dispatchOrUseDispatch(be.store).showInsertionPoint("foo"); + dispatchOrUseDispatch(be.store).showInsertionPoint("foo", 5); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).toggleBlockMode("foo"); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).toggleSelection(); + dispatchOrUseDispatch(be.store).toggleSelection(true); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).updateBlock("foo", { attributes: { foo: "bar" }, innerBlocks: [] }); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).updateBlockAttributes("foo", { foo: "bar" }); + + // $ExpectType Promise + dispatchOrUseDispatch(be.store).updateBlockListSettings("foo", { allowedBlocks: ["core/paragraph"] }); -// $ExpectType string[] -select("core/block-editor").getBlockParents("foo"); -select("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"]); -select("core/block-editor").getBlockParents("foo", true); -select("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"], true); + // $ExpectType Promise + dispatchOrUseDispatch(be.store).updateSettings({ + focusMode: true, + codeEditingEnabled: false, + maxUploadFileSize: 500, + richEditingEnabled: false, + }); +} -// $ExpectType string[] -useSelect("core/block-editor").getBlockParents("foo"); -useSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"]); -useSelect("core/block-editor").getBlockParents("foo", true); -useSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"], true); +for (const selectOrUseSelect of [select, useSelect]) { + // $ExpectType boolean + selectOrUseSelect("core/block-editor").canInsertBlockType("core/paragraph"); + selectOrUseSelect("core/block-editor").canInsertBlockType("core/paragraph", "foo"); + + // $ExpectType string | null + selectOrUseSelect("core/block-editor").getAdjacentBlockClientId(); + selectOrUseSelect("core/block-editor").getAdjacentBlockClientId("foo"); + selectOrUseSelect("core/block-editor").getAdjacentBlockClientId("foo", -1); + selectOrUseSelect("core/block-editor").getAdjacentBlockClientId("foo", 1); + + // $ExpectType string[] + selectOrUseSelect("core/block-editor").getBlockParents("foo"); + selectOrUseSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"]); + selectOrUseSelect("core/block-editor").getBlockParents("foo", true); + selectOrUseSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"], true); + + // $ExpectType string[] + selectOrUseSelect("core/block-editor").getBlocksByName("core/group"); + selectOrUseSelect("core/block-editor").getBlocksByName(["core/group", "core/paragraph"]); +} -// $ExpectType string[] -useSelect("core/block-editor").getBlocksByName("core/group"); -useSelect("core/block-editor").getBlocksByName(["core/group", "core/paragraph"]); +for (const selectOrUseSelect of [select, useSelect]) { + // $ExpectType boolean + selectOrUseSelect(be.store).canInsertBlockType("core/paragraph"); + selectOrUseSelect(be.store).canInsertBlockType("core/paragraph", "foo"); + + // $ExpectType string | null + selectOrUseSelect(be.store).getAdjacentBlockClientId(); + selectOrUseSelect(be.store).getAdjacentBlockClientId("foo"); + selectOrUseSelect(be.store).getAdjacentBlockClientId("foo", -1); + selectOrUseSelect(be.store).getAdjacentBlockClientId("foo", 1); + + // $ExpectType string[] + selectOrUseSelect(be.store).getBlockParents("foo"); + selectOrUseSelect(be.store).getBlockParentsByBlockName("foo", ["core/query"]); + selectOrUseSelect(be.store).getBlockParents("foo", true); + selectOrUseSelect(be.store).getBlockParentsByBlockName("foo", ["core/query"], true); + + // $ExpectType string[] + selectOrUseSelect(be.store).getBlocksByName("core/group"); + selectOrUseSelect(be.store).getBlocksByName(["core/group", "core/paragraph"]); +} { const blockProps: UseBlockProps.Merged & UseBlockProps.Reserved = be.useBlockProps();