TypeScript Compiler Failing
See original GitHub issue🐛 Bug report
Failing to compile
Current behavior
I’m working in a monorepo. I installed reakit in a workspace and so the module gets hoisted to the top level node_modules
and when I run tsc
it fails and I get the following output (I did not include the whole thing, but all the errors are similar and they all occur in the reakit ts
directory)
Usage:
import {
usePopoverState,
Popover,
PopoverDisclosure,
PopoverArrow,
} from 'reakit/Popover'
../../node_modules/reakit/ts/Tooltip/Tooltip.d.ts:19:1 - error TS1128: Declaration or statement expected.
19 };
~
../../node_modules/reakit/ts/Tooltip/TooltipArrow.d.ts:8:22 - error TS1005: ';' expected.
8 __keys: readonly any[];
~~~
../../node_modules/reakit/ts/Tooltip/TooltipArrow.d.ts:8:25 - error TS1005: ',' expected.
8 __keys: readonly any[];
~
../../node_modules/reakit/ts/Tooltip/TooltipArrow.d.ts:9:21 - error TS1109: Expression expected.
9 __propsAreEqual?: ((prev: import("..").BoxOptions & Pick<Partial<import("./TooltipState").TooltipStateReturn>, "unstable_arrowRef" | "unstable_arrowStyles"> & Pick<import("./TooltipState").TooltipStateReturn, "placement"> & import("react").HTMLAttributes<any> & import("react").RefAttributes<any> & {
~
../../node_modules/reakit/ts/Tooltip/TooltipArrow.d.ts:14:1 - error TS1128: Declaration or statement expected.
14 };
~
../../node_modules/reakit/ts/Tooltip/TooltipReference.d.ts:9:22 - error TS1005: ';' expected.
9 __keys: readonly any[];
~~~
../../node_modules/reakit/ts/Tooltip/TooltipReference.d.ts:9:25 - error TS1005: ',' expected.
9 __keys: readonly any[];
~
../../node_modules/reakit/ts/Tooltip/TooltipReference.d.ts:10:21 - error TS1109: Expression expected.
10 __propsAreEqual?: ((prev: BoxOptions & Pick<Partial<TooltipStateReturn>, "unstable_referenceRef" | "unstable_hiddenId"> & Pick<TooltipStateReturn, "hide" | "show"> & import("react").HTMLAttributes<any> & import("react").RefAttributes<any> & {
~
../../node_modules/reakit/ts/Tooltip/TooltipReference.d.ts:15:1 - error TS1128: Declaration or statement expected.
15 };
~
../../node_modules/reakit/ts/VisuallyHidden/VisuallyHidden.d.ts:8:22 - error TS1005: ';' expected.
8 __keys: readonly any[];
~~~
../../node_modules/reakit/ts/VisuallyHidden/VisuallyHidden.d.ts:8:25 - error TS1005: ',' expected.
8 __keys: readonly any[];
~
../../node_modules/reakit/ts/VisuallyHidden/VisuallyHidden.d.ts:9:21 - error TS1109: Expression expected.
9 __propsAreEqual?: ((prev: BoxOptions & import("react").HTMLAttributes<any> & import("react").RefAttributes<any> & {
~
../../node_modules/reakit/ts/VisuallyHidden/VisuallyHidden.d.ts:14:1 - error TS1128: Declaration or statement expected.
14 };
Steps to reproduce the bug
Provide a repo or sandbox with the bug and describe the steps to reproduce it.
- Open sandbox: https://codesandbox.io/s/m4n32vjkoj (you can use it as a base)
- Remove any line
- See console logs
Expected behavior
It should compile without any errors.
Possible solutions
If possible, describe how this bug could be fixed.
Environment
root tsconfig.json
looks like this:
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noUnusedLocals": false,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es5",
"jsx": "react",
"declaration": true,
"lib": ["es7", "dom", "esnext"],
"typeRoots": ["../../node_modules/@types"],
"types": [
"express",
"jest",
"node",
"numeral",
"react",
"react-dom",
"react-router",
"react-table"
]
}
}
package tsconfig
:
{
"extends": "../config/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules/**"]
}
System:
OS: macOS 10.14
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 298.29 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
Yarn: 1.15.0 - ~/.nvm/versions/node/v10.9.0/bin/yarn
npm: 6.2.0 - ~/.nvm/versions/node/v10.9.0/bin/npm
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Error: TypeScript compilation failed · Issue #6328 - GitHub
What is the Current behavior? I start to get error after I'm trying to execute a test using this command ./node_modules/.bin/testcafe ...
Read more >Error: TypeScript compilation failed.Cannot find name 'require'
The problem is already described in this issue in the TestCafe repository. Track it to be notified once it's updated.
Read more >Common TypeScript module problems and how to solve them
Introduction · Problem 1: Irregular location of dependencies · Solution 1: Locate the correct directory · Problem 2: Multiple fallback locations.
Read more >TypeScript Compiler fails with "Debug Failure. False ...
TypeScript Service and Compiler should be enabled. No errors are highlighted, Console contains the next error: Process: No compileOnSave — return true
Read more >Detect JavaScript errors during compile time using TypeScript ...
Most used tools for detecting problems during compilation in JavaScript are linters. Linters can be configured in a very strict way, which can ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think we changed the import path to ‘reakit/es/<component>’
On Fri, Jun 14, 2019 at 8:51 PM Craig Cavalier notifications@github.com wrote:
– Sent from Gmail Mobile
@diegohaz Yup, that did the trick. Thank you so much for figuring this out.