Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private field has no type in declaration file #52127

Closed
plohoj opened this issue Jan 6, 2023 · 2 comments
Closed

Private field has no type in declaration file #52127

plohoj opened this issue Jan 6, 2023 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@plohoj
Copy link

plohoj commented Jan 6, 2023

Bug Report

πŸ”Ž Search Terms

private declaration

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about and private fields

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

export class UiKitModule {
    private data: string = '123';
    private getData(params?: string): string {
        return this.data;
    }

    forRoot(params?: string): string {
        return this.getData(params) + '4';
    }
    forChild(params?: string): string {
        return this.getData(params) + '5';
    }
}

export class UiKitModuleNativePrivate {
    #data: string = '123';
    #getData(params?: string): string {
        return this.#data;
    }

    forRoot(params?: string): string {
        return this.#getData(params) + '4';
    }
    forChild(params?: string): string {
        return this.#getData(params) + '5';
    }
}

πŸ™ Actual behavior

// Output d.ts
export declare class UiKitModule {
    private data;
    private getData;
    forRoot(params?: string): string;
    forChild(params?: string): string;
}
export declare class UiKitModuleNativePrivate {
    #private;
    forRoot(params?: string): string;
    forChild(params?: string): string;
}

πŸ™‚ Expected behavior

// Output d.ts
export declare class UiKitModule {
    private data: string;
    private getData(params?: string): string;
    forRoot(params?: string): string;
    forChild(params?: string): string;
}
export declare class UiKitModuleNativePrivate {
    forRoot(params?: string): string;
    forChild(params?: string): string;
}
@plohoj plohoj changed the title Private static field has no type in declaration file Private field has no type in declaration file Jan 6, 2023
@MartinJohns
Copy link
Contributor

This is intentional. In a declaration file the only thing matters is that there is a private property, the type is irrelevant.

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jan 6, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants