TypeScript语言规范的第6.3节讨论了函数重载,并给出了如何实现它的具体示例.但是,如果我尝试这样的事情:
export class LayerFactory {
constructor (public styleFactory: Symbology.StyleFactory) { }
createFeatureLayer (userContext : Model.UserContext, mapWrapperObj : MapWrapperBase) : any {
throw "not implemented";
}
createFeatureLayer(layerName : string, style : any) : any {
throw "not implemented";
}
}
Run Code Online (Sandbox Code Playgroud)
即使函数参数属于不同类型,我也会收到指示重复标识符的编译器错误.即使我在第二个createFeatureLayer函数中添加了一个额外的参数,我仍然会遇到编译器错误.想法,请.