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

fix: wrong types path (#1554) #1581

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

xgenem
Copy link
Contributor

@xgenem xgenem commented Jan 18, 2021

Fix for Cannot find module 'react-native-image-picker' or its corresponding type declarations. #1554

Motivation (required)

What existing problem does the pull request solve?

This fixes the issue 'Cannot find module 'react-native-image-picker' or its corresponding type declarations.' #1554

Test Plan (required)

Tested fine after changing types path.

Fix for Cannot find module 'react-native-image-picker' or its corresponding type declarations. react-native-image-picker#1554
@Johan-dutoit
Copy link
Collaborator

Can you share your tsconfig setup (along with whatever other relevant setup), as I'm not experiencing this issue.

@xgenem
Copy link
Contributor Author

xgenem commented Jan 18, 2021

I have a feeling that it is eslint's default configuration that showed this warning. But here's my tsconfig file and .eslintrc.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": ["dom", "esnext"],
    "moduleResolution": "node",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true
  },
  "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
  "exclude": [
    "node_modules",
    "babel.config.js",
    "jest.config.js",
    "**/*.test.ts",
    "**/*.test.tsx"
  ]
}
{
  "extends": [
    "@react-native-community",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript"
  ],
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint", "import"],
  "overrides": [
    {
      "files": ["__mocks__/**/*.ts", "__mocks__/**/*.tsx"],
      "env": {
        "jest": true
      }
    }
  ],
  "settings": {
    "import/ignore": ["node_modules/react-native/index\\.js$"],
    "import/extensions": [".js", ".jsx", ".ts", ".tsx"],
    "import/order": [
      "error",
      {
        "groups": ["builtin", "external", "internal"],
        "pathGroups": [
          {
            "pattern": "react",
            "group": "external",
            "position": "before"
          },
          {
            "pattern": "@moxie/**",
            "group": "internal",
            "position": "after"
          }
        ],
        "pathGroupsExcludedImportTypes": ["react"],
        "newlines-between": "always",
        "alphabetize": {
          "order": "asc",
          "caseInsensitive": true
        }
      }
    ]
  },
  "rules": {
    "react-native/no-unused-styles": "error",
    "react-native/sort-styles": ["error", "asc"],
    "react-hooks/exhaustive-deps": "warn",
    "import/no-unresolved": "off",
    "import/namespace": "off",
    "react/jsx-sort-props": [
      "error",
      {
        "ignoreCase": true
      }
    ],
    "@typescript-eslint/no-unused-vars": "off"
  }
}

Curious if it matters, there's no src directory inside lib/typescript. Shouldn't it be an obvious fix?

@Johan-dutoit
Copy link
Collaborator

Johan-dutoit commented Jan 19, 2021

@xgenem good point about there being no src directory inside the lib/typescript folder.

Having a look at the history, it was changed away from this PR's change to include src.

Let me investigate a bit more.

@Johan-dutoit
Copy link
Collaborator

When I build the package locally, it does have lib/typescript/src/index.ts:
image

When viewing the package via my node_modules (where I install via npm), it doesn't include the src folder:
image

Nor is it included on unpkg: https://unpkg.com/browse/react-native-image-picker@3.1.3/lib/typescript/

@Johan-dutoit
Copy link
Collaborator

The folder still existed in 3.1.1. The only real change I can think of then was CI deployments, as no relevant code changed.

Copy link
Collaborator

@Johan-dutoit Johan-dutoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Johan-dutoit Johan-dutoit merged commit fd27d94 into react-native-image-picker:main Jan 19, 2021
@xgenem
Copy link
Contributor Author

xgenem commented Jan 19, 2021

Thanks! I find it weird. Thanks for staying on top of this.

Johan-dutoit pushed a commit that referenced this pull request Jan 19, 2021
## [3.1.4](v3.1.3...v3.1.4) (2021-01-19)

### Bug Fixes

* wrong types path ([#1554](#1554)) ([#1581](#1581)) ([fd27d94](fd27d94))
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 3.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants