Closed jayden-chan closed 3 years ago
Attempting to build a minimal TypeScript NodeJS project fails with this error:
node_modules/@apidevtools/json-schema-ref-parser/lib/index.d.ts:1:76 - error TS2307: Cannot find module 'json-schema' or its corresponding type declarations. 1 import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type } from "json-schema"; ~~~~~~~~~~~~~ Found 1 error.
yarn app-config vars and yarn app-config generate both work fine.
yarn app-config vars
yarn app-config generate
.app-config.schema.yml
type: object additionalProperties: false required: - testing properties: testing: { $ref: '#/definitions/Testing' } definitions: Testing: type: object additionalProperties: false required: [host, port] properties: host: { type: string } port: { type: integer }
.app-config.meta.yml
generate: - { file: 'src/@types/lcdev__app-config/index.d.ts' }
.app-config.yml
testing: host: testHost port: 12345
src/index.ts
import { config, loadConfig } from "@lcdev/app-config"; async function main() { await loadConfig(); // anywhere in your app, after loadConfig is complete and resolved console.log(config); // this is a JSON object, loaded from the YAML file } main();
package.json
... "devDependencies": { "@types/node": "^14.14.21", "typescript": "^4.1.3" }, "dependencies": { "@lcdev/app-config": "2" } ...
node -v
v14.15.4
yarn app-config -v
2.0.1
yarn tsc -v
Version 4.1.3
Attempting to build a minimal TypeScript NodeJS project fails with this error:
yarn app-config vars
andyarn app-config generate
both work fine..app-config.schema.yml
.app-config.meta.yml
.app-config.yml
src/index.ts
package.json
Additional info:
node -v
v14.15.4
yarn app-config -v
2.0.1
yarn tsc -v
Version 4.1.3