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 8661159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:25:53+00:00 2026-06-12T16:25:53+00:00

I read the TypeScript specification located at: http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf However it got me confused with

  • 0

I read the TypeScript specification located at:
http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf

However it got me confused with following:

  1. Interface
  2. Class
  3. Modules
  4. Programs
  5. Functions.
  6. Declare vs. var

Could someone briefly help to understand which one of above should be used when? Is Interface and Class same as C# version?

  • 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-12T16:25:54+00:00Added an answer on June 12, 2026 at 4:25 pm

    I have made these answers match C# as you’ve mentioned that in your question, but hopefully the answers are useful to people coming to TypeScript from similar languages too.

    Interface

    An interface in TypeScript is similar to those you have come across in C#. It is a contract – if one of your classes implements an interface, it promises to have certain properties or methods that the interface documents.

    In TypeScript an interface can inherit from another interface in order to extend it and from a class to capture its implementation.

    Whenever something seems impossible in TypeScript, you can usually solve it with an interface!

    In TypeScript, interfaces have a broad range of uses. They describe a structure, so can be used anywhere you use a type (i.e. not just to implement them in a class, you can use them to type variables, parameters, return values and so on).

    Class

    This is very similar to the concept of a class in C#. You can inherit from other classes to extend or specialise the behaviour.

    Namespace

    The newer namespace keyword is used to place a group of code within a limited scope. This is similar to C# namespaces.

    Module

    Modules are better than namespaces when it comes to TypeScript. A module (previously known as an external module) is a file that is self contained and adds nothing to your global scope. You can load modules into local variables as you need them. Modules provide a good way to organise your code and load parts on demand. When using modules, it is best to avoid using namespaces. Modules are better than namespaces.

    Program

    A program is a collection of modules, classes. This is essentially the thing you have written using TypeScript.

    Function / Method

    Classes contain methods, and you can also write stand-alone functions that do not belong to a class.

    Declare vs. var

    var creates a new variable. declare is used to tell TypeScript that the variable has been created elsewhere. If you use declare, nothing is added to the JavaScript that is generated – it is simply a hint to the compiler.

    For example, if you use an external script that defines var externalModule, you would use declare var externalModule to hint to the TypeScript compiler that externalModule has already been set up.

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

Sidebar

Related Questions

read many posts about the difference between the 3 idioms. But got more confused,
Read some texts about locking in PHP. They all, mainly, direct to http://php.net/manual/en/function.flock.php .
I read http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html but have some issues. For pre-honeycomb I want a custom title,
Read about Fog: http://fog.io Does Python have anything like it? (a library for cloud
I read in a jbpm forum article https://community.jboss.org/thread/165545 describing the HumanTaskHandler as Asynchronous workitem
Read a few things online and here but am now confused. What I want
Read the old content into $content , then write $string . $content back into
Read about Server push here . I want to push data to client from
Read on before you say this is a duplicate, it's not. (as far as
Read (skimmed enough to get coding) through Erlang Programming and Programming Erlang . One

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.