MCPcopy Index your code
hub / github.com/nodejs/node / getResolutionDiagnostic

Function getResolutionDiagnostic

test/fixtures/snapshot/typescript.js:119487–119512  ·  view source on GitHub ↗

* Returns a DiagnosticMessage if we won't include a resolved module due to its extension. * The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. * This returns a diagnostic even if the module will be an untyped module.

(options, _a)

Source from the content-addressed store, hash-verified

119485 * This returns a diagnostic even if the module will be an untyped module.
119486 */
119487 function getResolutionDiagnostic(options, _a) {
119488 var extension = _a.extension;
119489 switch (extension) {
119490 case ".ts" /* Extension.Ts */:
119491 case ".d.ts" /* Extension.Dts */:
119492 // These are always allowed.
119493 return undefined;
119494 case ".tsx" /* Extension.Tsx */:
119495 return needJsx();
119496 case ".jsx" /* Extension.Jsx */:
119497 return needJsx() || needAllowJs();
119498 case ".js" /* Extension.Js */:
119499 return needAllowJs();
119500 case ".json" /* Extension.Json */:
119501 return needResolveJsonModule();
119502 }
119503 function needJsx() {
119504 return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
119505 }
119506 function needAllowJs() {
119507 return ts.getAllowJSCompilerOption(options) || !ts.getStrictOptionValue(options, "noImplicitAny") ? undefined : ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type;
119508 }
119509 function needResolveJsonModule() {
119510 return options.resolveJsonModule ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
119511 }
119512 }
119513 ts.getResolutionDiagnostic = getResolutionDiagnostic;
119514 function getModuleNames(_a) {
119515 var imports = _a.imports, moduleAugmentations = _a.moduleAugmentations;

Callers 1

processImportedModulesFunction · 0.85

Calls 3

needJsxFunction · 0.85
needAllowJsFunction · 0.85
needResolveJsonModuleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…