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]: types missing in package.json exports for esm project #511

Closed
alexn-s opened this issue Apr 24, 2023 · 2 comments
Closed

[BUG]: types missing in package.json exports for esm project #511

alexn-s opened this issue Apr 24, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@alexn-s
Copy link

alexn-s commented Apr 24, 2023

What version of drizzle-orm are you using?

0.25.01

What version of drizzle-kit are you using?

0.17.6

Describe the Bug

the type key is missing in the exports values.
currently typescript and vscode dont find the types, because they are not part of the exports.

#502 @dankochetov

image

project configs

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "allowUnusedLabels": false,
    "baseUrl": "src",
    "declaration": true,
    "emitDeclarationOnly": false,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "lib": ["DOM", "ES2021"],
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noUncheckedIndexedAccess": true,
    "outDir": "dist",
    "plugins": [],
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "strictNullChecks": true,
    "target": "ESNext",
    "types": ["node"]
  },
  "display": "Default",
  "exclude": [],
  "include": ["src"]
}

package.json

{
  "name": "orm-compare",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/node": "^18.16.0",
    "drizzle-kit": "^0.17.6",
    "drizzle-orm": "^0.25.1",
    "mysql2": "^3.2.3"
  },
  "devDependencies": {}
}

fix

package.json -> exports

  ".": {
      "import": "./index.mjs",
      "require": "./index.cjs"
    },
...
 ".": {
  "import": "./index.mjs",
  "default": "./index.mjs",
  "require": "./index.cjs",
  "types": "./index.d.ts"
    },
...

also i suggest to add the default key (i think esm should be the default to be future oriented)
the types need to be added for all export objects

Expected behavior

No response

Environment & setup

No response

@alexn-s alexn-s added the bug Something isn't working label Apr 24, 2023
@dankochetov
Copy link
Contributor

Interesting! That's a lot of boilerplate. Fortunately, those entries are auto-generated, so it'll be easy to add the additional properties. Will fix, thank you!

@dankochetov dankochetov self-assigned this Apr 24, 2023
@dankochetov
Copy link
Contributor

@alexn-s should be fixed in drizzle-orm@beta, please check

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