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 build error

See original GitHub issue

Hi, actually i implemented react-select into an typescript application and after adding the needed components for an auto-suggest Element with material-ui, i get this build error from typescript:

ERROR in ./node_modules/react-select/src/components/Menu.js 5:7
Module parse failed: Unexpected token (5:7)

You may need an appropriate loader to handle this file type.
| import {
|   Component,
>   type Element as ReactElement,
|   type ElementRef,
|   type Node,

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:19
  • Comments:9

github_iconTop GitHub Comments

27reactions
HellBrickcommented, Jul 10, 2019

I’ve encountered a similar issue when TS tooling auto-imported Select from react-select/src/Select, it can be fixed by importing from react-select instead. But the fact that the tooling can be confused like that is somewhat inconvenient =(

8reactions
ghostcommented, Aug 5, 2019

Got lots of compile errors after upgrade to v3. Is there a reason why you moved types in @types/react-select package to src instead of keeping it under lib?

I referenced some of your types outside index.d.ts in my code - it’s not ideal, as not part of the public types API, but it is what it is. Example:

import {
  ValueType,
  ActionMeta,
  GroupedOptionsType,
  GroupType
} from "react-select/lib/types"

Problem with src is TypeScript lookup: If I want GroupType or GroupedOptionsType from @types\react-select\src\types.d.ts, the sources from react-select\src\types.js are instead selected due to higher lookup priority in TypeScript. This file contains flow types, which break my webpack build that can only handle TypeScript and complains about unexpected token.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript build error - what is wrong with this? - Stack Overflow
I have recently updated VS2017 and I am seeing a lot of typescript build errors. The errors are all the same, and all...
Read more >
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 >
Stopping a TypeScript Build When Errors Are Found
TypeScript will always compile even if there are ridiculous errors in your project. This lesson shows how to configure your .tsconfig with "noEmitOnError" ......
Read more >
TypeScript errors and how to fix them
Common Errors. Below you find a list of common TypeScript errors along with the buggy code and its fixed version. If you're interested...
Read more >
Avoid TypeScript errors in your project by using the TypeScript ...
No more unexpected type errors! ... Assuming you are new to TypeScript, tsc is The TypeScript Compiler. It is a tool responsible for...
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