Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:22:07+00:00 2026-06-14T16:22:07+00:00

I would like some advice. I am using typescript to create dialog boxes. Once

  • 0

I would like some advice. I am using typescript to create dialog boxes. Once created they take care of themselves as they have their own submit buttons and do there own checking.

Is there any advantage or disadvantage to either of the following two ways of coding? So far the only thing I can see is that the module approach with export allows me to hide a function and make it private if I don’t export it. When I use static and try to use the private modifier it shows a lock icon against it in intellisense but still lets me use it.

module Dialog {
    export class Modal {
        static createAccessModal(link: Link) {
            createModal(link);
        }
        static createAdminModal(link: Link) {
            link.Modal.MaxHeight = 600;
            link.Modal.Width = false;
            createModal(link);
        }
        static private createModal(link: Link) {

            ...
        }
    }
}

or doing:

module Dialog {
    export module Modal {
        export function createAccessModal(link: Link) {
            createModal(link);
        }
        export function createAdminModal(link: Link) {
            link.Modal.MaxHeight = 600;
            link.Modal.Width = false;
            createModal(link);
        }
        function createModal(link: Link) {

            ...
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:22:08+00:00Added an answer on June 14, 2026 at 4:22 pm

    The module approach is preferred for what you are trying to achieve.

    If using the class form, you’re effectively defining a constructor function even though you will never new up object instances, and adding members directly on the constructor function that cannot be truly private (as you observed).

    Using the module approach you are simply constructing an object, and members you don’t export are contained within the closure that sets up the object – giving you true privacy on them.

    A good way to see the effects of both is to paste your code for each into http://www.typescriptlang.org/Playground/ and analyze the generated code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like some advice. I'm going to be using an sqlite database that
I would like some advice on the best approach to use in the following
I am designing RESTful Api's and would like some advice on designing an API
I am considering starting an OSS project and would like some advice. I would
I'm looking into building a distributed application and would like some advice on the
i am new to java, and would like some advice on the following i
I would really like some advice here, to give some background info I am
I'm new on this, and I would like to get some advice because I
I am new to the MVVM model, so I would like some advice, the
I would like to get some advice on structuring my javascript code and jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.