question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript errors

See original GitHub issue

When importing your module into our project, yarn tsc returns a lot of errors. I guess you don’t include tsc in your tests, but only rely on the output of eslint? It’s the only package which has issues like that.

Sadly it’s very hard to fix this error on our side since the ts config exclude option does not allow the exclusion of required file.

We are using typescript v4.5.4. Here the output:

yarn run v1.22.17
node_modules/react-native-floating-label-input/src/index.tsx:25:30 - error TS2307: Cannot find module './assets/make_visible_white.png' or its corresponding type declarations.

25 import makeVisibleWhite from './assets/make_visible_white.png';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:26:32 - error TS2307: Cannot find module './assets/make_invisible_white.png' or its corresponding type declarations.

26 import makeInvisibleWhite from './assets/make_invisible_white.png';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:27:30 - error TS2307: Cannot find module './assets/make_visible_black.png' or its corresponding type declarations.

27 import makeVisibleBlack from './assets/make_visible_black.png';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:28:32 - error TS2307: Cannot find module './assets/make_invisible_black.png' or its corresponding type declarations.

28 import makeInvisibleBlack from './assets/make_invisible_black.png';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:340:9 - error TS2322: Type 'BackwardCompatibleWrapper' is not assignable to type 'CompositeAnimation'.

340         timing(fontColorAnimated, {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
341           toValue: 1,
    ~~~~~~~~~~~~~~~~~~~~~
... 
343           easing: EasingNode.linear,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344         }),
    ~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:390:9 - error TS2322: Type 'BackwardCompatibleWrapper' is not assignable to type 'CompositeAnimation'.

390         timing(fontColorAnimated, {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
391           toValue: 1,
    ~~~~~~~~~~~~~~~~~~~~~
... 
393           easing: EasingNode.linear,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394         }),
    ~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:432:9 - error TS2322: Type 'BackwardCompatibleWrapper' is not assignable to type 'CompositeAnimation'.

432         timing(fontColorAnimated, {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
433           toValue: 0,
    ~~~~~~~~~~~~~~~~~~~~~
... 
435           easing: EasingNode.linear,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436         }),
    ~~~~~~~~~~

node_modules/react-native-floating-label-input/src/index.tsx:509:5 - error TS2322: Type 'AnimatedNode<string | number>' is not assignable to type 'ColorValue'.
  Type 'AnimatedNode<string | number>' is not assignable to type 'OpaqueColorValue'.
    Type 'AnimatedNode<string | number>' is not assignable to type 'symbol'.

509     color: interpolateColors(fontColorAnimated, {
        ~~~~~

  node_modules/@types/react-native/index.d.ts:922:5
    922     color?: ColorValue | undefined;
            ~~~~~
    The expected type comes from property 'color' which is declared here on type 'TextStyle'

src/lib/floating-label-input.ts:1:16 - error TS2664: Invalid module name in augmentation, module './assets/make_visible_white.png' cannot be found.

1 declare module './assets/make_visible_white.png';
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tsconfig.json:17:5 - error TS5010: File specification cannot end in a recursive directory wildcard ('**'): 'node_modules/react-native-floating-label-input/src/**'.

17     "node_modules/react-native-floating-label-input/src/**"
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 10 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Snowirbixcommented, Jul 12, 2022

Just had to copy your global.d.ts file in my src/ folder and it worked.

1reaction
Snowirbixcommented, Jul 12, 2022

Hello @Cnilton, I still see some of the errors on the latest release 1.4.2 :

node_modules/react-native-floating-label-input/src/index.tsx:32:30 - error TS2307: Cannot find module './assets/make_visible_white.png' or its corresponding type declarations.
32 import makeVisibleWhite from './assets/make_visible_white.png';

node_modules/react-native-floating-label-input/src/index.tsx:34:32 - error TS2307: Cannot find module './assets/make_invisible_white.png' or its corresponding type declarations.
34 import makeInvisibleWhite from './assets/make_invisible_white.png';

node_modules/react-native-floating-label-input/src/index.tsx:36:30 - error TS2307: Cannot find module './assets/make_visible_black.png' or its corresponding type declarations.
36 import makeVisibleBlack from './assets/make_visible_black.png';

node_modules/react-native-floating-label-input/src/index.tsx:38:32 - error TS2307: Cannot find module './assets/make_invisible_black.png' or its corresponding type declarations.
38 import makeInvisibleBlack from './assets/make_invisible_black.png';

Is there any workaround ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Understanding Errors - TypeScript
Whenever TypeScript finds an error, it tries to explain what went wrong in as much detail as possible. Because its type system is...
Read more >
TypeScript errors and how to fix them
TypeScript errors and how to fix them. Common Errors. Below you find a list of common TypeScript errors along with the buggy code...
Read more >
Interpreting Errors - TypeScript Deep Dive - Gitbook
Since TypeScript is a heavily focused Developer Help oriented programming language, its errors messages try to be super helpful when something goes wrong....
Read more >
Understanding TypeScript Errors for Beginners
A pretty common issue that new TypeScript developers encounter in a TypeScript based project is the “Could not find declaration file for module…...
Read more >
Common TypeScript errors and how to fix them - Payton.Codes
Finding and reading TypeScript errors · Handling falsy variables · Something is not a string · Incorrect inference from JavaScript · Using Array....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found