TypeScript/tests/cases/fourslash/importNameCodeFixNewImportNodeModules4.ts
Mine Starks 15d294d350 Bugs in missing import codefix
- We didn't locate the package.json correctly in cases where the module to be imported is in a subdirectory of the package
- We didn't look at the types element in package.json (just typings)
- We didn't remove /index.js from the path if the main module was in a subdirectory

Fixes #16963
2017-07-19 11:02:49 -07:00

26 lines
610 B
TypeScript

/// <reference path="fourslash.ts" />
//// [|f1/*0*/('');|]
// @Filename: package.json
//// { "dependencies": { "package-name": "latest" } }
// @Filename: node_modules/package-name/bin/lib/libfile.d.ts
//// export function f1(text: string): string;
// @Filename: node_modules/package-name/bin/lib/libfile.js
//// function f1(text) { }
//// exports.f1 = f1;
// @Filename: node_modules/package-name/package.json
//// {
//// "main": "bin/lib/libfile.js",
//// "types": "bin/lib/libfile.d.ts"
//// }
verify.importFixAtPosition([
`import { f1 } from "package-name";
f1('');`
]);