我在两个单独的文件中有两个类,一个从另一个扩展。基类包含一些import
使用节点模块的语句。我不清楚为什么派生类(在单独的文件中)不能识别基类!!!???
有人可以澄清一下吗?
// UtilBase.ts
/// <reference path="../typings/node.d.ts" />
/// <reference path="../typings/packages.d.ts" />
import * as path from "path"; // <---- THIS LINE BREAKS THE BUILD!!!!
namespace My.utils {
export class UtilBase {
protected fixPath(value: string): string {
return value.replace('/', path.sep);
}
}
}
接着
// UtilOne.ts
/// <reference path="UtilBase.ts" />
namespace My.utils {
export class UtilOne extends My.utils.UtilBase {
}
}
编译后我得到:
src/UtilOne.ts(6,47): error TS2339: Property 'UtilBase' does not
exist on type 'typeof utils'