ts开发npm 包发布到私有仓库,新建angular项目install后在ts里引用包后f12不能跟踪到index.d.ts?

下面是我npm包里面 package.json 文件
`{
"name": "npm-template-of-ts",
"version": "1.0.0",
"description": "typeScript npm template",
"main": "index.js",
"dependencies": {
},
"scripts": {

"build": "tsc",
"test": "jest"

},
"author": {

"name": "hyzhang",
"email": "zhanghongyi@flexem.cn"

},
"license": "MIT",
"keywords": [

"typeScript npm template npm-template-of-ts"

],
"devDependencies": {

"jest": "^24.8.0",
"typescript": "^3.4.5"

}
}`
发布到我的私有仓库后
new 了个新的angular 项目并且 install我发布的包

我在angular里面引用如下图
image.png

1、我在vscode 使用f12跟踪代码不能跳转?

2、安装下图的方法调用我可以调用到sayHello方法,并且可以打印出hello
image.png

image.png

阅读 3.2k
1 个回答

可能是 package.json 里少了
"typings": {// 你的类型定义文件 *.d.ts的路径}

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题