-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly resolve imports ending with "." and ".." (#47850)
- Loading branch information
1 parent
73506f3
commit 7f022c5
Showing
22 changed files
with
136 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
tests/cases/conformance/moduleResolution/a/b.ts(1,20): error TS2305: Module '"."' has no exported member 'rootA'. | ||
|
||
|
||
==== tests/cases/conformance/moduleResolution/a.ts (0 errors) ==== | ||
export const rootA = 0; | ||
|
||
==== tests/cases/conformance/moduleResolution/a/index.ts (0 errors) ==== | ||
export const indexInA = 0; | ||
|
||
==== tests/cases/conformance/moduleResolution/a/b.ts (1 errors) ==== | ||
import { indexInA, rootA } from "."; | ||
~~~~~ | ||
!!! error TS2305: Module '"."' has no exported member 'rootA'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//// [tests/cases/conformance/moduleResolution/importFromDot.ts] //// | ||
|
||
//// [a.ts] | ||
export const rootA = 0; | ||
|
||
//// [index.ts] | ||
export const indexInA = 0; | ||
|
||
//// [b.ts] | ||
import { indexInA, rootA } from "."; | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.rootA = void 0; | ||
exports.rootA = 0; | ||
//// [index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.indexInA = void 0; | ||
exports.indexInA = 0; | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/conformance/moduleResolution/a.ts === | ||
export const rootA = 0; | ||
>rootA : Symbol(rootA, Decl(a.ts, 0, 12)) | ||
|
||
=== tests/cases/conformance/moduleResolution/a/index.ts === | ||
export const indexInA = 0; | ||
>indexInA : Symbol(indexInA, Decl(index.ts, 0, 12)) | ||
|
||
=== tests/cases/conformance/moduleResolution/a/b.ts === | ||
import { indexInA, rootA } from "."; | ||
>indexInA : Symbol(indexInA, Decl(b.ts, 0, 8)) | ||
>rootA : Symbol(rootA, Decl(b.ts, 0, 18)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=== tests/cases/conformance/moduleResolution/a.ts === | ||
export const rootA = 0; | ||
>rootA : 0 | ||
>0 : 0 | ||
|
||
=== tests/cases/conformance/moduleResolution/a/index.ts === | ||
export const indexInA = 0; | ||
>indexInA : 0 | ||
>0 : 0 | ||
|
||
=== tests/cases/conformance/moduleResolution/a/b.ts === | ||
import { indexInA, rootA } from "."; | ||
>indexInA : 0 | ||
>rootA : any | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/importWithTrailingSlash.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/a/b/test.ts(3,3): error TS2339: Property 'a' does not exist on type '{ aIndex: number; }'. | ||
/a/test.ts(3,3): error TS2339: Property 'a' does not exist on type '{ aIndex: number; }'. | ||
|
||
|
||
==== /a.ts (0 errors) ==== | ||
export default { a: 0 }; | ||
|
||
==== /a/index.ts (0 errors) ==== | ||
export default { aIndex: 0 }; | ||
|
||
==== /a/test.ts (1 errors) ==== | ||
import a from "."; | ||
import aIndex from "./"; | ||
a.a; | ||
~ | ||
!!! error TS2339: Property 'a' does not exist on type '{ aIndex: number; }'. | ||
aIndex.aIndex; | ||
|
||
==== /a/b/test.ts (1 errors) ==== | ||
import a from ".."; | ||
import aIndex from "../"; | ||
a.a; | ||
~ | ||
!!! error TS2339: Property 'a' does not exist on type '{ aIndex: number; }'. | ||
aIndex.aIndex; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
tests/baselines/reference/importWithTrailingSlash.trace.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.