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: need to update package.json or typings #4

Open
HazyFish opened this issue Apr 29, 2023 · 0 comments
Open

bug: need to update package.json or typings #4

HazyFish opened this issue Apr 29, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@HazyFish
Copy link

HazyFish commented Apr 29, 2023

https://arethetypeswrong.github.io/?p=react-gapi%401.0.2

Expected behavior
react-gapi should work with latest TypeScript compiler.

Actual behavior
importing react-gapi causes TypeScript compile-time error.

error TS7016: Could not find a declaration file for module 'react-gapi'. 'node_modules/.pnpm/react-gapi@1.0.2_react@18.2.0_typescript@5.0.4/node_modules/react-gapi/dist/esm/index.js' implicitly has an 'any' type.
  There are types at 'node_modules/react-gapi/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'react-gapi' library may need to update its package.json or typings.

To Reproduce

  • create a new Vite project with React Typescript template
  • install react-gapi and import it
  • run tsc

Environment
node: 18.12.1
pnpm: 8.3.1
TypeScript: 5.0.4

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "types": ["vite-plugin-pwa/client", "gapi", "gapi.auth2"],
    "module": "ESNext",
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}
@HazyFish HazyFish added the bug Something isn't working label Apr 29, 2023
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

1 participant