nuxt / module-builder

Complete solution to build and ship Nuxt modules.
MIT License
211 stars 22 forks source link

Incorrect `d.ts` file generation from `runtime` folder #290

Open alSergey opened 1 week ago

alSergey commented 1 week ago

Describe the bug

The following type is generated in the file dist/runtime/store/store.d.ts

export declare const useAuthStore: () => {
    getAuthInfo: () => Promise<void>;
    authInfo: Readonly<import("vue").Ref<{
        readonly userId?: number | undefined;
        readonly login?: string | undefined;
    } | undefined>>;
    isLoadingAuthInfo: Readonly<import("vue").Ref<boolean>>;
    authInfoError: Readonly<import("vue").Ref<Readonly<unknown>>>;
};

The following type should be generated

export declare const useAuthStore: () => {
    getAuthInfo: () => Promise<void>;
    authInfo: {
        readonly userId?: number | undefined;
        readonly login?: string | undefined;
    } | undefined;
    isLoadingAuthInfo: readonly boolean;
    authInfoError: readonly unknown;
};

Reproduction

Open StackBlitz and go to dist/runtime/store/store.d.ts

danielroe commented 1 week ago

Interesting. I wonder if this is an issue with vue-tsc, which is generating these types...

alSergey commented 1 week ago

@danielroe hi, did I understand correctly that I need to create an issue on vue-tsc? And how can I properly explain the problem to them, considering that I'm using @nuxt/module-builder, which uses vue-tsc somewhere under the hood?