简体   繁体   English

是否有可能只有 typescript npm package?

[英]Is it possible to have a typescript only npm package?

I have a project which is only ever meant to be used with typescript projects and would like to have code inspection go to the actual lines of typescript code (rather than a definition file).我有一个项目,它只打算与 typescript 项目一起使用,并希望对 typescript 代码的实际行(而不是定义文件)进行代码检查 go。

I can't seem to figure out how to set up an npm project for this.我似乎不知道如何为此设置 npm 项目。

I have main set properly in package.json我在 package.json 中正确设置了主要设置

{
  // package.json details omitted
  main: "./src/index.ts"
}

Upon inspection, I have verified existence of node_modules/my-project/src/index.ts .经过检查,我已经验证了node_modules/my-project/src/index.ts But when I go to import * from "my-project";但是当我 go import * from "my-project"; I get the error:我得到错误:

Can not find module找不到模块


This seems to indicate it's not possible to have typescript only npm projects, but I'd like to verify that I'm not just making a mistake.这似乎表明不可能只有 typescript 项目 npm 项目,但我想验证我不只是犯了一个错误。

Is it possible to have a typescript only npm package?是否有可能只有 typescript npm package?

Sorry.对不起。 It was a stupid mistake, but I still think it's important to have this information easily discoverable.这是一个愚蠢的错误,但我仍然认为让这些信息易于发现很重要。

It is totally possible to create an npm package with only typescript.完全可以只用 typescript 创建 npm package。 If you are having issues with this, it is likely due to a mistake in the set up your package.json.如果您遇到此问题,可能是由于设置 package.json 时出现错误。 Double check spelling.仔细检查拼写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM