Skip to content
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 error on React Native when using compilerOptions.moduleSuffixes #311

Open
Estevete opened this issue Sep 19, 2023 · 2 comments
Open

TS error on React Native when using compilerOptions.moduleSuffixes #311

Estevete opened this issue Sep 19, 2023 · 2 comments

Comments

@Estevete
Copy link

What did you do?

I have configured a new React Native Expo project from scratch. I have configured the tsconfig.json file with:

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true,
    "moduleSuffixes": [".native", ".ios", ".android", ".web", ""]
  }
}

And then added the ContentLoader in the App.tsx:

import ContentLoader, { Rect } from "react-content-loader/native";
import { View } from 'react-native';

export default function App() {
  return (
    <View>
        <ContentLoader height={70} width={"100%"}>
          <Rect
            y={7.5}
            ry={5}
            rx={5}
            width={180}
            height={25}
          />
          <Rect
            y={37.5}
            ry={5}
            rx={5}
            width={100}
            height={25}
          />
        </ContentLoader>
    </View>
  );
}

If I remove the "web" from the moduleSuffixes array, no TS error appears.

What did you expect to happen?

No TS error.

What happened actually?

TS error:

Type '{ children: Element[]; height: number; width: string; }' is not assignable to type 'IntrinsicAttributes & IContentLoaderProps'.
  Property 'children' does not exist on type 'IntrinsicAttributes & IContentLoaderProps'.ts(2322)

Which versions of react-content-loader, and which browser are affected by this issue?

  "dependencies": {
    "expo": "~49.0.11",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-content-loader": "6.2.1",
    "react-native": "0.72.4",
    "react-native-svg": "13.9.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "18.2.20",
    "typescript": "5.1.6"
  },
@Estevete
Copy link
Author

Estevete commented Sep 20, 2023

So this is maybe due to react-native-svg package software-mansion/react-native-svg#1920.
It was fixed & merged in version 13.11.0 software-mansion/react-native-svg#2091

Is it possible to upgrade the dependency version of react-native-svg?

@mpadel78
Copy link

Hey @Estevete were you able to solve this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants