docs icon indicating copy to clipboard operation
docs copied to clipboard

Private name Props error with TypeScript.

Open bencodezen opened this issue 2 years ago • 5 comments

The following is a reproduction of the description from https://github.com/vuejs/docs/pull/2200. Credit goes fully to @olfek for reporting this issue.

Existing code snippet gives this error:

Default export of the module has or is using private name 'Props'.ts (4082)

Error fixed thanks to: https://github.com/johnsoncodehk/volar/issues/1232#issue-1213615569

image

bencodezen avatar Feb 01 '23 19:02 bencodezen

I'm currently investigating this. I'll report back in the next few days.

For anyone needing a temporary fix, the simplest way to make the warning go away is to export the interface.

skirtles-code avatar Feb 01 '23 19:02 skirtles-code

Discussion thread for adding support for this to Volar: https://github.com/vuejs/language-tools/discussions/2421.

skirtles-code avatar Feb 19 '23 16:02 skirtles-code

I'm currently investigating this. I'll report back in the next few days.

For anyone needing a temporary fix, the simplest way to make the warning go away is to export the interface.

but the example code of docs currently is: https://vuejs.org/guide/typescript/composition-api.html#typing-component-props

which is the correct usage??

ishowman avatar Apr 26 '23 14:04 ishowman

Hi , Same Here ! I notice that when I delete the variable that bind in slots of template the error will disappear!

Ge6ben avatar Jun 04 '23 19:06 Ge6ben

I have the same issue but when trying to generate types with vue-tsc --declaration --emitDeclarationOnly

wal0x avatar Jul 29 '23 13:07 wal0x