2

This expression is not constructable. Type 'typeof import("c:/Users/Acer/Downloads/ionicspotify4/node_modules/spotify-web-api-js/src/typings/spotify-web-api")' has no construct signatures

Here is the code:

import * as SpotifyWebApi from 'spotify-web-api-js';

export class HomePage {
result = {};
data = '';
playlists = [];
spotifyApi: any;
loggedIn = false;
loading: Loading;

constructor(public navCtrl: NavController, private storage: Storage, private plt: Platform, 
private loadingCtrl: LoadingController) {
this.spotifyApi = new SpotifyWebApi();

this.plt.ready().then(() => {
  this.storage.get('logged_in').then(res => {
    if (res) {
      this.authWithSpotify(true);
    }
  });
});

}

I am trying to load playlist of spotify using spotify api but this is giving me the error mentioned above I have tried to install it using 'npm i spotify-web-api-js' but that wont work and this still gives the same error

Same error exists in my PlaylistPage

Here is the code:

import * as SpotifyWebApi from 'spotify-web-api-js';
@IonicPage()


@Component({
  selector: 'app-playlist',
  templateUrl: './playlist.page.html',
  styleUrls: ['./playlist.page.scss'],
})


export class PlaylistPage implements OnInit{
  tracks = [];
  playlistInfo = null;
  playing = false;
  spotifyApi: any;
  currentTrack: MediaObject = null;
 loading: Loading;

  constructor(public navCtrl: NavController, public navParams: NavParams, private media: 
Media, private loadingCtrl: LoadingController) {
    let playlist = this.navParams.get('playlist');
    this.spotifyApi = new SpotifyWebApi();

    this.loadPlaylistData(playlist);
  }
1
  • I'm stuck on this too, any solutions? Commented Aug 5, 2021 at 21:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.