-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
TS: Property 'children' does not exist on type #450
Comments
Quick fix: Just add to |
Hacky workaround: <Collapsible
collapsed={isCollapsed}
// workaround: children prop not in TS definitions
{...{
children: props.children // <-- put children here
}}
/> |
You can safely extend the type without modifying any files in node_modules: import { CollapsibleProps as OriginalCollapsibleProps } from "react-native-collapsible";
declare module "react-native-collapsible" {
interface CollapsibleProps extends OriginalCollapsibleProps {
children?: React.ReactNode;
}
} EDIT this can be simplified: // this file must be a module - at least one import/export will force that
export {};
declare module "react-native-collapsible" {
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-interfaces
interface CollapsibleProps {
children?: React.ReactNode;
}
} |
A fix for this issue has already been merged in Jun 2022. Apparently this lib only needs a minor/major release. |
Who is the person that is able to do minor/major release? |
@oblador any chance a minor release could be published to get the React 18 fix out? |
After updating to
"react-native": "0.70.3"
and"react": "18.1.0"
types break when passing children to a<Collapsible />
component. Same issue occurred with other libraries as well but got fixed when updated to latest versions. But this issue seems to not be fixed in version1.6.0
.Full TS error
The text was updated successfully, but these errors were encountered: