Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript compiler errors on React Native #88

Open
sebqq opened this issue Apr 5, 2020 · 1 comment
Open

Typescript compiler errors on React Native #88

sebqq opened this issue Apr 5, 2020 · 1 comment

Comments

@sebqq
Copy link

sebqq commented Apr 5, 2020

Hello.

I keep getting following errors from TypeScript compilation (using react-fetchiung-library on React Native):

node_modules/react-fetching-library/lib/index.d.ts:15:19 - error TS2304: Cannot find name 'RequestCredentials'.

15     credentials?: RequestCredentials;
                     ~~~~~~~~~~~~~~~~~~

node_modules/react-fetching-library/lib/index.d.ts:16:13 - error TS2304: Cannot find name 'RequestCache'.

16     cache?: RequestCache;
               ~~~~~~~~~~~~

node_modules/react-fetching-library/lib/index.d.ts:17:12 - error TS2304: Cannot find name 'RequestMode'.

17     mode?: RequestMode;
              ~~~~~~~~~~~

node_modules/react-fetching-library/lib/index.d.ts:18:22 - error TS2304: Cannot find name 'ReferrerPolicy'.

18     referrerPolicy?: ReferrerPolicy;
                        ~~~~~~~~~~~~~~

node_modules/react-fetching-library/lib/index.d.ts:22:16 - error TS2304: Cannot find name 'RequestRedirect'.

22     redirect?: RequestRedirect;
                  ~

Is there any types package that I need to install in order to get these typings on React Native?

I've tried @types/node, @types/request and @types/node-fetch but without any success.

Thank you so much!

@marcin-piela
Copy link
Owner

It looks like I will need to define it in library, I will try to fix it later today.

For now you can add .d.ts file in your project with

type RequestCredentials = "include" | "omit" | "same-origin";
type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
type RequestRedirect = "error" | "follow" | "manual";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants