How do I handle Typescript error:
Property 'then' does not exist on type 'void'
My code is as follows:
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 => {} ); } }
The function definition sharereturns void, as you can also see in the error message
share
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
Therefore, you cannot call thenwhen calledshare
then
Source: https://habr.com/ru/post/1652352/More articles:Webpack bootloader does not copy files - webpackIdentification Server + Ion + Hybrid Stream OpenID - openidAngular2 - 'then' does not exist in type 'void' - angularIn Android Studio, is there a way to search for words in jar, aar, and maven imported libraries? - android-studioBash Script for secure transfer - bashUpgrading Rails 3.2 to Rails 5 - ruby-on-railsInsert image into worksheet using Base64 in VBA? - vbaHow to determine if GC.Collect () has been started manually? - garbage-collectionAndroid Studio 2.2 NullPointerException Error - javaПроизошла ошибка при запуске выбранного генератора кода: "Ссылка на объект не установлена в экземпляр объекта". Ошибка? - c#All Articles