小编Arc*_*ate的帖子

打字稿:无法找到我的自定义库的模块

问题

当我从'ng2-orm'导入Config时,为什么我的ng2-orm包不被导入(或被vscode识别);

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }   from './app.component';
import { Config } from 'ng2-orm'; // ng2-orm/Config won't work either

@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

细节

我正在努力构建我自己的TS库,用于angular2和ionic2.我已经研究和搜索,似乎无法想出为什么这是失败的,这可能只是由于我的某种不完整性.

我知道这只是一个开始,但我认为从项目内部导出的任何东西都应该是可访问的.我需要一个ngModule定义吗?

我提供了package.json,一些文件夹结构,gulp(所以你可以看到它)和tsconfig.json

一切都很精细等等.

但是,当我在角度快速启动时安装它时,它表示当我尝试导入时无法找到ng2-orm.我将所有内容都装入了index.js,并且该软件包位于node_modules文件夹中.

我错过了systemjs.config.js需要的东西吗?我不确定.我有一个typings.json,但它基本上是空的,也许我错过了那里的东西?

index.ts

export * from './Config/Config';
Run Code Online (Sandbox Code Playgroud)

配置/ Config.ts

export class Config {
  public test(): boolean { return true; }
}
Run Code Online (Sandbox Code Playgroud)

定义文件

index.d.ts

export * …
Run Code Online (Sandbox Code Playgroud)

typescript ionic2 angular

7
推荐指数
1
解决办法
4438
查看次数

标签 统计

angular ×1

ionic2 ×1

typescript ×1