diff --git a/hooks/use-taxonomy/index.js b/hooks/use-taxonomy/index.ts similarity index 69% rename from hooks/use-taxonomy/index.js rename to hooks/use-taxonomy/index.ts index ba153ff1..bafd5dcc 100644 --- a/hooks/use-taxonomy/index.js +++ b/hooks/use-taxonomy/index.ts @@ -1,7 +1,8 @@ import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; +import type { Taxonomy } from '@wordpress/core-data'; -export function useTaxonomy(taxonomyName) { +export function useTaxonomy(taxonomyName: string) { return useSelect( (select) => { const { getTaxonomy, hasFinishedResolution } = select(coreStore); @@ -12,5 +13,5 @@ export function useTaxonomy(taxonomyName) { return [taxonomy, hasResolvedTaxonomy]; }, [taxonomyName], - ); + ) as [ taxonomy: Taxonomy | undefined, hasResolvedTaxonomy: boolean ]; }