Skip to content

Commit ef2101a

Browse files
committed
WIP
1 parent 1558c7f commit ef2101a

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

src/compiler/checker.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -4665,6 +4665,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
46654665
else if (
46664666
compilerOptions.rewriteRelativeImportExtensions
46674667
&& !(location.flags & NodeFlags.Ambient)
4668+
&& !isDeclarationFileName(moduleReference)
46684669
&& !isLiteralImportTypeNode(location)
46694670
&& !isPartOfTypeOnlyImportOrExportDeclaration(location)
46704671
) {
@@ -4676,13 +4677,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
46764677
getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host)),
46774678
);
46784679
}
4679-
else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && !isDeclarationFileName(moduleReference) && sourceFileMayBeEmitted(sourceFile, host)) {
4680+
else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
46804681
error(
46814682
errorNode,
46824683
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,
46834684
getAnyExtensionFromPath(moduleReference),
46844685
);
46854686
}
4687+
else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite && host.isSourceOfProjectReferenceRedirect(resolvedModule.resolvedFileName)) {
4688+
// TODO
4689+
}
46864690
}
46874691

46884692
if (sourceFile.symbol) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/// <reference path="../fourslash.ts" />
2+
3+
// @Filename: packages/common/tsconfig.json
4+
//// {
5+
//// "compilerOptions": {
6+
//// "composite": true,
7+
//// "rootDir": "src",
8+
//// "outDir": "dist",
9+
//// "module": "nodenext",
10+
//// }
11+
//// }
12+
13+
// @Filename: packages/common/package.json
14+
//// {
15+
//// "name": "common",
16+
//// "version": "1.0.0",
17+
//// "type": "module",
18+
//// "exports": {
19+
//// ".": {
20+
//// "source": "./src/index.ts",
21+
//// "default": "./dist/index.js"
22+
//// }
23+
//// }
24+
//// }
25+
26+
// @Filename: packages/common/src/index.ts
27+
//// export {};
28+
29+
// @Filename: packages/main/tsconfig.json
30+
//// {
31+
//// "compilerOptions": {
32+
//// "module": "nodenext",
33+
//// "rewriteRelativeImportExtensions": true,
34+
//// "rootDir": "src",
35+
//// "outDir": "dist",
36+
//// },
37+
//// "references": [
38+
//// { "path": "../common" }
39+
//// ]
40+
//// }
41+
42+
// @Filename: packages/main/package.json
43+
//// { "type": "module" }
44+
45+
// @Filename: packages/main/src/index.ts
46+
//// import {} from "../../common/src/index.ts";
47+
48+
goTo.file("/tests/cases/fourslash/server/packages/main/src/index.ts");
49+
verify.baselineSyntacticAndSemanticDiagnostics();

0 commit comments

Comments
 (0)