Type error and npm package