A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1/**
2 * Minimal ambient types for the `@wordpress/*` packages we use that ship no
3 * TypeScript declarations (no `types` field, no build-types). Scoped to the surface
4 * SkyPress actually calls — enough to keep `astro check` honest without pulling the
5 * stale community `@types/wordpress__*` packages.
6 */
7declare module '@wordpress/blocks' {
8 export interface BlockInstance {
9 name: string;
10 attributes: Record< string, unknown >;
11 innerBlocks: BlockInstance[];
12 clientId?: string;
13 }
14
15 export function createBlock(
16 name: string,
17 attributes?: Record< string, unknown >,
18 innerBlocks?: BlockInstance[]
19 ): BlockInstance;
20
21 export function serialize( blocks: BlockInstance[] | BlockInstance ): string;
22 export function parse( content: string ): BlockInstance[];
23 export function registerBlockType( ...args: unknown[] ): unknown;
24 export function unregisterBlockType( name: string ): unknown;
25 export function getBlockTypes(): Array< { name: string } >;
26}
27
28declare module '@wordpress/block-library' {
29 export function registerCoreBlocks(): void;
30}
31
32declare module '@wordpress/block-editor' {
33 import type { ComponentType, ReactNode } from 'react';
34 import type { BlockInstance } from '@wordpress/blocks';
35
36 export const BlockEditorProvider: ComponentType< {
37 value: BlockInstance[];
38 onInput?: ( blocks: BlockInstance[] ) => void;
39 onChange?: ( blocks: BlockInstance[] ) => void;
40 settings?: Record< string, unknown >;
41 children?: ReactNode;
42 } >;
43 export const BlockList: ComponentType< Record< string, unknown > >;
44 export const BlockTools: ComponentType< { children?: ReactNode } >;
45 export const BlockToolbar: ComponentType< { hideDragHandle?: boolean } >;
46 export const BlockInspector: ComponentType< Record< string, unknown > >;
47 export const Inserter: ComponentType< { rootClientId?: string } >;
48 export const WritingFlow: ComponentType< { children?: ReactNode } >;
49 export const ObserveTyping: ComponentType< { children?: ReactNode } >;
50 export const BlockEditorKeyboardShortcuts: ComponentType<
51 Record< string, unknown >
52 > & { Register: ComponentType< Record< string, unknown > > };
53}
54
55declare module '@wordpress/hooks' {
56 export function addFilter(
57 hookName: string,
58 namespace: string,
59 callback: ( ...args: unknown[] ) => unknown,
60 priority?: number
61 ): void;
62 export function hasFilter( hookName: string, namespace?: string ): boolean;
63 export function applyFilters( hookName: string, value: unknown, ...args: unknown[] ): unknown;
64}