Skip to content

Add TypeScript type definitions#148

Merged
nvuillam merged 14 commits intomainfrom
copilot/add-types-for-java-caller
Feb 3, 2026
Merged

Add TypeScript type definitions#148
nvuillam merged 14 commits intomainfrom
copilot/add-types-for-java-caller

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Package was incompatible with TypeScript projects using strict mode (noImplicitAny, strictNullChecks).

Changes

  • lib/index.d.ts: Complete type definitions for JavaCaller, JavaCallerCli, and all option interfaces
  • package.json: Added types field pointing to definitions, added typescript keyword

Usage

import { JavaCaller, JavaCallerOptions } from "java-caller";

const options: JavaCallerOptions = {
    classPath: 'java/MyApp.jar',
    mainClass: 'com.example.MyApp',
    minimumJavaVersion: 11,
    javaType: "jre"
};

const java = new JavaCaller(options);
const { status, stdout, stderr } = await java.run(['-arg']);

Works with both ES modules and CommonJS. Compatible with all strict TypeScript compiler flags.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.adoptopenjdk.net
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/node-java-caller/node-java-caller/node_modules/.bin/mocha test/**/*.test.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Regarding TypeScript compatibility:</issue_title>
<issue_description>Building the TypeScript syntax for easy calling, but the require statement shows incompatibility.</issue_description>

<agent_instructions>Please can you make java-caller compliant with typescript code (that does not allow type "any") , possibility by adding types definition ?</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@nvuillam Please can you describe your error, and how to reproduce ?

With modern JS, import shoul work

import { JavaCaller } from "java-caller";</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ ACTION actionlint 4 3 0 0.11s
✅ COPYPASTE jscpd yes no no 1.74s
✅ JAVASCRIPT eslint 11 0 0 1.99s
✅ JSON jsonlint 7 0 0 0.16s
✅ JSON npm-package-json-lint yes no no 0.51s
⚠️ JSON prettier 7 1 0 0.4s
✅ JSON v8r 7 0 0 12.84s
⚠️ MARKDOWN markdownlint 6 14 0 0.8s
⚠️ MARKDOWN markdown-table-formatter 6 1 0 0.26s
✅ REPOSITORY checkov yes no no 19.07s
✅ REPOSITORY gitleaks yes no no 0.67s
✅ REPOSITORY git_diff yes no no 0.01s
✅ REPOSITORY grype yes no no 37.4s
✅ REPOSITORY secretlint yes no no 1.04s
✅ REPOSITORY syft yes no no 1.91s
✅ REPOSITORY trivy yes no no 8.85s
✅ REPOSITORY trivy-sbom yes no no 0.43s
✅ REPOSITORY trufflehog yes no no 3.69s
✅ SPELL cspell 40 0 0 3.58s
⚠️ SPELL lychee 23 2 0 0.96s
✅ TYPESCRIPT eslint 1 0 0 1.61s
⚠️ TYPESCRIPT prettier 1 1 0 0.47s
⚠️ TYPESCRIPT ts-standard 1 1 0 0.47s
⚠️ YAML prettier 8 1 3 0.46s
✅ YAML v8r 8 0 0 6.89s
✅ YAML yamllint 8 0 0 0.34s

Detailed Issues

⚠️ ACTION / actionlint - 3 errors
.github/workflows/github-dependents-info.yml:54:9: shellcheck reported issue in this script: SC2086:info:1:15: Double quote to prevent globbing and word splitting [shellcheck]
   |
54 |         run: sudo chown -R $USER:$USER .
   |         ^~~~
.github/workflows/github-dependents-info.yml:54:9: shellcheck reported issue in this script: SC2086:info:1:21: Double quote to prevent globbing and word splitting [shellcheck]
   |
54 |         run: sudo chown -R $USER:$USER .
   |         ^~~~
.github/workflows/test.yml:78:11: input "file" is not defined in action "codecov/codecov-action@v5". available inputs are "base_sha", "binary", "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "disable_telem", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "files", "flags", "force", "gcov_args", "gcov_executable", "gcov_ignore", "gcov_include", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugins", "recurse_submodules", "report_code", "report_type", "root_dir", "run_command", "skip_validation", "slug", "swift_project", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "use_pypi", "verbose", "version", "working-directory" [action]
   |
78 |           file: coverage.lcov
   |           ^~~~~
⚠️ SPELL / lychee - 2 errors
[403] https://www.npmjs.com/package/java-caller | Network error: Forbidden
[403] https://npmjs.org/package/java-caller | Network error: Forbidden
📝 Summary
---------------------
🔍 Total...........64
✅ Successful......16
⏳ Timeouts.........0
🔀 Redirected.......0
👻 Excluded........46
❓ Unknown..........0
🚫 Errors...........2

Errors in README.md
[403] https://www.npmjs.com/package/java-caller | Network error: Forbidden
[403] https://npmjs.org/package/java-caller | Network error: Forbidden
⚠️ MARKDOWN / markdown-table-formatter - 1 error
1 files contain markdown tables to format:
- README.md
⚠️ MARKDOWN / markdownlint - 14 errors
CODE_OF_CONDUCT.md:58:44 error MD034/no-bare-urls Bare URL used [Context: "nicolas.vuillamy@gmail.com"]
CODE_OF_CONDUCT.md:71:14 error MD034/no-bare-urls Bare URL used [Context: "https://www.contributor-covena..."]
CODE_OF_CONDUCT.md:76:1 error MD034/no-bare-urls Bare URL used [Context: "https://www.contributor-covena..."]
README.md:67:13 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
README.md:67:27 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
README.md:67:37 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
README.md:67:47 error MD060/table-column-style Table column style [Table pipe is missing space to the left for style "compact"]
README.md:67:1 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
README.md:67:13 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
README.md:67:27 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
README.md:67:37 error MD060/table-column-style Table column style [Table pipe is missing space to the right for style "compact"]
README.md:68:362 error MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]
README.md:70:123 error MD060/table-column-style Table column style [Table pipe has extra space to the left for style "compact"]
README.md:74:315 error MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]
⚠️ JSON / prettier - 1 error
Checking formatting...
[warn] .cspell.json
[warn] .vscode/launch.json
[warn] examples/cli_app/lib/java-caller-config.json
[warn] examples/cli_app/package.json
[warn] examples/module_app/package.json
[warn] renovate.json
[warn] Code style issues found in 6 files. Run Prettier with --write to fix.
⚠️ TYPESCRIPT / prettier - 1 error
Checking formatting...
[warn] lib/index.d.ts
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
⚠️ YAML / prettier - 1 error
Checking formatting...
[warn] .github/workflows/deploy.yml
[warn] .github/workflows/test.yml
[warn] Code style issues found in 2 files. Run Prettier with --write to fix.
⚠️ TYPESCRIPT / ts-standard - 1 error
Unable to locate the project file. A project file (tsconfig.json or tsconfig.eslint.json) is required in order to use ts-standard.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.3.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,COPYPASTE_JSCPD,JAVASCRIPT_ES,JSON_JSONLINT,JSON_V8R,JSON_PRETTIER,JSON_NPM_PACKAGE_JSON_LINT,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_CSPELL,SPELL_LYCHEE,TYPESCRIPT_ES,TYPESCRIPT_STANDARD,TYPESCRIPT_PRETTIER,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security

Copilot AI and others added 2 commits February 3, 2026 10:28
Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>
Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>
Copilot AI changed the title [WIP] Add TypeScript compatibility for java-caller Add TypeScript type definitions Feb 3, 2026
Copilot AI requested a review from nvuillam February 3, 2026 10:32
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.95%. Comparing base (19b2784) to head (60a1811).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #148   +/-   ##
=======================================
  Coverage   89.95%   89.95%           
=======================================
  Files           3        3           
  Lines         229      229           
=======================================
  Hits          206      206           
  Misses         23       23           
Flag Coverage Δ
unittests 89.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nvuillam nvuillam marked this pull request as ready for review February 3, 2026 18:10
@nvuillam nvuillam merged commit 198dd96 into main Feb 3, 2026
48 checks passed
@nvuillam nvuillam deleted the copilot/add-types-for-java-caller branch February 3, 2026 18:13
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.

Regarding TypeScript compatibility:

3 participants