Skip to content

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

Description

@HazyFish

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" }]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions