File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -1155,6 +1155,45 @@ describe('resolveType', () => {
11551155 expect ( deps && [ ...deps ] ) . toStrictEqual ( [ '/user.ts' ] )
11561156 } )
11571157
1158+ // #13484
1159+ test ( 'ts module resolve w/ project reference & extends & ${configDir}' , ( ) => {
1160+ const files = {
1161+ '/tsconfig.json' : JSON . stringify ( {
1162+ files : [ ] ,
1163+ references : [ { path : './tsconfig.app.json' } ] ,
1164+ } ) ,
1165+ '/tsconfig.app.json' : JSON . stringify ( {
1166+ extends : [ './tsconfigs/base.json' ] ,
1167+ } ) ,
1168+ '/tsconfigs/base.json' : JSON . stringify ( {
1169+ compilerOptions : {
1170+ paths : {
1171+ '@/*' : [ '${configDir}/src/*' ] ,
1172+ } ,
1173+ } ,
1174+ include : [ '${configDir}/src/**/*.ts' , '${configDir}/src/**/*.vue' ] ,
1175+ } ) ,
1176+ '/src/types.ts' :
1177+ 'export type BaseProps = { foo?: string, bar?: string }' ,
1178+ }
1179+
1180+ const { props, deps } = resolve (
1181+ `
1182+ import { BaseProps } from '@/types.ts';
1183+ defineProps<BaseProps>()
1184+ ` ,
1185+ files ,
1186+ { } ,
1187+ '/src/components/Foo.vue' ,
1188+ )
1189+
1190+ expect ( props ) . toStrictEqual ( {
1191+ foo : [ 'String' ] ,
1192+ bar : [ 'String' ] ,
1193+ } )
1194+ expect ( deps && [ ...deps ] ) . toStrictEqual ( [ '/src/types.ts' ] )
1195+ } )
1196+
11581197 test ( 'ts module resolve w/ project reference folder' , ( ) => {
11591198 const files = {
11601199 '/tsconfig.json' : JSON . stringify ( {
Original file line number Diff line number Diff line change @@ -1033,7 +1033,7 @@ function resolveWithTS(
10331033 function getPattern ( base : string , p : string ) : string {
10341034 return p . startsWith ( '${configDir}' ) && major >= 5 && minor >= 5
10351035 ? // ts 5.5+ supports ${configDir} in paths
1036- p . replace ( '${configDir}' , dirname ( configPath ! ) )
1036+ normalizePath ( p . replace ( '${configDir}' , dirname ( configPath ! ) ) )
10371037 : joinPaths ( base , p )
10381038 }
10391039 // resolve which config matches the current file
You can’t perform that action at this time.
0 commit comments