-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Migrate hooks package to TypeScript
#70488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
manzoorwanijk
merged 21 commits into
WordPress:trunk
from
im3dabasia:try/convert-hooks-ts
Jul 11, 2025
Merged
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 4b730f1
feat: Convert createCurrentHook.js to TS
im3dabasia 96a3ed3
feat: Migrate the createDidHook.js to TS
im3dabasia f2c6749
feat: Migrate createDoingHook.ts to TS
im3dabasia e18ab7a
feat: Migrate createDoingHook.ts to TS
im3dabasia e74acdf
feat: Migrate createDoingHook.ts to TS
im3dabasia 33646b7
feat: Migrate the createHasHook.js to TS
im3dabasia 639653d
feat: Migrate createRemoveHook.js to TS
im3dabasia 0dde6c7
feat: Migrate createRunHook.js to TS
im3dabasia 0d63613
feat: Migrate validateHookName.js to TS
im3dabasia 70405b6
feat: Migrate validateNamespace.js to TS
im3dabasia 47f2321
fix: Internal dependencies imports for JS converted to TS
im3dabasia d8b0a6b
fix: Hooks import in index.ts file for Hooks type import from createH…
im3dabasia c20bb22
chore: Retain comments for AddHook Type
im3dabasia ce88484
chore: Retain DidHook type's comment
im3dabasia 2f4449c
chore: Retain DoingHook Type comment
im3dabasia 72e75e9
chore: Retain HasHook Type comment
im3dabasia 01a6543
chore: Retain RemoveHook Type comment
im3dabasia d0468bb
chore: Retain RemoveHook Type comment
im3dabasia d8c8cb9
chore: Shift all the types from index.ts to types.ts
im3dabasia 17b97a0
fix: Use type imports from the types.ts
im3dabasia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: Shift all the types from index.ts to types.ts
- Loading branch information
commit d8c8cb9917aaeb4f4365059663e7b9f88457b4d5
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
im3dabasia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.