Fails with an error when resolving import of the js file that has the same-named ".d.ts" type-definition file
williamvinogradov opened this issue · 1 comments
williamvinogradov commented
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 commented
Fixed via #113