8000 fix(react): avoid type collision with @types/react@18.2.43 and greate… · ionic-team/ionic-framework@92f1b86 · GitHub
[go: up one dir, main page]

Skip to content

Commit 92f1b86

Browse files
authored
fix(react): avoid type collision with @types/react@18.2.43 and greater (#28687)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Ionic React projects using `@types/react@18.2.43` or greater will run into a type-check error on build with `IonRouterOutlet` and potentially other components: ``` Property 'placeholder' is missing in type '{ children: Element[]; }' but required in type 'Pick<IonRouterOutlet & { basePath?: string | undefined; ref?: Ref<any> | undefined; ionPage?: boolean | undefined; } & IonicReactProps & Omit<...>, "color" | ... 254 more ... | "ionPage">'. ``` Definitely typed decided to make a breaking type change in a patch release: DefinitelyTyped/DefinitelyTyped@b954269 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Patches the type to allow for compatibility between React v16, 17 and 18. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> ### Testing 1. Create a new Ionic react project with the "list" template. 2. Run `npm run build` 3. Observe: Exception posted above 4. Install the dev-build 5. Run `npm run build` 6. Observe: No exception, build passes 7. You can additionally serve the app to verify no runtime exceptions/broken behavior. Dev-build: `7.6.1-dev.11702322681.17e39348`
1 parent 8ee23d2 commit 92f1b86

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react/src/components/utils/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ import React from 'react';
55
import type { IonicReactProps } from '../IonicReactProps';
66

77
export type IonicReactExternalProps<PropType, ElementType> = PropType &
8-
Omit<React.HTMLAttributes<ElementType>, 'style'> &
8+
/**
9+
* TODO: FW-5753
10+
*
11+
* The `placeholder` property was removed from `HTMLAttributes` in @types/react@18.2.43
12+
* https://github.com/DefinitelyTyped/DefinitelyTyped/commit/b954269038de46b4b2f1756a9f2f020cbc66a326
13+
*
14+
* This is a temporary workaround until @ionic/react is updated to >=18.2.43.
15+
*/
16+
Omit<React.HTMLAttributes<ElementType>, 'style' | 'placeholder'> &
917
IonicReactProps;
1018

1119
export const createForwardRef = <PropType, ElementType>(

0 commit comments

Comments
 (0)
0