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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:28:54+00:00 2026-06-15T00:28:54+00:00

Background Currently at the place I work, we use dojo.requires to import all of

  • 0

Background

Currently at the place I work, we use dojo.requires to import all of our needed classes we use with each class. However, in Dojo 2.0 they are getting rid of dojo.require and going to the amd require style ( http://livedocs.dojotoolkit.org/releasenotes/migration-2.0 ):

require(["dijit/form/Button", "dojox/layout/ContentPane", ...], 
   function(Button, ContentPane, ...){
    // CODE HERE
});

We currently have our dojo/dijit classes defined like the following in their own .d.ts files:

module dijit.form{
    export class Button extends dijit.form._FormWidget {
        showLabel : bool;
        _onClick (e:any) : any;
        _onButtonClick (e:any) : any;
        _setShowLabelAttr (val:any) : any;
        _clicked (e:any) : any;
        setLabel (content:String) : any;
        _setLabelAttr (content:String) : any;
        _setIconClassAttr (val:String) : any;
    }
}

This allows us to extend those classes like the following:

class CustomButton extends dijit.form.Button {}

Problem

We would like to be able to have typescript generate the Dojo 2.0 (amd) style requires, and do something like the following:

import Button = module("dijit/form/Button")
class CustomButton extends Button {}

Which we had hoped would compile to something like the following:

define(["require", "exports", "dijit/form/Button"], function(require, exports, Button)    
{
    ///....Generated class    
})

However, this does not work, as import only works for modules and not classes. We get an error like:

The name '"dijit/form/Button"' does not exist in the current scope
A module cannot be aliased to a non-module type

We’ve also tried to define the dijit classes like:

declare module "dijit/form" {
    export class Button....
}

Is there a way we can achieve what we are trying to do?

Thanks

  • 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-15T00:28:56+00:00Added an answer on June 15, 2026 at 12:28 am

    In AMD modules, a module equates to a file, so if you had a file named:

    dijit.forms.ts or even dijit.forms.d.ts

    You could load it using

    import forms = module("dijit.forms");
    
    var button = new forms.Button();
    

    Inside of the definition file for AMD applications you don’t need to declare the module, because the file is the module.

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

Sidebar

Related Questions

Currently I have a splash screen in place. However, it does not work as
I am attempting to use background-image:url('path/to/image.png'); to place a background image in a div
Background Currently in a project of mine I am using jQuery autocomplete for a
Background Currently, I am working on a Rails application. I have different products that
Background : I'm currently, for my University, creating some simple apps showcasing the possible
Background : I'm currently writing a greasemonkey script that embeds/modifies a specific page's html.
Problem background I am currently developing a framework of Ant Colony System algorithms. I
Some background I'm currently building a predominantly classic web app (rather than a single
Some background I'm currently working on a mobile site so I keep switching user
Some historic background: I'm currently working with Wowza and attempting to decode the AMFPackets

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.