JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API

Home Page:https://jmperezperez.com/spotify-web-api-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking TypeScript default export change undocumented

Jabokoe opened this issue · comments

The 1.1.0 to 1.1.1 update was actually a breaking change for TypeScript users. (For JS consumers it could make sense for it to be a minor or patch.) The change to using default export typings is a welcome one but of course breaks existing import statements.

The usage for TypeScript for use with Webpack could be updated in README

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

let spotify = new SpotifyWebApi();

While this may be obvious to seasoned TS users working with default exports to not use {} or * as here is an explanation for others still learning. This works through the 1.1.1 to the current 1.2.0 releases.

This simplified import should resolve errors like TS2694 Namespace ... /spotify-web-api-js/src-typings/spotify-web-api has no exported member SpotifyWebApiJs, TS2305 Module ... /spotify-web-api-js/src/typings/spotify-web-api has no exported member SpotifyWebApi and error TS2351.

Fixed changing the README on 1487329. Should have caught this one and ship a major update due to the breaking change.

The amendment in README will prevent other users from hitting this issue.