@@ -423,7 +423,7 @@ namespace ts {
423423 ThisNodeHasError = 1 << 19 , // If the parser encountered an error when parsing the code that created this node
424424 JavaScriptFile = 1 << 20 , // If node was parsed in a JavaScript
425425 ThisNodeOrAnySubNodesHasError = 1 << 21 , // If this node or any of its children had an error
426- HasAggregatedChildData = 1 << 22 , // If we've computed data from children and cached it in this node
426+ HasAggregatedChildData = 1 << 22 , // If we've computed data from children and cached it in this node
427427
428428 BlockScoped = Let | Const ,
429429
@@ -2083,7 +2083,7 @@ namespace ts {
20832083 // Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
20842084 // It is used to resolve module names in the checker.
20852085 // Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
2086- /* @internal */ resolvedModules : Map < ResolvedModule > ;
2086+ /* @internal */ resolvedModules : Map < ResolvedModuleFull > ;
20872087 /* @internal */ resolvedTypeReferenceDirectiveNames : Map < ResolvedTypeReferenceDirective > ;
20882088 /* @internal */ imports : LiteralExpression [ ] ;
20892089 /* @internal */ moduleAugmentations : LiteralExpression [ ] ;
@@ -3352,14 +3352,11 @@ namespace ts {
33523352 * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
33533353 * The Program will then filter results based on these flags.
33543354 *
3355- * At least one of `resolvedTsFileName` or `resolvedJsFileName` must be defined,
3356- * else resolution should just return `undefined` instead of a ResolvedModule.
3355+ * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred.
33573356 */
33583357 export interface ResolvedModule {
33593358 /** Path of the file the module was resolved to. */
33603359 resolvedFileName : string ;
3361- /** Extension of resolvedFileName. This must match what's at the end of resolvedFileName. */
3362- extension : Extension ;
33633360 /**
33643361 * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module:
33653362 * - be a .d.ts file
@@ -3369,6 +3366,18 @@ namespace ts {
33693366 isExternalLibraryImport ?: boolean ;
33703367 }
33713368
3369+ /**
3370+ * ResolvedModule with an explicitly provided `extension` property.
3371+ * Prefer this over `ResolvedModule`.
3372+ */
3373+ export interface ResolvedModuleFull extends ResolvedModule {
3374+ /**
3375+ * Extension of resolvedFileName. This must match what's at the end of resolvedFileName.
3376+ * This is optional for backwards-compatibility, but will be added if not provided.
3377+ */
3378+ extension : Extension ;
3379+ }
3380+
33723381 export enum Extension {
33733382 Ts ,
33743383 Tsx ,
@@ -3379,7 +3388,7 @@ namespace ts {
33793388 }
33803389
33813390 export interface ResolvedModuleWithFailedLookupLocations {
3382- resolvedModule : ResolvedModule | undefined ;
3391+ resolvedModule : ResolvedModuleFull | undefined ;
33833392 failedLookupLocations : string [ ] ;
33843393 }
33853394
0 commit comments