bevry / envfile

Parse and write environment files with Node.js
Other
61 stars 10 forks source link

Could not find a declaration file for module 'envfile' (TS7016) #214

Closed zvictor closed 10 months ago

zvictor commented 1 year ago

The error below is thrown while on node v18.15.0 and typescript ^4.9.5

error TS7016: Could not find a declaration file for module 'envfile'. '/app/node_modules/.pnpm/envfile@6.18.0/node_modules/envfile/edition-es2019-esm/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/envfile` if it exists or add a new declaration (.d.ts) file containing `declare module 'envfile';`

15       const { stringify: envify } = await import("envfile");
                                                    ~~~~~~~~~
package.json ```json { "publishConfig": { "directory": "dist", "access": "public" }, "sideEffects": false, "name": "sst", "version": "2.8.27", "bin": { "sst": "cli/sst.js" }, "description": "A CLI to help deploy SST apps.", "type": "module", "license": "MIT", "scripts": { "build": "node build.mjs && tsc", "test": "vitest run", "dev": "tsc -w" }, "repository": { "type": "git", "url": "git+https://github.com/serverless-stack/sst.git", "directory": "packages/cli" }, "exports": { "./constructs/deprecated": "./constructs/deprecated/index.js", "./constructs/future": "./constructs/future/index.js", "./constructs": "./constructs/index.js", "./context": "./context/index.js", "./node/future/*": "./node/future/*/index.js", "./node/*": "./node/*/index.js", ".": "./index.js", "./*": "./*" }, "homepage": "https://sst.dev", "dependencies": { "@aws-cdk/aws-apigatewayv2-alpha": "^2.72.1-alpha.0", "@aws-cdk/aws-apigatewayv2-authorizers-alpha": "^2.72.1-alpha.0", "@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.72.1-alpha.0", "@aws-cdk/cloud-assembly-schema": "2.72.1", "@aws-cdk/cloudformation-diff": "2.72.1", "@aws-cdk/cx-api": "2.72.1", "@aws-sdk/client-cloudformation": "^3.279.0", "@aws-sdk/client-iam": "^3.279.0", "@aws-sdk/client-iot": "^3.279.0", "@aws-sdk/client-iot-data-plane": "^3.279.0", "@aws-sdk/client-lambda": "^3.279.0", "@aws-sdk/client-rds-data": "^3.279.0", "@aws-sdk/client-s3": "^3.279.0", "@aws-sdk/client-ssm": "^3.279.0", "@aws-sdk/client-sts": "^3.279.0", "@aws-sdk/config-resolver": "^3.272.0", "@aws-sdk/credential-providers": "^3.279.0", "@aws-sdk/middleware-retry": "^3.272.0", "@aws-sdk/middleware-signing": "^3.272.0", "@aws-sdk/signature-v4-crt": "^3.272.0", "@aws-sdk/smithy-client": "^3.279.0", "@babel/core": "^7.0.0-0", "@babel/generator": "^7.20.5", "@trpc/server": "9.16.0", "adm-zip": "^0.5.10", "aws-cdk-lib": "2.72.1", "aws-iot-device-sdk": "^2.2.12", "aws-sdk": "^2.1326.0", "builtin-modules": "3.2.0", "cdk-assets": "2.72.1", "chalk": "^5.2.0", "chokidar": "^3.5.3", "ci-info": "^3.7.0", "colorette": "^2.0.19", "conf": "^10.2.0", "constructs": "10.1.156", "cross-spawn": "^7.0.3", "dendriform-immer-patch-optimiser": "^2.1.0", "dotenv": "^16.0.3", "envfile": "^6.18.0", "esbuild": "0.16.13", "express": "^4.18.2", "fast-jwt": "^1.6.1", "get-port": "^6.1.2", "glob": "^8.0.3", "graphql": "*", "graphql-yoga": "^3.9.0", "immer": "9", "ink": "^4.0.0", "ink-spinner": "^5.0.0", "kysely": "^0.23.5", "kysely-codegen": "^0.10.0", "kysely-data-api": "^0.2.1", "minimatch": "^6.1.6", "openid-client": "^5.1.8", "ora": "^6.1.2", "react": "18.2.0", "remeda": "^1.3.0", "sst-aws-cdk": "2.62.2-3", "tree-kill": "^1.2.2", "undici": "^5.12.0", "uuid": "^9.0.0", "ws": "^8.11.0", "yargs": "^17.6.2" }, "devDependencies": { "@aws-sdk/client-api-gateway": "^3.208.0", "@aws-sdk/client-cloudfront": "^3.279.0", "@aws-sdk/client-codebuild": "^3.279.0", "@aws-sdk/types": "^3.272.0", "@graphql-tools/merge": "^8.3.16", "@sls-next/lambda-at-edge": "^3.7.0", "@tsconfig/node16": "^1.0.3", "@types/adm-zip": "^0.5.0", "@types/aws-iot-device-sdk": "^2.2.4", "@types/aws-lambda": "^8.10.108", "@types/babel__core": "^7.1.20", "@types/babel__generator": "^7.6.4", "@types/cross-spawn": "^6.0.2", "@types/express": "^4.17.14", "@types/glob": "^8.0.0", "@types/node": "^18.11.9", "@types/react": "^17.0.33", "@types/uuid": "^8.3.4", "@types/ws": "^8.5.3", "@types/yargs": "^17.0.13", "archiver": "^5.3.1", "tsx": "^3.12.1", "typescript": "^4.9.5", "vitest": "^0.28.3" }, "peerDependencies": { "@sls-next/lambda-at-edge": "^3.7.0" }, "peerDependenciesMeta": { "@sls-next/lambda-at-edge": { "optional": true } }, "bugs": { "url": "https://github.com/serverless-stack/sst/issues" }, "main": "index.js", "directories": { "test": "test" }, "keywords": [], "author": "" } ```
balupton commented 1 year ago

Strange, as the types are bundled. Does it work with an earlier minor version?

sosafe-tim-schumacher commented 1 year ago

I have the same problem and I think this might be related if you use esm modules. When I have more time, I can try to dig into it.

balupton commented 10 months ago

this should now be resolved with v6.21.0 https://github.com/bevry/envfile/commit/0412c0363e7505d1492017408ff83304328366a4#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

shoutout to my GitHub Sponsors for affording me the time to make this happen