Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
56a0a7d
feat: Migrate index.js, createHooks.js, createAddHook.js to TS
im3dabasia Jun 20, 2025
4b730f1
feat: Convert createCurrentHook.js to TS
im3dabasia Jun 20, 2025
96a3ed3
feat: Migrate the createDidHook.js to TS
im3dabasia Jun 20, 2025
f2c6749
feat: Migrate createDoingHook.ts to TS
im3dabasia Jun 20, 2025
e18ab7a
feat: Migrate createDoingHook.ts to TS
im3dabasia Jun 20, 2025
e74acdf
feat: Migrate createDoingHook.ts to TS
im3dabasia Jun 20, 2025
33646b7
feat: Migrate the createHasHook.js to TS
im3dabasia Jun 20, 2025
639653d
feat: Migrate createRemoveHook.js to TS
im3dabasia Jun 20, 2025
0dde6c7
feat: Migrate createRunHook.js to TS
im3dabasia Jun 20, 2025
0d63613
feat: Migrate validateHookName.js to TS
im3dabasia Jun 20, 2025
70405b6
feat: Migrate validateNamespace.js to TS
im3dabasia Jun 20, 2025
47f2321
fix: Internal dependencies imports for JS converted to TS
im3dabasia Jun 20, 2025
d8b0a6b
fix: Hooks import in index.ts file for Hooks type import from createH…
im3dabasia Jun 20, 2025
c20bb22
chore: Retain comments for AddHook Type
im3dabasia Jul 4, 2025
ce88484
chore: Retain DidHook type's comment
im3dabasia Jul 4, 2025
2f4449c
chore: Retain DoingHook Type comment
im3dabasia Jul 4, 2025
72e75e9
chore: Retain HasHook Type comment
im3dabasia Jul 4, 2025
01a6543
chore: Retain RemoveHook Type comment
im3dabasia Jul 4, 2025
d0468bb
chore: Retain RemoveHook Type comment
im3dabasia Jul 4, 2025
d8c8cb9
chore: Shift all the types from index.ts to types.ts
im3dabasia Jul 4, 2025
17b97a0
fix: Use type imports from the types.ts
im3dabasia Jul 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Shift all the types from index.ts to types.ts
  • Loading branch information
im3dabasia committed Jul 4, 2025
commit d8c8cb9917aaeb4f4365059663e7b9f88457b4d5
25 changes: 1 addition & 24 deletions packages/hooks/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
/**
* Internal dependencies
*/
import type { Hooks as internalHooks } from './createHooks';
import createHooks from './createHooks';

export type Callback = ( ...args: any[] ) => any;

export type Handler = {
callback: Callback;
namespace: string;
priority: number;
};

export type Hook = {
handlers: Handler[];
runs: number;
};

export type Current = {
name: string;
currentIndex: number;
};

export type Store = Record< string, Hook > & { __current: Set< Current > };

export type StoreKey = 'actions' | 'filters';

export type Hooks = internalHooks;
export * from './types';

export const defaultHooks = createHooks();

Expand Down
28 changes: 28 additions & 0 deletions packages/hooks/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Internal dependencies
*/
import type { Hooks as internalHooks } from './createHooks';

export type Callback = ( ...args: any[] ) => any;

export type Handler = {
callback: Callback;
namespace: string;
priority: number;
};

export type Hook = {
handlers: Handler[];
runs: number;
};

export type Current = {
name: string;
currentIndex: number;
};

export type Store = Record< string, Hook > & { __current: Set< Current > };

export type StoreKey = 'actions' | 'filters';

export type Hooks = internalHooks;
Loading