mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): support resolve multiple re-export /w same source type name (#8365)
close #8364
This commit is contained in:
parent
0e8bbe873e
commit
4fa8da8576
|
@ -615,6 +615,25 @@ describe('resolveType', () => {
|
|||
expect(deps && [...deps]).toStrictEqual(Object.keys(files))
|
||||
})
|
||||
|
||||
test('relative (re-export /w same source type name)', () => {
|
||||
const files = {
|
||||
'/foo.ts': `export default interface P { foo: string }`,
|
||||
'/bar.ts': `export default interface PP { bar: number }`,
|
||||
'/baz.ts': `export { default as X } from './foo'; export { default as XX } from './bar'; `
|
||||
}
|
||||
const { props, deps } = resolve(
|
||||
`import { X, XX } from './baz'
|
||||
defineProps<X & XX>()
|
||||
`,
|
||||
files
|
||||
)
|
||||
expect(props).toStrictEqual({
|
||||
foo: ['String'],
|
||||
bar: ['Number']
|
||||
})
|
||||
expect(deps && [...deps]).toStrictEqual(['/baz.ts', '/foo.ts', '/bar.ts'])
|
||||
})
|
||||
|
||||
test('relative (dynamic import)', () => {
|
||||
const files = {
|
||||
'/foo.ts': `export type P = { foo: string, bar: import('./bar').N }`,
|
||||
|
|
|
@ -1117,7 +1117,7 @@ function recordTypes(
|
|||
const exported = getId(spec.exported)
|
||||
if (stmt.source) {
|
||||
// re-export, register an import + export as a type reference
|
||||
imports[local] = {
|
||||
imports[exported] = {
|
||||
source: stmt.source.value,
|
||||
imported: local
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue