打字稿中的 crud 操作:无法在打字稿中找到名称客户

crud operation in typescript: Cannot find name customer in typescript

我正在使用 typescript 创建一个 crud, 我刚开始 typescript 并且对 typescript 一无所知。

我正在 this example

的帮助下创建 crud

这里我的 api 部分已经准备就绪,当我开始使用打字稿时,

我在这一行遇到错误

错误:

我的整个代码块

/// <reference path="typings/jquery/jquery.d.ts" />
module StudentModule {
    export class Student {
        Id: number;
        Fname: string;
        Lname: string;
        Address: string;
    }
    customer(callback: any) {
        $.getJSON("api/customers", callback);
    }
}

这里有什么问题,

并且,有人可以建议我更好的 CRUD 操作示例吗?

如果客户与学生 class 不同,您的代码应为:

/// <reference path="typings/jquery/jquery.d.ts" />
module StudentModule {
    export class Student {
        Id: number;
        Fname: string;
        Lname: string;
        Address: string;

        customer(callback: any) {
            $.getJSON("api/customers", callback);
        }
    }
}