add test for moduleSuffixes

This commit is contained in:
Stephan Brandauer
2022-05-20 15:09:37 +02:00
parent d6abb2e6bd
commit cdceb66b07
5 changed files with 21 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
"module": "esnext", "module": "esnext",
"target": "esnext", "target": "esnext",
"lib": ["dom", "esnext"], "lib": ["dom", "esnext"],
"resolveJsonModule": true "resolveJsonModule": true,
"moduleSuffixes": [".ios", ""]
} }
} }

View File

@@ -363,3 +363,13 @@ console.log(tstModuleCJS());
///////////////// /////////////////
// test file resolution order (see tsconfig: moduleSuffixes setting)
import * as A from './tstSuffixA';
console.log(A.resolvedFile()); // <- 'tstSuffixA.ts'
import * as B from './tstSuffixB';
console.log(B.resolvedFile()); // <- 'tstSuffixB.ios.ts'

View File

@@ -0,0 +1,3 @@
export function resolvedFile(): 'tstSuffixA.ts' {
return 'tstSuffixA.ts';
}

View File

@@ -0,0 +1,3 @@
export function resolvedFile(): 'tstSuffixB.ios.ts' {
return 'tstSuffixB.ios.ts';
}

View File

@@ -0,0 +1,3 @@
export function resolvedFile(): 'tstSuffixB.ts' {
return 'tstSuffixB.ts';
}