ParseObject类字段

时间:2018-10-26 18:41:14

标签: typescript parse-platform

我扩展了自定义的ParseObject并尝试获取字段而无需调用object.get("fieldName")

代码如下:

export class NavigationImpl extends Parse.Object implements Navigation{

    timeSec: number;

    constructor() {
        super('Navigation');
    }

    static async afterSaveTrigger (request: Parse.Cloud.AfterSaveRequest){
        let navigation: NavigationImpl = <NavigationImpl> request.object;
        console.log(`ID:${navigation.id} Nav time: ${navigation.timeSec}`);
        console.log(`Nav time old school: ${navigation.get('timeSec')}`);
        return navigation;
    };
}

interface Navigation {
    timeSec: number;
}

日志正在打印如下内容:

ID: 3 Nav time: undefined
Nav time old school 10

知道我在做什么错吗?

0 个答案:

没有答案