in packages/ts2kt-automator/lib.js [47:78]
function getPackageTypeFilePath(name) {
const typePackage = require(path.resolve(
process.cwd(),
`./node_modules/@types/${name}/package.json`
));
// Looks like types packages always have just index.d.ts file
// See https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package
const typesFileName = typePackage.typings || 'index.d.ts';
const typingsFilePath = path.resolve(
'.',
`./node_modules/@types/${name}/${typesFileName}`
);
if (fs.existsSync(typingsFilePath)) {
return typingsFilePath;
}
console.log("Looks like package has embedded types. Let's check...");
const packageItself = require(path.resolve(
process.cwd(),
`./node_modules/${name}/package.json`
));
if (!packageItself.typings) {
throw new Error(
`Cannot find types for package ${name}. It has no types in @types/${name} and no "typings" field in package.json`
);
}
return path.resolve('.', `./node_modules/${name}/${packageItself.typings}`);
}