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 namespace errors

See original GitHub issue

When trying to compile to typescript I am getting the following errors:

node_modules/@types/react-select/src/components/Control.d.ts:21:34 - error TS2694: Namespace 'React' has no exported member 'MouseEvent'.

21       onMouseDown: (event: React.MouseEvent<HTMLElement>) => void,
                                    ~~~~~~~~~~

node_modules/@types/react-select/src/components/Control.d.ts:25:42 - error TS2694: Namespace 'React' has no exported member 'CSSProperties'.

25 export function css(state: State): React.CSSProperties;

These are the types I have installed:

"@types/react": "^16.9.36",
"@types/react-dom": "^16.9.8",
"@types/react-select": "^3.0.13",
"@types/react-transition-group": "^4.4.0",

This is the command I’m currently using to compile: tsc src/*.tsx --jsx 'react' --outDir lib/

Note: I am using Preact

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bladeycommented, Jun 25, 2020

Hey @c2rob, @Methuselah96, and @RyanChristian4427,

Thanks for the help provided here. If this is indeed something that react-select doesn’t need to solve, I’ll close this issue for now, however if you think it should be re-opened, please do let me know.

0reactions
rschristiancommented, Jun 24, 2020

It is indeed a Preact issue, the types exported aren’t as complete as could be desired. Contributions are always welcome though.

This isn’t something for react-select to fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Namespaces - TypeScript
This post outlines the various ways to organize your code using namespaces (previously “internal modules”) in TypeScript. As we alluded in our note...
Read more >
How do I use namespaces with TypeScript external modules?
I have some code: baseTypes.ts export namespace Living.Things ...
Read more >
Fixing the "Cannot Use Namespace as a Type" Error in ...
Are you experiencing the “cannot use namespace as a type” error in TypeScript? This error can occur when you try to import types...
Read more >
How To Use Namespaces in TypeScript | DigitalOcean
This tutorial will reference aspects of text editors that support TypeScript and show in-line errors. This is not necessary to use TypeScript ......
Read more >
no-namespace - TypeScript ESLint
.exports = { · "rules": { · "@typescript-eslint/no-namespace": "error" · } · }; ...
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