Vue-next: TS4082: Default export of the module has or is using private name 'MethodOptions'.

Created on 15 Jun 2020  路  6Comments  路  Source: vuejs/vue-next

Version

3.0.0-beta.15

Reproduction link

https://jsfiddle.net/kasor/f8u93nyv/12/

Steps to reproduce

idem as issue #1370 (https://github.com/vuejs/vue-next/issues/1370)
but for non exported "MethodOptions"
Rollup build is reporting error :
[!] (plugin rpt2) Error: .../CInput.vue?vue&type=script&lang.ts(44,1): semantic error TS4082: Default export of the module has or is using private name 'MethodOptions'.

What is expected?

Something like the following works without errors:
import { defineComponent } from "vue";
import { string } from "vue-types";
import * as allFormMixins from './form-mixins'
const mixins = Object.values(allFormMixins)

export default defineComponent({
name: "HelloWorld",
props: {
msg: string()
},
mixins,
});

What is actually happening?

semantic error TS4082: Default export of the module has or is using private name 'MethodOptions'.


mixins is to provide a bunch of shared computed: methods from ./form-mixins.ts
this a previously JS project, converted in TS project with temporary @ts-nocheck in the script part.
MethodOptions is not exported, and apparently, the compiler is against exporting a private variable.

bug

Most helpful comment

@aztalbot fixed on https://github.com/vuejs/vue-next/pull/2124 wait for the next version please

All 6 comments

Please provide a valid repro. jsfiddle is not valid for reporting type issues.

I will have to create sample .git project to demonstrate the case ...
Maybe the simple and right thing is to make the "interface MethodOptions" declaration visible from the 'vue' module, or show how to make it available in a esm/csj/... rollup typescript build.

Issue happens if you suddenly have "declaration": true in your TypeScript config.
Spent a couple of hours trying to identify and reproduce this issue in my project (I don't use vue-cli).

I face with this issue when my component doesn't have props.

I faced with this on
vue: 3.0.0-rc.11
rollup: 2.27.0
ts: 4.0.2

This fails:

export default defineComponent({
 name: 'Test',
 setup(){}
})

while this compiles OK:

export default defineComponent({
 name: 'Test',
 props: {},
 setup(){}
})

@aztalbot fixed on https://github.com/vuejs/vue-next/pull/2124 wait for the next version please

was fixed in rc.12

Was this page helpful?
0 / 5 - 0 ratings