共享实用程序类中无法识别TypeScript自定义函数



我有一个TypeScript类用以下声明实现接口。在这个类中,我在类文件的开头导入了.js,并实现了每个函数。一切都很好,直到我在接口中添加了一个新函数,并在类中实现了这个新函数。当项目发布到IIS主机(包括删除现有目标文件夹中的所有文件(时,Edge浏览器无法识别附加功能。我把这个项目重新发表了好几次都没有用。第二天,功能被识别。新函数总是在编译时立即被识别。有人知道为什么吗?

form.ts: 254
Uncaught TypeError: commonUtility.isTheSame is not a
function
at HTMLInputElement. < anonymous > (form.ts: 254: 25)
at Function.each(jquery - 3.6 .0.min.js: 2: 3003)
at S.fn.init.each(jquery - 3.6 .0.min.js: 2: 1481)
at Object.submitTheForm(form.ts: 241: 18)
at HTMLButtonElement. < anonymous > (form.ts: 86: 22)
at HTMLButtonElement.dispatch(jquery - 3.6 .0.min.js: 2: 43064)
at HTMLButtonElement.v.handle(jquery - 3.6 .0.min.js: 2: 41048)

export interface ICommonUtility {
isDate(aDate: Date): boolean;
isEmpty($this: any): boolean;
isTheSame($this: any, oldValue: string, currentValue: string): boolean;
getCRUD($this: any, oldValue: string, currentValue: string): string;
getControlValue($this: any): number;
resetControlValue($this: any, newValue: string)
getTextPixels(someText: string, font: any);
breakLongSentence(thisSelectElement);
}

/// <reference path="../../node_modules/@types/jquery/jquery.d.ts" />
import { ICommonUtility } from "../appModels/ICommonUtility.js";
export class Utility implements ICommonUtility {
isDate(aDate: Date): boolean {

}
isEmpty($this: any): boolean {

}
isTheSame($this: any, oldValue: string, currentValue: string): boolean {
}
getCRUD($this: any, oldValue: string, currentValue: string): string {

}
getControlValue($thisControl: any, valueSource: string = 'other'): any {

}
resetControlValue($thisControl: any, newValue: string) {
}
getTextPixels(someText: string, font: any) {
}
breakLongSentence(thisSelectElement: any) {
}
}

当isTheSame((在实现Utility类中变成公共的isTheSame((时,它就工作了。仍然不知道为什么这是必要的。

最新更新