Skip to content

Problems with library built-in types (TS1005) #73

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

Closed
pedromoraisf opened this issue Aug 12, 2022 · 3 comments
Closed

Problems with library built-in types (TS1005) #73

pedromoraisf opened this issue Aug 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@pedromoraisf
Copy link

Describe the bug

After installing the library, when using the useUnleashContext function, I am getting an error related with internal types of this library .

Steps to reproduce the bug

  1. Run npm i --save unleash-proxy-client @unleash/proxy-client-react
  2. Import useUnleashContext in any file

Expected behavior

No response

Logs, error output, etc.

TypeScript error in /Users/pedromoraisf/www/work/admission/gupy-front-admission/admission-companies/node_modules/@unleash/proxy-client-react/dist/src/FlagContext.d.ts(2,13):
'=' expected. TS1005

     1 | import React from 'react';
   > 2 | import type { UnleashClient } from 'unleash-proxy-client';
       | ^
     3 | export interface IFlagContextValue extends Pick<UnleashClient, 'on' | 'updateContext' | 'isEnabled' | 'getVariant'> {
     4 | client: UnleashClient;
     5 | flagsReady: boolean;

Screenshots

No response

Additional context

  • I'm using skipLibCheck: true in tsconfig.json
  • node_modules has in exclude option, on tsconfig.json
  • Searching on the web, i have found this page, where one person thinks the problem has to do with some type declaration in the package.json of that lib (@unleash/proxy-client-react)

Unleash version

4.10.5

Subscription type

No response

Hosting type

No response

SDK information (language and version)

No response

@pedromoraisf pedromoraisf added the bug Something isn't working label Aug 12, 2022
@sjaanus
Copy link
Contributor

sjaanus commented Aug 17, 2022

Hey @pedromoraisf . I created an example project based on your setup, but could not reproduce this TS error. Here it is https://github.com/sjaanus/proxy-client-react-73. Does this repository also throw you the same error? Hopefully we will catch the cause of your issue. 😃

@pedromoraisf
Copy link
Author

Hey @sjaanus, how are you?

I managed to resolve the errors. For the error in the issue description, I got the resolution by upgrading to TypeScript 3.9.10 (previously it was at version 3.7.4).

Then the following error started happening:
Screenshot from 2022-08-16 15-45-28

The solution was to encapsulate UnleashProvider very high in the React render tree hierarchy. I started right after the component that starts redux, in the application.

@sjaanus
Copy link
Contributor

sjaanus commented Aug 19, 2022

@pedromoraisf Awesome to hear you got it working. If you have any more issues in future, feel free to write us again. 😃

@sjaanus sjaanus closed this as completed Aug 19, 2022
Repository owner moved this from New to Done in Issues and PRs Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants