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

[ BUG ] TypeScript not working #123

Closed
AprilNEA opened this issue Apr 3, 2024 · 2 comments
Closed

[ BUG ] TypeScript not working #123

AprilNEA opened this issue Apr 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@AprilNEA
Copy link

AprilNEA commented Apr 3, 2024

Describe the bug
My TypeScript won't work anyway.

To Reproduce
Copying the components as per the documentation, I make sure all the copied paths are okay

Expected behavior
Type inference should work properly

Screenshots
image

image

Platform (please complete the following information):

  • OS: MacOS
  • IDE: WebStorm
  • Nodejs: v20
  • TypeScript: 5.4.3

Additional context
Here is my tsconfig

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "jsx": "preserve",
    "lib": [
      "dom",
      "esnext"
    ],
    "moduleResolution": "node",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "target": "esnext",
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "module": "esnext",
    "isolatedModules": true,
    "strict": true,
    "baseUrl": "./src",
    "types": [
      "nativewind/types"
    ],
    "paths": {
      "@/*": [
        "./*"
      ]
    }
  },
  "include": [
    "app.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ],
}

@AprilNEA AprilNEA added the bug Something isn't working label Apr 3, 2024
@AprilNEA
Copy link
Author

AprilNEA commented Apr 3, 2024

Seems related to: redwoodjs/redwood#5104
When I add the following lines to tsconfig.json, the type works correctly.

"compilerOptions": {
    "paths": {
      "react": [
        "./node_modules/@types/react"
      ]
    }
}

@mrzachnugent
Copy link
Owner

I had this issue when updating my packages with npx expo install --fix. I had to delete my node_modules and install them again to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants