vite-plugin-vue-type-imports icon indicating copy to clipboard operation
vite-plugin-vue-type-imports copied to clipboard

CAN NOT import types from entry file with multiple exports levels

Open gaokun opened this issue 2 years ago • 2 comments

The code below is not working:

Vue

import type { MsgProps } from './types' 

defineProps<MsgProps>()

types.ts

export * from './msg'

msg.ts

export interface MsgProps {
  msg: string;
}

I got:

[@vue/compiler-sfc] type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type

If I import type { MsgProps } from './msg' , it works ok.

Reproduce Repo

https://github.com/gaokun/vue3-ts-vite-type-imports

gaokun avatar Jul 05 '22 10:07 gaokun

The following syntaxes are not supported currently:

  • import default
  • import { a as b }
  • export default
  • export * from

See Known limitations

This is a known issue, however, the documentation is currently not updated until #15 is merged.

Unfortunenately, this may take a while to fix because I'm not focusing on this project now.

Zolyn avatar Jul 05 '22 10:07 Zolyn

@Zolyn Many thanks for your extremely quick response. And thanks to your work anyway.

gaokun avatar Jul 05 '22 10:07 gaokun

Supported in v0.2.2

Zolyn avatar Sep 15 '22 04:09 Zolyn