Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SystemJS的Typescript:找不到自己的模块_Typescript_Systemjs - Fatal编程技术网

SystemJS的Typescript:找不到自己的模块

SystemJS的Typescript:找不到自己的模块,typescript,systemjs,Typescript,Systemjs,我开发了一个模块,现在我想把这个模块从应用程序中取出,放到node_模块中。但有一个错误TS2307:找不到模块“二部图”。其中,二部图是我自己的模块 这是我的systemjs.config.ts: 这是app.ts: 该项目是透明的,最终的应用程序可以正常运行,但Webstorm和tsc会抛出错误。我导入了rxjs进行比较,但我找不到关键的区别。我错过了什么?我尝试将模块放入节点_模块,并在systemjs.config.ts中更改了路径,但没有任何帮助。可以在上找到整个项目。typescri

我开发了一个模块,现在我想把这个模块从应用程序中取出,放到node_模块中。但有一个错误TS2307:找不到模块“二部图”。其中,二部图是我自己的模块

这是我的systemjs.config.ts:

这是app.ts:


该项目是透明的,最终的应用程序可以正常运行,但Webstorm和tsc会抛出错误。我导入了rxjs进行比较,但我找不到关键的区别。我错过了什么?我尝试将模块放入节点_模块,并在systemjs.config.ts中更改了路径,但没有任何帮助。可以在上找到整个项目。

typescript编译器找不到您的二分图模块,因为它没有读取您的systemJS配置。您必须添加一个tsconfig.json文件(如果还没有),并设置baseUrl和路径选项

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "bipartite-graph": ["app/bipartite-graph"],
      ...other path mappings
    }
  }
}
有关此主题的更多信息,请参见官方文件:

import { Subject } from 'rxjs/Subject';
import BipartiteGraph from 'bipartite-graph';

let subject: Subject<boolean> = new Subject<boolean>();
let bg = new BipartiteGraph([35, 50, 40], [45, 20, 30, 30], [[8, 6, 10, 9], [9, 12, 13, 7], [14, 9, 16, 5]]);

const n = 3, m = 4;

let i = 1, j = 1;
while (i <= n && j <= m) {
  bg.setAmount(i, j, Math.min(bg.getCapacity(i), bg.getDemand(j)));
  bg.setCapacity(i, bg.getCapacity(i) - bg.getAmount(i, j)); bg.setDemand(j, bg.getDemand(j) - bg.getAmount(i, j));
  if (bg.getCapacity(i) === 0) {
    i = i + 1;
  } else {
    j = j + 1;
  }
}

bg.draw();
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "bipartite-graph": ["app/bipartite-graph"],
      ...other path mappings
    }
  }
}