Skip to content

Commit 095694a

Browse files
author
Andy Hanson
committed
Improve documentation
1 parent 07516ab commit 095694a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/compiler/moduleNameResolver.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,14 @@ namespace ts {
821821
const nodeModulesPathPart = "/node_modules/";
822822

823823
/**
824+
* This will be called on the successfully resolved path from `loadModuleFromFile`.
825+
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
826+
*
824827
* packageDirectory is the directory of the package itself.
825828
* subModuleName is the path within the package.
826-
* For `foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "" }.
827-
* For `foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar" }.
828-
* For `@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar" }.
829+
* For `/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "" }.
830+
* For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar" }.
831+
* For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar" }.
829832
*/
830833
function parseNodeModuleFromPath(path: string): { packageDirectory: string, subModuleName: string } | undefined {
831834
path = normalizePath(path);

0 commit comments

Comments
 (0)