当自己的node.js软件包发布在NPM上时,缺少类型的定义信息在VS代码中
我无法弄清楚为什么,一旦我自己的 efficy> efficy-enterprise-api
NPM软件包已发布,与本地引用软件包相比,类型定义(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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将问题推导为使用的分离
./@ 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 onlyindex.mjs
)By running typescript tsc without
outDir=@typings
configured, the typings are fully functional.