module-builder icon indicating copy to clipboard operation
module-builder copied to clipboard

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

Open alSergey opened this issue 1 year ago • 5 comments

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

alSergey avatar Jun 17 '24 11:06 alSergey

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

danielroe avatar Jun 18 '24 18:06 danielroe

@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?

alSergey avatar Jun 20 '24 18:06 alSergey

@danielroe Hi, is there any progress on this issue?

alSergey avatar Jul 15 '24 07:07 alSergey

@manniL hi, can you please tell me if there is any progress on this issue?

alSergey avatar Jul 18 '24 12:07 alSergey

@danielroe Hi, is there any progress on this issue?

alSergey avatar Jul 30 '24 10:07 alSergey

Looks like I have a similar problem

Neemsigo avatar Sep 10 '24 13:09 Neemsigo

This is how TS outputs the types: CleanShot 2024-09-10 at 14 46 20@2x

export declare const useAuthInfo: () => {
    authInfo: Readonly<import("vue").Ref<{
        readonly userId?: number | undefined;
        readonly login?: string | undefined;
    } | undefined, {
        readonly userId?: number | undefined;
        readonly login?: string | undefined;
    } | undefined>>;
};

See https://stackblitz.com/edit/stackblitz-starters-ayewdt. It's not an issue with @nuxt/module-builder. Possibly an upstream one in https://github.com/vuejs/core.

danielroe avatar Sep 10 '24 13:09 danielroe