当自己的node.js软件包发布在NPM上时,缺少类型的定义信息在VS代码中

发布于 2025-01-31 05:24:49 字数 976 浏览 1 评论 0原文

我无法弄清楚为什么,一旦我自己的 efficy> efficy-enterprise-apiNPM软件包已发布,与本地引用软件包相比,类型定义(VS Code Intellisense使用)不再可用,例如import {crmrpc}来自“ ../ efficy-enterprise-api” ;

软件包用JSDOC注释写在本机ES6(使用.MJS扩展名)中。

本地引用Node.js软件包时没有问题:

import { CrmRpc } from "../efficy-enterprise-api";

const crm = new CrmRpc(); // Type definition CrmRpc is accessible
const Cont = crm.openEditObject("Cont", 0); // Type definition "EditObject" is accessible

引用已发布的软件包时缺少类型定义:

import { CrmRpc} from "efficy-enterprise-api";

const crm = new CrmRpc(); // Type definition CrmRpc is accessible
const Cont = crm.openEditObject("Cont", 0); // Type definition "EditObject" is not accessible anymore...

I cannot figure out why, once my own efficy-enterprise-api NPM package is published, the type definitions (used by VS Code intellisense) are not available anymore compared to locally referencing the package, e.g. import { CrmRpc} from "../efficy-enterprise-api";

Package is written in native ES6 (using .mjs extension) with JSDoc annotations.

No issue when locally referencing the Node.js package:

import { CrmRpc } from "../efficy-enterprise-api";

const crm = new CrmRpc(); // Type definition CrmRpc is accessible
const Cont = crm.openEditObject("Cont", 0); // Type definition "EditObject" is accessible

Missing type definitions when referencing the published package:

import { CrmRpc} from "efficy-enterprise-api";

const crm = new CrmRpc(); // Type definition CrmRpc is accessible
const Cont = crm.openEditObject("Cont", 0); // Type definition "EditObject" is not accessible anymore...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们的影子 2025-02-07 05:24:49

我将问题推导为使用的分离./@ typings generate .mts and .mts.map files的文件夹。 来指向这些多个生成的文件(不仅是index.mjs)的功能配置。

我无法通过运行TypeScript TSC 没有 OUTDIR = @Typings已配置,键入功能充分。

I deduced the issue to the usage of the separated ./@typings folder for the generate .mts and .mts.map files. I was unable to find a functional configuration of package.json to point to these multiple generated files (not only index.mjs)

By running typescript tsc without outDir=@typings configured, the typings are fully functional.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文