Open rodrigodiasf1984 opened 1 year ago
You might have multiple copies of @types/react
in your node_modules
. This can be tricky to reproduce or resolve.
Try deleting node_modules
and bun.lockb
and re-installing. That will force all dependencies to be re-resolved and sometimes solve the duplication problem.
If that doesn't work try removing @types/react
from devDependencies and re-installing everything - @types/react-native
already has it as a dependency.
@types/react-native
Thanks for you're help!
I've tried what you suggest but now I'm getting other errors :
`zerel-parksharing-mobile on ξ dev [!] via β¬’ v18.16.1 via π v1.0.2 via π ruby-2.7.5
β bun tsc
src/components/CustomBottomSheet/index.tsx:119:7 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: ViewProps | Readonly
119 style={{
node_modules/@types/react-native/Libraries/Components/View/ViewPropTypes.d.ts:219:5
219 style?: StyleProp<ViewStyle> | undefined;
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'
node_modules/@types/react-native/Libraries/Components/View/ViewPropTypes.d.ts:219:5
219 style?: StyleProp
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'
src/components/MapModal/index.tsx:106:9 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: TouchableOpacityProps | Readonly<TouchableOpacityProps>): TouchableOpacity', gave the following error.
Type '{ top: string; right: string; }' is not assignable to type 'StyleProp<ViewStyle>'.
Types of property 'top' are incompatible.
Type 'string' is not assignable to type 'DimensionValue | undefined'.
Overload 2 of 2, '(props: TouchableOpacityProps, context: any): TouchableOpacity', gave the following error.
Type '{ top: string; right: string; }' is not assignable to type 'StyleProp<ViewStyle>'.
Types of property 'top' are incompatible.
Type 'string' is not assignable to type 'DimensionValue | undefined'.
106 style={{
node_modules/@types/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:104:5
104 style?: StyleProp
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps>'
node_modules/@types/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:104:5
104 style?: StyleProp<ViewStyle> | undefined;
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps>'
src/components/RangeProgressBar/index.tsx:66:19 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: ViewProps | Readonly
66 style={{
node_modules/@types/react-native/Libraries/Components/View/ViewPropTypes.d.ts:219:5
219 style?: StyleProp<ViewStyle> | undefined;
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'
node_modules/@types/react-native/Libraries/Components/View/ViewPropTypes.d.ts:219:5
219 style?: StyleProp
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'
src/screens/FormVehicle/index.tsx:385:17 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: TextProps | Readonly<TextProps>): Text', gave the following error.
Type 'string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined' is not assignable to type 'ReactNode'.
Type 'FieldError' is not assignable to type 'ReactNode'.
Type 'FieldError' is missing the following properties from type 'ReactPortal': key, children, props
Overload 2 of 2, '(props: TextProps, context: any): Text', gave the following error.
Type 'string | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined' is not assignable to type 'ReactNode'.
385 {errors?.color?.message}
node_modules/@types/react-native/Libraries/Text/Text.d.ts:108:5 108 children?: React.ReactNode | undefined;
The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Text> & Readonly<TextProps>'
node_modules/@types/react-native/Libraries/Text/Text.d.ts:108:5
108 children?: React.ReactNode | undefined;
The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Text> & Readonly<TextProps>'
src/screens/FormVehicle/index.tsx:427:17 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: TextProps | Readonly
427 {errors?.car_size?.message}
node_modules/@types/react-native/Libraries/Text/Text.d.ts:108:5
108 children?: React.ReactNode | undefined;
The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Text> & Readonly<TextProps>'
node_modules/@types/react-native/Libraries/Text/Text.d.ts:108:5 108 children?: React.ReactNode | undefined;
The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Text> & Readonly<TextProps>'
src/screens/Home/index.tsx:469:9 - error TS2769: No overload matches this call.
Overload 1 of 2, '(props: TouchableOpacityProps | Readonly<TouchableOpacityProps>): TouchableOpacity', gave the following error.
Type '{ top: string; }' is not assignable to type 'StyleProp<ViewStyle>'.
Types of property 'top' are incompatible.
Type 'string' is not assignable to type 'DimensionValue | undefined'.
Overload 2 of 2, '(props: TouchableOpacityProps, context: any): TouchableOpacity', gave the following error.
Type '{ top: string; }' is not assignable to type 'StyleProp<ViewStyle>'.
Types of property 'top' are incompatible.
Type 'string' is not assignable to type 'DimensionValue | undefined'.
469 style={{
node_modules/@types/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:104:5
104 style?: StyleProp
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps>'
node_modules/@types/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:104:5
104 style?: StyleProp<ViewStyle> | undefined;
The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<TouchableOpacity> & Readonly<TouchableOpacityProps>'
Found 6 errors in 5 files.
Errors Files 1 src/components/CustomBottomSheet/index.tsx:119 1 src/components/MapModal/index.tsx:106 1 src/components/RangeProgressBar/index.tsx:66 2 src/screens/FormVehicle/index.tsx:385 1 src/screens/Home/index.tsx:469
zerel-parksharing-mobile on ξ dev [!] via β¬’ v18.16.1 via π v1.0.2 via π ruby-2.7.5 took 11.5s β`
This is my package.json updated:
{ "name": "zerelparksharing", "version": "0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios --simulator \"IphoneX\"", "start": "react-native start", "device": "react-native run-android --variant=release", "lint": "eslint --ext .tsx --ext .ts src/", "typecheck": "tsc --project tsconfig.json --noEmit", "clean-project": "react-native-clean-project", "clean-android": "cd android && ./gradlew --stop && ./gradlew clean", "bundle": "cd android && ./gradlew bundleRelease", "build-apk": "cd android && ./gradlew assembleRelease", "install-apk": "adb install app-release.apk", "pod": "cd ios && pod install && cd ..", "test": "jest --passWithNoTests --no-cache --runInBand", "test:watch": "jest --watch", "clear_jest": "jest --clearCache", "clear-branches": "git branch | grep -v \"dev\" | xargs git branch -D && git fetch --prune" }, "dependencies": { "@aws-amplify/api": "^5.4.4", "@gorhom/bottom-sheet": "^4.5.1", "@hookform/resolvers": "^2.9.10", "@notifee/react-native": "^7.8.0", "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-community/datetimepicker": "^7.6.0", "@react-native-community/netinfo": "^9.3.7", "@react-native-firebase/app": "^14.11.0", "@react-native-firebase/messaging": "^14.11.0", "@react-native-masked-view/masked-view": "0.2.8", "@react-navigation/native": "^6.0.13", "@react-navigation/native-stack": "^6.9.1", "@react-navigation/stack": "^6.3.4", "@shopify/flash-list": "^1.4.2", "aws-amplify": "^5.0.14", "clsx": "^1.2.1", "date-fns": "^2.29.3", "lottie-react-native": "^5.1.6", "nativewind": "^2.0.11", "phosphor-react-native": "^1.1.2", "react": "18.1.0", "react-hook-form": "^7.39.4", "react-native": "0.70.6", "react-native-actions-sheet": "^0.8.29", "react-native-background-fetch": "4.1.5", "react-native-background-geolocation": "4.10.1", "react-native-biometrics": "^3.0.1", "react-native-confirmation-code-field": "^7.3.1", "react-native-contacts": "^7.0.5", "react-native-device-info": "^10.4.0", "react-native-dotenv": "^3.4.9", "react-native-dropdown-picker": "^5.4.6", "react-native-flash-message": "^0.4.2", "react-native-floating-label-input": "^1.4.2", "react-native-gesture-handler": "^2.9.0", "react-native-google-places-autocomplete": "^2.5.1", "react-native-image-crop-picker": "^0.37.3", "react-native-iphone-x-helper": "^1.3.1", "react-native-maps": "^1.7.1", "react-native-modal-datetime-picker": "^17.1.0", "react-native-open-maps": "^0.4.0", "react-native-permissions": "^3.6.1", "react-native-phone-number-input": "^2.1.0", "react-native-ratings": "^8.1.0", "react-native-reanimated": "^2.14.4", "react-native-responsive-screen": "^1.4.2", "react-native-safe-area-context": "4.4.1", "react-native-screens": "~3.18.0", "react-native-splash-screen": "^3.3.0", "react-native-svg": "^13.9.0", "react-native-svg-transformer": "^1.0.0", "react-native-swipe-gestures": "^1.0.5", "react-native-swipe-list-view": "^3.2.9", "react-native-tooltip-2": "^0.1.3", "react-native-version-check": "^3.4.7", "react-native-webview": "^13.2.3", "redux-persist": "^6.0.0", "rn-swipe-button": "^1.3.8", "tailwindcss": "3.3.2", "yup": "^0.32.11", "zustand": "^4.3.6" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@testing-library/jest-native": "^5.4.1", "@testing-library/react-native": "^11.5.1", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.4.0", "@types/react-native": "^0.72.3", "@types/react-native-dotenv": "^0.2.0", "@types/react-native-version-check": "^3.4.5", "@types/react-test-renderer": "^18.0.0", "@typescript-eslint/eslint-plugin": "^6.4.0", "babel-plugin-module-resolver": "^5.0.0", "eslint": "^8.0.1", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^9.0.0", "eslint-config-standard-with-typescript": "^39.0.0", "eslint-import-resolver-babel-module": "^5.3.2", "eslint-plugin-import": "^2.28.1", "eslint-plugin-jsx-a11y": "^6.7.1", "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-native": "^4.0.0", "jest": "^29.6.4", "jest-transform-stub": "^2.0.0", "metro-react-native-babel-preset": "0.72.3", "prettier": "^3.0.3", "react-native-clean-project": "^4.0.1", "react-test-renderer": "^18.2.0", "typescript": "*" }, "resolutions": { "@types/react-native": "0.72.3" } }
any idea how to solve it?
I've ran into this too. I think it's due to multiple copies of @types/react
being installed. On other projects where I've run into this, the fix is to use yarn's resolutions
field or npm's overrides
to force resolve a single version. However, Bun doesn't yet support this (see https://github.com/oven-sh/bun/issues/1134).
I've ran into this too. I think it's due to multiple copies of
@types/react
being installed. On other projects where I've run into this, the fix is to use yarn'sresolutions
field or npm'soverrides
to force resolve a single version. However, Bun doesn't yet support this (see #1134).
Thanks for your comment, I'll follow the other issues.
I'm still seeing the same thing even if I use overrides/resolutions :(
Edit: mine was quite niche I guess. I didn't have dupes or diff versions but I did have a separate bun project at src/api
and that uses bun JSX on server (so maybe some React conflicts). So I had to add "exclude": ["src/api"],
. I will prob just move it outside source as a cleaner solution.
Edit edit: bit of a catch-22 since I want to import App
from Elysia on the api for the Eden UI client to have strong typing, as soon as I do that, even a very strict path like paths: { "@api/index": ["api/src/index"] }
it breaks again. But I don't think this is a bun specific issue.
This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.
What version of Bun is running?
1.0.2
What platform is your computer?
Mac os ventura 13.4
What steps can reproduce the bug?
install all dependencies of the project with yarn and run "typecheck": "tsc --project tsconfig.json --noEmit", bun tsc
What is the expected behavior?
look if there is any error on the entire project without looking into nodemodules
What do you see instead?
For some reason the typeck with bun is causing these errors,
Additional information
if i install all dependencies of the project with yarn and run yarn tsc this is the result:
my tsconfig:
My eslintrc:
my eslint.ignore:
my package.json