Version: 3.2.2
我有一个 person.js 文件和 test.ts 文件,在 js 文件中创建了一个 student 类和 person 对象,并且把 student 的 prototype 设置为 person,然后导出 student 的实例。
接着,在 test 文件中访问 student 的实例,但是 ts 却访问不到 student 的 prototype 上的属性(也就是 person 上的属性)。
person.js
let student = function () { this.age=12;
}let person = {};
person.name=22;
student.prototype=person;let tom = new student();
exports.tom =tom;test.ts
import * as person from './person'; person.tom.name

青春有我
随时随地看视频慕课网APP
相关分类