Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Sep 10, 2024
1 parent 1558c7f commit ef2101a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4665,6 +4665,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
else if (
compilerOptions.rewriteRelativeImportExtensions
&& !(location.flags & NodeFlags.Ambient)
&& !isDeclarationFileName(moduleReference)
&& !isLiteralImportTypeNode(location)
&& !isPartOfTypeOnlyImportOrExportDeclaration(location)
) {
Expand All @@ -4676,13 +4677,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host)),
);
}
else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && !isDeclarationFileName(moduleReference) && sourceFileMayBeEmitted(sourceFile, host)) {
else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
error(
errorNode,
Diagnostics.This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path,
getAnyExtensionFromPath(moduleReference),
);
}
else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite && host.isSourceOfProjectReferenceRedirect(resolvedModule.resolvedFileName)) {
// TODO
}
}

if (sourceFile.symbol) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/// <reference path="../fourslash.ts" />

// @Filename: packages/common/tsconfig.json
//// {
//// "compilerOptions": {
//// "composite": true,
//// "rootDir": "src",
//// "outDir": "dist",
//// "module": "nodenext",
//// }
//// }

// @Filename: packages/common/package.json
//// {
//// "name": "common",
//// "version": "1.0.0",
//// "type": "module",
//// "exports": {
//// ".": {
//// "source": "./src/index.ts",
//// "default": "./dist/index.js"
//// }
//// }
//// }

// @Filename: packages/common/src/index.ts
//// export {};

// @Filename: packages/main/tsconfig.json
//// {
//// "compilerOptions": {
//// "module": "nodenext",
//// "rewriteRelativeImportExtensions": true,
//// "rootDir": "src",
//// "outDir": "dist",
//// },
//// "references": [
//// { "path": "../common" }
//// ]
//// }

// @Filename: packages/main/package.json
//// { "type": "module" }

// @Filename: packages/main/src/index.ts
//// import {} from "../../common/src/index.ts";

goTo.file("/tests/cases/fourslash/server/packages/main/src/index.ts");
verify.baselineSyntacticAndSemanticDiagnostics();

0 comments on commit ef2101a

Please sign in to comment.