我有一个
实用工具
.
实用工具:
import helper from "node_modules/helper" //Private package, lets just call it helper
export class util extends helper { //doesn't extend how I would expect
static utilFunction() { return "test"; }
}
在任何规范中,我都可以这样称呼它:
import {util} from "path/to/util"
import {helper} from "node_modules/helper" //dont want to have to do this
describe("Testing stuff",function(){
it("Should test the thing", function(){
util.utilFunction();
util.helperFunction(); //What I am trying to do
helper.helperFunction(); //What is currently working but I want to avoid
});
});
已安装的帮助程序包的一部分:
export class helper{
public static helperFunction{ return "test helper"; }
}
helper.helperFunction()
实用工具
基本上,npm包将补充我当前的utils,我不想单独调用/导入它们。如何扩展npm包?