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

Fails with an error when resolving import of the js file that has the same-named ".d.ts" type-definition file #112

Closed
williamvinogradov opened this issue Mar 9, 2023 · 1 comment

Comments

@williamvinogradov
Copy link

Fails with an error when resolving import of the js file that has the same-named ".d.ts" type-definition file
with 'noTypeDefinitions' set to true

Reproduce:
File structure:

src
 |- bar.ts // ts file with "import something from '@test/foo';"
 |- foo.js
 |- foo.d.ts // type-definition file with the same name

The script that resolves imports:

import cabinet from 'filing-cabinet';

const pathToDirectory = './';
const result = cabinet({ 
  partial: '@test/foo',
  `${pathToDirectory}/bar.ts`, // fileName
  pathToDirectory, // directory
  tsConfig: {
    compilerOptions: {
      allowJs: true,
      moduleResolution: 'node',
      baseUrl: pathToDirectory,
      paths: {
        '@test/*': ['*'],
      }
    }
  },
  noTypeDefinitions: true,
});

console.log('result: ', result);

Expected result:

result: <path_to_directory>/foo.js

Actual result:
Fails with the next error:

Error: Could not resolve JS module '@test/foo'
@mrjoelkemp
Copy link
Collaborator

Fixed via #113

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