Skip to content

Commit 77599c6

Browse files
feat: compatibility with React 19 types (#1299)
1 parent eb18401 commit 77599c6

File tree

16 files changed

+36
-63
lines changed

16 files changed

+36
-63
lines changed

examples/react-17/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"devDependencies": {
2121
"@algolia/client-search": "4.16.0",
22-
"@types/react": "^17.0.0",
23-
"@types/react-dom": "^17.0.0",
22+
"@types/react": "^19.0.7",
23+
"@types/react-dom": "^19.0.3",
2424
"@vitejs/plugin-react": "1.0.7",
2525
"typescript": "^4.4.2",
2626
"vite": "2.8.0"

examples/react-17/src/Highlight.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { parseAlgoliaHitHighlight } from '@algolia/autocomplete-preset-algolia';
2-
import { createElement, Fragment } from 'react';
2+
import { createElement, Fragment, JSX } from 'react';
33

44
type HighlightHitParams<THit> = {
55
/**

examples/react-instantsearch/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"react-instantsearch": "7.12.1"
2121
},
2222
"devDependencies": {
23-
"@types/react": "^18.0.26",
24-
"@types/react-dom": "^18.0.9",
23+
"@types/react": "^19.0.7",
24+
"@types/react-dom": "^19.0.3",
2525
"@vitejs/plugin-react": "1.0.7",
2626
"typescript": "4.5.4",
2727
"vite": "2.8.0"

examples/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"devDependencies": {
2121
"@algolia/client-search": "4.16.0",
22-
"@types/react": "^18.0.26",
23-
"@types/react-dom": "^18.0.9",
22+
"@types/react": "^19.0.7",
23+
"@types/react-dom": "^19.0.3",
2424
"@vitejs/plugin-react": "1.0.7",
2525
"typescript": "^4.4.2",
2626
"vite": "2.8.0"

examples/slack-with-emojis-and-commands/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
},
2121
"devDependencies": {
2222
"@algolia/client-search": "4.16.0",
23-
"@types/react": "^17.0.0",
24-
"@types/react-dom": "^17.0.0",
23+
"@types/react": "^19.0.7",
24+
"@types/react-dom": "^19.0.3",
2525
"@types/textarea-caret": "3.0.1",
2626
"@vitejs/plugin-react": "1.0.7",
2727
"typescript": "^4.4.2",

examples/slack-with-emojis-and-commands/src/types/Command.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { JSX } from 'react';
2+
13
export type Command = {
24
slug: string;
35
commands: string[];

examples/twitter-compose-with-typeahead/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
},
2121
"devDependencies": {
2222
"@algolia/client-search": "4.16.0",
23-
"@types/react": "^17.0.0",
24-
"@types/react-dom": "^17.0.0",
23+
"@types/react": "^19.0.7",
24+
"@types/react-dom": "^19.0.3",
2525
"@types/textarea-caret": "3.0.1",
2626
"@vitejs/plugin-react": "1.0.7",
2727
"typescript": "^4.4.2",

examples/two-column-layout/src/components/Breadcrumb.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { intersperse } from '../utils';
77
import { ChevronRightIcon } from './Icons';
88

99
type BreadcrumbProps = {
10-
items: JSX.Element[];
10+
items: h.JSX.Element[];
1111
};
1212

1313
export function Breadcrumb({ items }: BreadcrumbProps) {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"@testing-library/user-event": "12.5.0",
4141
"@types/jest": "^26.0.16",
4242
"@types/jest-diff": "^24.3.0",
43-
"@types/react": "^17.0.0",
44-
"@types/react-dom": "^17.0.0",
43+
"@types/react": "^19.0.7",
44+
"@types/react-dom": "^19.0.3",
4545
"@typescript-eslint/eslint-plugin": "2.34.0",
4646
"@typescript-eslint/parser": "2.34.0",
4747
"algoliasearch": "4.16.0",

packages/autocomplete-js/src/components/Highlight.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseAlgoliaHitHighlight } from '@algolia/autocomplete-preset-algolia';
22

3-
import { AutocompleteRenderer, HighlightHitParams } from '../types';
3+
import { AutocompleteRenderer, HighlightHitParams, VNode } from '../types';
44

55
export function createHighlightComponent({
66
createElement,
@@ -10,7 +10,7 @@ export function createHighlightComponent({
1010
hit,
1111
attribute,
1212
tagName = 'mark',
13-
}: HighlightHitParams<THit>): JSX.Element {
13+
}: HighlightHitParams<THit>): VNode<any> {
1414
return createElement(
1515
Fragment,
1616
{},

packages/autocomplete-js/src/components/ReverseHighlight.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseAlgoliaHitReverseHighlight } from '@algolia/autocomplete-preset-algolia';
22

3-
import { AutocompleteRenderer, HighlightHitParams } from '../types';
3+
import { AutocompleteRenderer, HighlightHitParams, VNode } from '../types';
44

55
export function createReverseHighlightComponent({
66
createElement,
@@ -10,7 +10,7 @@ export function createReverseHighlightComponent({
1010
hit,
1111
attribute,
1212
tagName = 'mark',
13-
}: HighlightHitParams<THit>): JSX.Element {
13+
}: HighlightHitParams<THit>): VNode<any> {
1414
return createElement(
1515
Fragment,
1616
{},

packages/autocomplete-js/src/components/ReverseSnippet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseAlgoliaHitReverseSnippet } from '@algolia/autocomplete-preset-algolia';
22

3-
import { AutocompleteRenderer, HighlightHitParams } from '../types';
3+
import { AutocompleteRenderer, HighlightHitParams, VNode } from '../types';
44

55
export function createReverseSnippetComponent({
66
createElement,
@@ -10,7 +10,7 @@ export function createReverseSnippetComponent({
1010
hit,
1111
attribute,
1212
tagName = 'mark',
13-
}: HighlightHitParams<THit>): JSX.Element {
13+
}: HighlightHitParams<THit>): VNode<any> {
1414
return createElement(
1515
Fragment,
1616
{},

packages/autocomplete-js/src/components/Snippet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseAlgoliaHitSnippet } from '@algolia/autocomplete-preset-algolia';
22

3-
import { AutocompleteRenderer, HighlightHitParams } from '../types';
3+
import { AutocompleteRenderer, HighlightHitParams, VNode } from '../types';
44

55
export function createSnippetComponent({
66
createElement,
@@ -10,7 +10,7 @@ export function createSnippetComponent({
1010
hit,
1111
attribute,
1212
tagName = 'mark',
13-
}: HighlightHitParams<THit>): JSX.Element {
13+
}: HighlightHitParams<THit>): VNode<any> {
1414
return createElement(
1515
Fragment,
1616
{},

packages/autocomplete-shared/src/js/AutocompleteComponents.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import { VNode } from './AutocompleteRenderer';
12
import { HighlightHitParams } from './HighlightHitParams';
23

34
type AutocompleteHighlightComponent = <THit>({
45
hit,
56
attribute,
67
tagName,
7-
}: HighlightHitParams<THit>) => JSX.Element;
8+
}: HighlightHitParams<THit>) => VNode<any>;
89

910
export type PublicAutocompleteComponents = Record<
1011
string,
11-
(props: any) => JSX.Element
12+
(props: any) => VNode<any>
1213
>;
1314

1415
export interface AutocompleteComponents extends PublicAutocompleteComponents {

packages/autocomplete-shared/src/js/AutocompleteRenderer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export type Pragma = (
22
type: any,
33
props: Record<string, any> | null,
44
...children: ComponentChildren[]
5-
) => JSX.Element;
5+
) => VNode<any>;
66
export type PragmaFrag = any;
77

88
type ComponentChild = VNode<any> | string | number | boolean | null | undefined;

yarn.lock

+8-38
Original file line numberDiff line numberDiff line change
@@ -3750,11 +3750,6 @@
37503750
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.3.tgz#a3c65525b91fca7da00ab1a3ac2b5a2a4afbffbf"
37513751
integrity sha512-QzSuZMBuG5u8HqYz01qtMdg/Jfctlnvj1z/lYnIDXs/golxw0fxtRAHd9KrzjR7Yxz1qVeI00o0kiO3PmVdJ9w==
37523752

3753-
"@types/prop-types@*":
3754-
version "15.7.5"
3755-
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
3756-
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
3757-
37583753
"@types/q@^1.5.1":
37593754
version "1.5.5"
37603755
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
@@ -3765,36 +3760,16 @@
37653760
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb"
37663761
integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==
37673762

3768-
"@types/react-dom@^17.0.0":
3769-
version "17.0.19"
3770-
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.19.tgz#36feef3aa35d045cacd5ed60fe0eef5272f19492"
3771-
integrity sha512-PiYG40pnQRdPHnlf7tZnp0aQ6q9tspYr72vD61saO6zFCybLfMqwUCN0va1/P+86DXn18ZWeW30Bk7xlC5eEAQ==
3772-
dependencies:
3773-
"@types/react" "^17"
3774-
3775-
"@types/react-dom@^18.0.9":
3776-
version "18.0.11"
3777-
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.11.tgz#321351c1459bc9ca3d216aefc8a167beec334e33"
3778-
integrity sha512-O38bPbI2CWtgw/OoQoY+BRelw7uysmXbWvw3nLWO21H1HSh+GOlqPuXshJfjmpNlKiiSDG9cc1JZAaMmVdcTlw==
3779-
dependencies:
3780-
"@types/react" "*"
3781-
3782-
"@types/react@*", "@types/react@^18.0.26":
3783-
version "18.0.31"
3784-
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.31.tgz#a69ef8dd7bfa849734d258c793a8fe343a338205"
3785-
integrity sha512-EEG67of7DsvRDU6BLLI0p+k1GojDLz9+lZsnCpCRTa/lOokvyPBvp8S5x+A24hME3yyQuIipcP70KJ6H7Qupww==
3786-
dependencies:
3787-
"@types/prop-types" "*"
3788-
"@types/scheduler" "*"
3789-
csstype "^3.0.2"
3763+
"@types/react-dom@^19.0.3":
3764+
version "19.0.3"
3765+
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.0.3.tgz#0804dfd279a165d5a0ad8b53a5b9e65f338050a4"
3766+
integrity sha512-0Knk+HJiMP/qOZgMyNFamlIjw9OFCsyC2ZbigmEEyXXixgre6IQpm/4V+r3qH4GC1JPvRJKInw+on2rV6YZLeA==
37903767

3791-
"@types/react@^17", "@types/react@^17.0.0":
3792-
version "17.0.55"
3793-
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.55.tgz#f94eac1a37929cd86d1cc084c239c08dcfd10e5f"
3794-
integrity sha512-kBcAhmT8RivFDYxHdy8QfPKu+WyfiiGjdPb9pIRtd6tj05j0zRHq5DBGW5Ogxv5cwSKd93BVgUk/HZ4I9p3zNg==
3768+
"@types/react@^19.0.7":
3769+
version "19.0.7"
3770+
resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.7.tgz#c451968b999d1cb2d9207dc5ff56496164cf511d"
3771+
integrity sha512-MoFsEJKkAtZCrC1r6CM8U22GzhG7u2Wir8ons/aCKH6MBdD1ibV24zOSSkdZVUKqN5i396zG5VKLYZ3yaUZdLA==
37953772
dependencies:
3796-
"@types/prop-types" "*"
3797-
"@types/scheduler" "*"
37983773
csstype "^3.0.2"
37993774

38003775
"@types/resolve@1.17.1":
@@ -3804,11 +3779,6 @@
38043779
dependencies:
38053780
"@types/node" "*"
38063781

3807-
"@types/scheduler@*":
3808-
version "0.16.3"
3809-
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5"
3810-
integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
3811-
38123782
"@types/stack-utils@^2.0.0":
38133783
version "2.0.1"
38143784
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"

0 commit comments

Comments
 (0)