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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:15:15+00:00 2026-06-15T20:15:15+00:00

We are in the process of converting some of our javascript to be typescript.

  • 0

We are in the process of converting some of our javascript to be typescript. We have some existing functionality that we have pulled out into another javascript library that is maintained by us, for example:

Framework.utils = {
    utilFnOne: function ()...,
    utilFnTwo: function ()...,
    utilFnThree: function ()...,
}

We also have some utilities that we use in our non framework code that is like this:

Current.utils = Framework.utils;  // Extend the framework's utils
Current.utils.utilFnFour = function()...;
Current.utils.utilFnFive = function()...;

Typescript

We can create definitions for the framework library as follows:

declare module Framework.utils {
    export function utilFnOne();
    export function utilFnTwo();
    export function utilFnThree();
}

And we can create a typescript definition for Current.utils by doing something like:

module Current.utils {
     export function utilFnFour() {}
     export function utilFnFive() {}
     export class StringUtils { }
}

It would be nice if we could do something like this:

module Current.utils extends Framework.utils { .... }

So that intellisense would show members from both Framework and Current when we do

Current.utils.  

Edit – Resolution

I took the idea that Ryan had and modified it slightly

Framework.d.ts

declare module Framework {
    export var util: _utilImpl;
    export class _utilImpl {
        utilFnOne(a: string) : string;
    }
}

Current.ts

module Current {
    export var util = new _utilImpl();
    export class _utilImpl extends Framework._utilImpl {
        utilFnTwo(b: number) : number;
    }
}
  • 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-15T20:15:16+00:00Added an answer on June 15, 2026 at 8:15 pm

    You can refactor this a bit using interface instead of module to get the desired behavior:

    interface FrameworkUtils {
        utilFnOne(s: string);
        utilFnTwo(s: string);
    }
    
    declare module Framework {
        export var utils: FrameworkUtils;   
    }
    
    Framework.utils.utilFnOne('');
    
    /// ... later
    
    interface CurrentUtils extends FrameworkUtils {
        utilFnFour();
    }
    
    declare module Current {
        export var utils: CurrentUtils; 
    }
    
    Current.utils.utilFnOne('');
    Current.utils.utilFnFour();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of converting some of our web services to MVC3
I'm in the process of migrating some of our old code into Java and
We are in the process of converting a batch job that processes our bounced
I'm in the process of converting some LaTeX documentation to restructured text and having
I am in the process of converting our logging implementation to use System.Diagnostics.TraceSource. We
We are in the process of converting from CVS to Mercurial hg. Our infrastructure
I am in the process of converting some code from C# to Java. I
I'm in the process of converting some queries to prepared statements and I currently
I am in a process of converting some legacy SQL Server Stored Procedures to
In some of our BizTalk 2009 development environments, when attempting to process a HIPPA

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.