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.

type check not pass

See original GitHub issue

Describe/explain the bug When I run tsc in my project,it show the error that

node_modules/@nivo/core/index.d.ts:2:10 - error TS2305: Module '"react-spring"' has no exported member 'OpaqueInterpolation'.

2 import { OpaqueInterpolation, SpringConfig } from 'react-spring'
           ~~~~~~~~~~~~~~~~~~~

node_modules/@nivo/core/index.d.ts:252:12 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

252     export declare const defaultAnimate = true
               ~~~~~~~

node_modules/@nivo/core/index.d.ts:253:12 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

253     export declare const defaultMotionStiffness = 90
               ~~~~~~~

node_modules/@nivo/core/index.d.ts:254:12 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

254     export declare const defaultMotionDamping = 15
               ~~~~~~~

node_modules/@nivo/core/index.d.ts:256:12 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

256     export declare const motionDefaultProps = {
               ~~~~~~~

node_modules/@nivo/core/index.d.ts:256:47 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

256     export declare const motionDefaultProps = {
                                                  ~
257         animate: true,
    ~~~~~~~~~~~~~~~~~~~~~~
...
260         config: 'default',
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
261     }
    ~~~~~

node_modules/@nivo/core/index.d.ts:263:12 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

263     export declare const defaultMargin = {
               ~~~~~~~

node_modules/@nivo/core/index.d.ts:263:42 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

263     export declare const defaultMargin = {
                                             ~
264         top: 0,
    ~~~~~~~~~~~~~~~
...
267         left: 0,
    ~~~~~~~~~~~~~~~~
268     }
    ~~~~~

node_modules/@nivo/core/index.d.ts:291:31 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

291     export const SvgWrapper = (
                                  ~
292         props: React.PropsWithChildren<{
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
298         }>
    ~~~~~~~~~~
299     ) => JSX.Element
    ~~~~~~~~~~~~~~~~~~~~

node_modules/@nivo/core/index.d.ts:299:10 - error TS2708: Cannot use namespace 'JSX' as a value.

299     ) => JSX.Element
             ~~~

node_modules/@nivo/core/index.d.ts:311:30 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

311     export const Container = (props: React.PropsWithChildren<ContainerProps>) => JSX.Element
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@nivo/core/index.d.ts:311:82 - error TS2708: Cannot use namespace 'JSX' as a value.

311     export const Container = (props: React.PropsWithChildren<ContainerProps>) => JSX.Element
                                                                                     ~~~

node_modules/@nivo/core/index.d.ts:313:38 - error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.

313     export const ResponsiveWrapper = (props: {
                                         ~~~~~~~~~
314         children: (dimensions: { width: number; height: number }) => JSX.Element
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315     }) => JSX.Element
    ~~~~~~~~~~~~~~~~~~~~~

node_modules/@nivo/core/index.d.ts:315:11 - error TS2708: Cannot use namespace 'JSX' as a value.

315     }) => JSX.Element
              ~~~

Found 14 errors.

To Reproduce

Steps to reproduce the behavior:

  1. create a vite project
  2. install @nivo/calendar and @nivo/core
  3. import @nivo/calendar
  4. run tsc

Expected behavior no error

Screenshots image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
wyzecommented, Apr 26, 2021

This is fixed in the latest version.

1reaction
mrmartineaucommented, Mar 31, 2021

If u set skipLibCheck,tsc will ignore all .d.ts files, so there is no error message

My /s was meant to denote sarcasm…

I also notice that react-spring was recently updated to v9.0.0 and moved out of release candidate stage. A PR for that change in this library should also be created. If I get time, I will do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript function passes type check when not expected to
The line identityOrCall(() => 'x') appears to pass the compiler's type checking. Why? Shouldn't it give an error? If identityOrCall is passed a ......
Read more >
Type checking stops after spread operator #47995 - GitHub
Type mismatch is missed after use of spread operator. Expected behavior. I expect a "Type 'number' is not assignable to type 'string | ......
Read more >
Documentation - Narrowing - TypeScript
Checking whether the kind property was "circle" got rid of every type in Shape that didn't have a kind property with the type...
Read more >
Methods for TypeScript runtime type checking - LogRocket Blog
Explore five methods of performing TypeScript type checks at runtime in this post and learn each of their advantages and disadvantages.
Read more >
Common issues and solutions - mypy 0.991 documentation
Functions that do not have any annotations (neither for any argument nor for the return type) are not type-checked, and even the most...
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