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', () => {
1155
1155
expect ( deps && [ ...deps ] ) . toStrictEqual ( [ '/user.ts' ] )
1156
1156
} )
1157
1157
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
+
1158
1197
test ( 'ts module resolve w/ project reference folder' , ( ) => {
1159
1198
const files = {
1160
1199
'/tsconfig.json' : JSON . stringify ( {
Original file line number Diff line number Diff line change @@ -1033,7 +1033,7 @@ function resolveWithTS(
1033
1033
function getPattern ( base : string , p : string ) : string {
1034
1034
return p . startsWith ( '${configDir}' ) && major >= 5 && minor >= 5
1035
1035
? // ts 5.5+ supports ${configDir} in paths
1036
- p . replace ( '${configDir}' , dirname ( configPath ! ) )
1036
+ normalizePath ( p . replace ( '${configDir}' , dirname ( configPath ! ) ) )
1037
1037
: joinPaths ( base , p )
1038
1038
}
1039
1039
// resolve which config matches the current file
You can’t perform that action at this time.
0 commit comments