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 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.

  1. Open sandbox: https://codesandbox.io/s/m4n32vjkoj (you can use it as a base)
  2. Remove any line
  3. 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:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
prwelbercommented, Jun 15, 2019

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:

@prwelber https://github.com/prwelber can you share how your coworker figured this out? I’m bumping into the same set of errors.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/reakit/reakit/issues/367?email_source=notifications&email_token=ADBIVZ7C7HQQTJZEJ776Z2TP2Q4KLA5CNFSM4HQGYCCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXYM3OI#issuecomment-502320569, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBIVZYKZ6MUN4H6DPUSJYTP2Q4KLANCNFSM4HQGYCCA .

– Sent from Gmail Mobile

0reactions
CraigCavcommented, Jun 17, 2019

@diegohaz Yup, that did the trick. Thank you so much for figuring this out.

Read more comments on GitHub >

github_iconTop 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 >

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