Skip to content

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

@andrewmiroshnichenko

Description

@andrewmiroshnichenko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions