Add alias ResolutionMode for ModuleKind.ESNext | ModuleKind.CommonJs | undefined (#51482)

* Add alias ResolutionMode for ModuleKind.ESNext | ModuleKind.CommonJs | undefined

* ResolutionMode | undefined = ResolutionMode

* More
This commit is contained in:
Sheetal Nandi
2022-11-10 16:47:46 -08:00
committed by GitHub
parent 3eafb64faf
commit c5aea89230
18 changed files with 151 additions and 145 deletions
+9 -7
View File
@@ -3588,7 +3588,7 @@ export interface ExportAssignment extends DeclarationStatement, JSDocContainer {
export interface FileReference extends TextRange {
fileName: string;
resolutionMode?: SourceFile["impliedNodeFormat"];
resolutionMode?: ResolutionMode;
}
export interface CheckJsDirective extends TextRange {
@@ -3968,6 +3968,8 @@ export interface RedirectInfo {
readonly unredirected: SourceFile;
}
export type ResolutionMode = ModuleKind.ESNext | ModuleKind.CommonJS | undefined;
// Source files are declarations when they are external modules.
export interface SourceFile extends Declaration {
readonly kind: SyntaxKind.SourceFile;
@@ -4044,7 +4046,7 @@ export interface SourceFile extends Declaration {
* of `node`). If so, this field will be unset and source files will be considered to be
* CommonJS-output-format by the node module transformer and type checker, regardless of extension or context.
*/
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
impliedNodeFormat?: ResolutionMode;
/** @internal */ packageJsonLocations?: readonly string[];
/** @internal */ packageJsonScope?: PackageJsonInfo;
@@ -4506,7 +4508,7 @@ export interface Program extends ScriptReferenceHost {
/** @internal */ getFileIncludeReasons(): MultiMap<Path, FileIncludeReason>;
/** @internal */ useCaseSensitiveFileNames(): boolean;
/** @internal */ getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string, mode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined;
/** @internal */ getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
getProjectReferences(): readonly ProjectReference[] | undefined;
getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined;
@@ -5328,8 +5330,8 @@ export interface EmitResolver {
moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
isArgumentsLocalBinding(node: Identifier): boolean;
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode | ImportCall): SourceFile | undefined;
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): [specifier: string, mode: SourceFile["impliedNodeFormat"] | undefined][] | undefined;
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): [specifier: string, mode: SourceFile["impliedNodeFormat"] | undefined][] | undefined;
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): [specifier: string, mode: ResolutionMode | undefined][] | undefined;
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): [specifier: string, mode: ResolutionMode | undefined][] | undefined;
isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean;
getJsxFactoryEntity(location?: Node): EntityName | undefined;
getJsxFragmentFactoryEntity(location?: Node): EntityName | undefined;
@@ -7326,7 +7328,7 @@ export interface CompilerHost extends ModuleResolutionHost {
/**
* This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
*/
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode | undefined, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
/** @internal */ onReleaseOldSourceFile?(oldSourceFile: SourceFile, oldOptions: CompilerOptions, hasSourceFileByPath: boolean): void;
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void;
@@ -9074,7 +9076,7 @@ export interface ResolvedModuleSpecifierInfo {
/** @internal */
export interface ModuleSpecifierOptions {
overrideImportMode?: SourceFile["impliedNodeFormat"];
overrideImportMode?: ResolutionMode;
}
/** @internal */