属性 'then' 在类型 'void' 上不存在
Property 'then' does not exist on type 'void'
我应该如何处理 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 => {}
);
}
}
函数的定义share
returns void 也可以在错误信息中看到
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
因此你不能在调用share
时调用then
我应该如何处理 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 => {}
);
}
}
函数的定义share
returns void 也可以在错误信息中看到
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
因此你不能在调用share
时调用then