interact.js icon indicating copy to clipboard operation
interact.js copied to clipboard

Typescript compilation error on 1.7.0

Open dmitriigaidarji opened this issue 7 years ago • 11 comments

Actual behavior

ERROR in [at-loader] ./node_modules/interactjs/index.d.ts:1:22
    TS2307: Cannot find module '../interact/index'.

ERROR in [at-loader] ./node_modules/interactjs/index.d.ts:2:28
    TS2307: Cannot find module '../modifiers/index'.

ERROR in [at-loader] ./node_modules/interactjs/index.d.ts:3:26
    TS2307: Cannot find module '../modifiers/base'.

ERROR in [at-loader] ./node_modules/interactjs/index.d.ts:5:27
    TS2307: Cannot find module '../utils/snappers/index'.

System configuration

interact.js version: 1.7.0. typescript@^3.7.2:

"@interactjs/[email protected]":
  version "1.7.0"
  resolved "https://registry.yarnpkg.com/@interactjs/types/-/types-1.7.0.tgz#02accd00eaaa536d55a0fadad94170a127f96f6d"
  integrity sha512-0nk5GDdl8X+XwW0ihgkaLCahx25TRDs1IZtKIoCYYcm9DGqZrlTq4Z4muofOTS/Jp7sfGqQnWnz4JWwFiAb/Qg==
  dependencies:
    "@interactjs/actions" "1.7.0"
    "@interactjs/auto-scroll" "1.7.0"
    "@interactjs/auto-start" "1.7.0"
    "@interactjs/core" "1.7.0"
    "@interactjs/dev-tools" "1.7.0"
    "@interactjs/inertia" "1.7.0"
    "@interactjs/interact" "1.7.0"
    "@interactjs/modifiers" "1.7.0"
    "@interactjs/pointer-events" "1.7.0"
    "@interactjs/reflow" "1.7.0"
    "@interactjs/utils" "1.7.0"

Browser name and version: ? Operating System: tested on CentOS 7 and Mac OS

dmitriigaidarji avatar Nov 18 '19 14:11 dmitriigaidarji

Hey @taye , looks like the fix may not have worked.

I'm testing this by having the following line in my packages.json file:

"interactjs": "^1.8.0-alpha.1",

After an npm install, my project compiles fine on Windows, but after an npm install on Ubuntu, I get the following error:

src/game/chat.ts:6:22 - error TS7016: Could not find a declaration file for module 'interactjs'. '/root/go/src/github.com/Zamiell/hanabi-live/public/js/node_modules/interactjs/index.js' implicitly has an 'any' type.
  Try `npm install @types/interactjs` if it exists or add a new declaration (.d.ts) file containing `declare module 'interactjs';`

6 import interact from 'interactjs';
                       ~~~~~~~~~~~~


Found 1 error.

Zamiell avatar Nov 22 '19 21:11 Zamiell

@Zamiell can you try adding "./node_modules/@interactjs" to the compilerOptions.typeRoots array of your tsconfig.json?

{
  "compilerOptions": {
    "typeRoots": ["./node_modules/@types", "./node_modules/@interactjs"]
  }
}

taye avatar Nov 23 '19 14:11 taye

After adding that, I get the following errors:

error TS2688: Cannot find type definition file for 'actions'.
error TS2688: Cannot find type definition file for 'auto-scroll'.
error TS2688: Cannot find type definition file for 'auto-start'.
error TS2688: Cannot find type definition file for 'core'.
error TS2688: Cannot find type definition file for 'dev-tools'.
error TS2688: Cannot find type definition file for 'inertia'.
error TS2688: Cannot find type definition file for 'interact'.
error TS2688: Cannot find type definition file for 'interactjs'.
error TS2688: Cannot find type definition file for 'modifiers'.
error TS2688: Cannot find type definition file for 'pointer-events'.
error TS2688: Cannot find type definition file for 'reflow'.
error TS2688: Cannot find type definition file for 'types'.
error TS2688: Cannot find type definition file for 'utils'.

Found 13 errors.

Zamiell avatar Nov 23 '19 15:11 Zamiell

I should also note that I got it working just fine with v1.7.2, so it seems to be just an issue with the alphas.

Zamiell avatar Nov 23 '19 15:11 Zamiell

I've published a new version. Could you try npm install interactjs@next?

taye avatar Nov 23 '19 17:11 taye

Exact same errors as before.

Zamiell avatar Nov 23 '19 17:11 Zamiell

I've published another prerelease version. Can you try npm isntall interactjs@next again without the compilerOptions.typeRoots suggestion?

If that fails, I'm all out of ideas 😕

taye avatar Nov 23 '19 18:11 taye

If it isn't too much trouble, can't you just test yourself with a Ubuntu VM in VirtualBox or something?

Zamiell avatar Nov 23 '19 19:11 Zamiell

Or just use Travis, as it errors there as well. (I'm not sure what exact flavor of Linux that they use in their Docker container workers.)

Zamiell avatar Nov 23 '19 19:11 Zamiell

I've tired on Arch Linux with node 12, npm 6 and typescript 3.7 without issues. What versions are you using?

taye avatar Nov 23 '19 23:11 taye

Looks like alpha 3 compiles without errors, so the issue is resolved. For the record, I am on Ubuntu 16.04.

Zamiell avatar Nov 24 '19 03:11 Zamiell