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

js-yaml doesn't export types #35

Open
regseb opened this issue Apr 22, 2023 · 0 comments · May be fixed by #36
Open

js-yaml doesn't export types #35

regseb opened this issue Apr 22, 2023 · 0 comments · May be fixed by #36

Comments

@regseb
Copy link

regseb commented Apr 22, 2023

Description

YAML Lint imports types from js-yaml, but this package doesn't export types. The types are in the @types/js-yaml package.

[email protected]/dist/index.d.ts:

declare const schemas: {
    readonly FAILSAFE_SCHEMA: import("js-yaml").Schema;
    readonly JSON_SCHEMA: import("js-yaml").Schema;
    readonly CORE_SCHEMA: import("js-yaml").Schema;
    readonly DEFAULT_SCHEMA: import("js-yaml").Schema;
};

To reproduce

Files

  • package.json
{
    "name": "testcase",
    "version": "1.0.0",
    "private": true,
    "dependencies": {
        "typescript": "5.0.4",
        "yaml-lint": "1.7.0"
    }
}
  • index.js
import yamlLint from "yaml-lint";

console.log(yamlLint);

Commands

npm install
npx tsc --allowJs --noEmit --strict index.js

Results

node_modules/yaml-lint/dist/index.d.ts:2:38 - error TS7016: Could not find a declaration file for module 'js-yaml'. '/home/regseb/testcase/node_modules/js-yaml/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/js-yaml` if it exists or add a new declaration (.d.ts) file containing `declare module 'js-yaml';`

2     readonly FAILSAFE_SCHEMA: import("js-yaml").Schema;
                                       ~~~~~~~~~

node_modules/yaml-lint/dist/index.d.ts:3:34 - error TS7016: Could not find a declaration file for module 'js-yaml'. '/home/regseb/testcase/node_modules/js-yaml/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/js-yaml` if it exists or add a new declaration (.d.ts) file containing `declare module 'js-yaml';`

3     readonly JSON_SCHEMA: import("js-yaml").Schema;
                                   ~~~~~~~~~

node_modules/yaml-lint/dist/index.d.ts:4:34 - error TS7016: Could not find a declaration file for module 'js-yaml'. '/home/regseb/testcase/node_modules/js-yaml/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/js-yaml` if it exists or add a new declaration (.d.ts) file containing `declare module 'js-yaml';`

4     readonly CORE_SCHEMA: import("js-yaml").Schema;
                                   ~~~~~~~~~

node_modules/yaml-lint/dist/index.d.ts:5:37 - error TS7016: Could not find a declaration file for module 'js-yaml'. '/home/regseb/testcase/node_modules/js-yaml/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/js-yaml` if it exists or add a new declaration (.d.ts) file containing `declare module 'js-yaml';`

5     readonly DEFAULT_SCHEMA: import("js-yaml").Schema;
                                      ~~~~~~~~~


Found 4 errors in the same file, starting at: node_modules/yaml-lint/dist/index.d.ts:2
@regseb regseb linked a pull request May 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant