Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

04-mikes-ts-setup.md - import path in a index.test.ts #24

Open
andrewmiroshnichenko opened this issue Dec 5, 2020 · 1 comment
Open

Comments

@andrewmiroshnichenko
Copy link

I followed all steps in a tutorial, and received an TS error Cannot find module '..' or its corresponding type declarations.ts(2307) while trying to do

import { avg, sum3 } from '..';

What I could miss?

Folder structure is
folder

My tests/tsconfig.json internals are

{
  "extends": "../tsconfig.json",
  "references": [
    {
      "name": "my-lib",
      "path": ".."
    }
  ],
  "compilerOptions": {
    "types": [
      "jest"
    ],
    "rootDir": "..",
    "noEmit": true
  },
  "include": [
    "."
  ]
}

and in a Problems tab of VS Code I'm receiving an error
File '/home/stradivari/projects/temp/tests/index.test.ts' is not under 'rootDir' '/home/stradivari/projects/temp/src'. 'rootDir' is expected to contain all source files.

@itstanany
Copy link

change the import statement to
import { avg, sum3 } from '../src/index';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants