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

fix: Add types of semver-utils #1387

Merged
merged 1 commit into from
Mar 25, 2024
Merged

fix: Add types of semver-utils #1387

merged 1 commit into from
Mar 25, 2024

Conversation

regseb
Copy link
Contributor

@regseb regseb commented Mar 25, 2024

npm-check-updates uses semver-utils types (e.g. in FilterFunction.ts), but they aren't included in the release.

I move @types/semver-utils in prod dependencies.


To reproduce the error:

  • package.json

    {
      "name": "testcase",
      "version": "1.0.0",
      "type": "module",
      "dependencies": {
        "npm-check-updates": "16.14.17",
        "typescript": "5.4.3"
      }
    }
  • index.ts

    import ncu from "npm-check-updates";
    
    console.log(ncu);
  1. npm install
  2. npx tsc --strict index.ts
node_modules/npm-check-updates/build/src/types/FilterFunction.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'semver-utils'. '/home/regseb/dev/testcase/node_modules/semver-utils/semver-utils.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/semver-utils` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver-utils';`

1 import { SemVer } from 'semver-utils';
                         ~~~~~~~~~~~~~~

node_modules/npm-check-updates/build/src/types/FilterResultsFunction.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'semver-utils'. '/home/regseb/dev/testcase/node_modules/semver-utils/semver-utils.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/semver-utils` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver-utils';`

1 import { SemVer } from 'semver-utils';
                         ~~~~~~~~~~~~~~

node_modules/npm-check-updates/build/src/types/GroupFunction.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'semver-utils'. '/home/regseb/dev/testcase/node_modules/semver-utils/semver-utils.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/semver-utils` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver-utils';`

1 import { SemVer } from 'semver-utils';
                         ~~~~~~~~~~~~~~

node_modules/npm-check-updates/build/src/types/TargetFunction.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'semver-utils'. '/home/regseb/dev/testcase/node_modules/semver-utils/semver-utils.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/semver-utils` if it exists or add a new declaration (.d.ts) file containing `declare module 'semver-utils';`

1 import { SemVer } from 'semver-utils';
                         ~~~~~~~~~~~~~~


Found 4 errors in 4 files.

Errors  Files
     1  node_modules/npm-check-updates/build/src/types/FilterFunction.d.ts:1
     1  node_modules/npm-check-updates/build/src/types/FilterResultsFunction.d.ts:1
     1  node_modules/npm-check-updates/build/src/types/GroupFunction.d.ts:1
     1  node_modules/npm-check-updates/build/src/types/TargetFunction.d.ts:1

@raineorshine raineorshine merged commit f18cd46 into raineorshine:main Mar 25, 2024
8 checks passed
@raineorshine
Copy link
Owner

Thanks!

raineorshine pushed a commit that referenced this pull request Mar 25, 2024
@raineorshine
Copy link
Owner

Published in v16.14.18.

@regseb regseb deleted the patch-1 branch March 25, 2024 15:31
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 this pull request may close these issues.

2 participants