加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何使atom-typescript识别没有相对路径的模块?

发布时间:2020-12-17 10:23:04 所属栏目:安全 来源:网络整理
导读:我跟着 angular-meteor tutorial using angular2 and typescript. 由于我正在使用atom,我添加了atom-typescript包和tsconfig文件以利用类型声明文件. 我正在尝试使atom-typescript识别客户端/派对形式/ parties_form.ts上的导入: import {Parties} from 'co
我跟着 angular-meteor tutorial using angular2 and typescript.

由于我正在使用atom,我添加了atom-typescript包和tsconfig文件以利用类型声明文件.

我正在尝试使atom-typescript识别客户端/派对形式/ parties_form.ts上的导入:

import {Parties} from  'collections/parties';

但原子给我以下错误:无法找到模块’集合/派对’.

使用相对路径导入模块时,错误消失:

import {Parties} from '../../collections/parties';

但是流星不会编译并给我一个Path预留冲突错误.

我希望能够使用第一种导入而不使用atom-typescript给我任何错误,从而识别我的类型声明文件.我错过了什么 ?

我的tsconfig.json文件:

{
    "version": "1.5.0","compilerOptions": {
        "target": "es5","module": "commonjs","declaration": false,"noImplicitAny": false,"removeComments": true,"noLib": false,"emitDecoratorMetadata": true
    },"filesGlob": [
        "./**/*.ts","!./typings/**/*.ts"
    ]
}

完整版的教程代码可以在here找到.

import {Parties} from '../../collections/parties';

此要求并非特定于atom-typescript. TypeScript不支持node_modules之外的自己代码的非相对路径.有关详细信息,请跟踪此问题:https://github.com/Microsoft/TypeScript/issues/5039

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读