MCPcopy Index your code
hub / github.com/microsoft/typescript-go / ensurePathIsNonModuleName

Function ensurePathIsNonModuleName

internal/modulespecifiers/util.go:136–141  ·  view source on GitHub ↗

** * Ensures a path is either absolute (prefixed with `/` or `c:`) or dot-relative (prefixed * with `./` or `../`) so as not to be confused with an unprefixed module name. * * ```ts * ensurePathIsNonModuleName("/path/to/file.ext") === "/path/to/file.ext" * ensurePathIsNonModuleName("./path/to/

(path string)

Source from the content-addressed store, hash-verified

134 *
135 */
136func ensurePathIsNonModuleName(path string) string {
137 if PathIsBareSpecifier(path) {
138 return "./" + path
139 }
140 return path
141}
142
143func GetJSExtensionForDeclarationFileExtension(ext string) string {
144 switch ext {

Callers 2

getLocalModuleSpecifierFunction · 0.85

Calls 1

PathIsBareSpecifierFunction · 0.85

Tested by

no test coverage detected