Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Cannot build TS projects that use this library #61

Closed
szdc opened this issue Dec 11, 2018 · 0 comments
Closed

Cannot build TS projects that use this library #61

szdc opened this issue Dec 11, 2018 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@szdc
Copy link
Owner

szdc commented Dec 11, 2018

When trying to build with tsc, you get several errors like so:

error TS2307: Cannot find module '../node_modules/axios/index'

The generated index.d.ts file for example contains the following axios imports:

loginWithEmail: (email: string, password: string) => Promise<import("../node_modules/axios/index").AxiosResponse<API.LoginResponse>>;
loginWithUsername: (username: string, password: string) => Promise<import("../node_modules/axios/index").AxiosResponse<API.LoginResponse>>;

This is one level off where node_modules actually is:

- /project_root
  |- /node_modules
    |- /tiktok-api
      |- /lib
         - index.d.ts

Therefore in index.d.ts the path ../node_modules/axios/index resolves to tiktok-api/node_modules/axios/index, which is invalid.

This can be fixed by setting baseUrl to ./lib in tsconfig.json

@szdc szdc added the bug Something isn't working label Dec 11, 2018
@szdc szdc self-assigned this Dec 11, 2018
@szdc szdc closed this as completed in #62 Dec 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant