Skip to content

Commit 6bda7df

Browse files
Update deprecation notices in consumer components to specify type safety with context consumers
1 parent 85f46ab commit 6bda7df

File tree

7 files changed

+17
-5
lines changed

7 files changed

+17
-5
lines changed

wp-react-lib/src/consumers/CategoriesConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface CategoriesConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `CategoriesContext.Consumer` instead.
9+
* @deprecated Use the `CategoriesContext.Consumer` instead if you want type safety.
1010
* CategoriesConsumer is a component that provides the categories, loading, error, and meta to its children.
1111
* @param props - The props for the CategoriesConsumer component.
1212
* @returns The CategoriesConsumer component.

wp-react-lib/src/consumers/MediaConsumer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ interface MediaConsumerProps {
66
children: React.ReactNode | React.ReactNode[] | React.ReactElement | React.ReactElement[];
77
}
88

9+
/**
10+
* @deprecated Use the `MediaContext.Consumer` instead if you want type safety.
11+
* MediaConsumer is a component that provides the media, locale to its children.
12+
* @param props - The props for the MediaConsumer component.
13+
* @returns The MediaConsumer component.
14+
*/
915
const MediaConsumer = (props: MediaConsumerProps) => {
1016
return (
1117
<MediaContext.Consumer>

wp-react-lib/src/consumers/PageConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface PageConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `PageContext.Consumer` instead.
9+
* @deprecated Use the `PageContext.Consumer` instead if you want type safety.
1010
* PageConsumer is a component that provides the pages, meta, and locale to its children.
1111
* @param props - The props for the PageConsumer component.
1212
* @returns The PageConsumer component.

wp-react-lib/src/consumers/PostConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface PostConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `PostContext.Consumer` instead.
9+
* @deprecated Use the `PostContext.Consumer` instead if you want type safety.
1010
* PostConsumer is a component that provides the posts, meta, and locale to its children.
1111
* @param props - The props for the PostConsumer component.
1212
* @returns The PostConsumer component.

wp-react-lib/src/consumers/SearchConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface SearchConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `SearchContext.Consumer` instead.
9+
* @deprecated Use the `SearchContext.Consumer` instead if you want type safety.
1010
* SearchConsumer is a component that provides the search results, meta, and locale to its children.
1111
* @param props - The props for the SearchConsumer component.
1212
* @returns The SearchConsumer component.

wp-react-lib/src/consumers/SettingsConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface SettingsConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `SettingsContext.Consumer` instead.
9+
* @deprecated Use the `SettingsContext.Consumer` instead if you want type safety.
1010
* SettingsConsumer is a component that provides the settings to its children.
1111
* @param props - The props for the SettingsConsumer component.
1212
* @returns The SettingsConsumer component.

wp-react-lib/src/consumers/TaxonomyConsumer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ interface TaxonomyConsumerProps {
55
children: React.ReactNode | React.ReactNode[] | React.ReactElement | React.ReactElement[];
66
}
77

8+
/**
9+
* @deprecated Use the `TaxonomyContext.Consumer` instead if you want type safety.
10+
* TaxonomyConsumer is a component that provides the taxonomies, locale to its children.
11+
* @param props - The props for the TaxonomyConsumer component.
12+
* @returns The TaxonomyConsumer component.
13+
*/
814
const TaxonomyConsumer = (props: TaxonomyConsumerProps) => {
915
return (
1016
<TaxonomyContext.Consumer>

0 commit comments

Comments
 (0)