index.d.ts error TS2307: Cannot find module my own module

You are importing using ES imports:

import {LabeledValue} from 'test';

Therefore you need to have an ES module (not namespace/module keywords which are TypeScript modules).

Fix

Your index.d.ts should look like:

  export interface LabeledValue {
    label: string;
    size: number;
  }

A root level export makes the file an ES module and now your ES import will work.


I resolve my problem with the installation of eslint-import-resolver-typescript and the default configuration.


Make sure your file is ended with .ts