我应该如何处理Typescript错误:
Property 'then' does not exist on type 'void'
我的代码如下所示:
import {Component} from '@angular/core';
import {SocialSharing} from "ionic-native";
@Component({
templateUrl: 'build/pages/about/about.html'
})
export class AboutPage {
constructor() {
}
share() {
SocialSharing.share('Take a look at our app. It is great! Download it from the App Store now.',
'Take a look at our app. It is great! Download it from the App Store now.', null, null).then(
res => {},
err => {}
);
}
}
答案 0 :(得分:1)
函数share
的定义返回void,您也可以在错误消息中看到
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
因此,在致电then
share