moshest / next-client-cookies

SSR and client support for cookies in Next.js 13 (app directory)
MIT License
149 stars 9 forks source link

TypeScript issue #1

Closed nles closed 1 year ago

nles commented 1 year ago

Hi, I'm getting this TypeScript error when importing the server part:

image

Linter doesn't complain when imported from next-client-cookies/dist/server, but that'll break the runtime.

Bit weird, since you are using TypeScript here and have things properly typed. Probably some sort of a misconfiguration here or on my end..

Here's my tsconfig.json:

{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "incremental": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    },
    "plugins": [
      {
        "name": "next"
      }
    ],
    "strictNullChecks": true
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "constants.mjs"],
  "exclude": ["node_modules"]
}
moshest commented 1 year ago

I think it's related to old TypeScript version that can't read properly the package exports section.

I've released a fix under 1.0.1, please check if it works for you.