Skip to content

Imports left out of module dependencies when not directly assigned or assigned to. #2132

Closed
@QueueHammer

Description

@QueueHammer

In the following case a module defined in TypeScript will not be included in the required modules of the module.

import something = require('Something');

angular.module('app')
.controller('somethingController', [
  'definedInSomething', function (definedInSomething: something.myInterfaceOrType) {
    definedInSomething; //Not defined, and not reached because 'definedInSomething' was not included
  }
]);

The module that is generated is:

define(["require", "exports"], function(require, exports) {

Instead of:

define(["require", "exports", 'Something'], function(require, exports, Something) {

Assigning something to another value or accessing the properties of something will cause it to be added to the module signature.

In any case the values defined in the import x = require('y') should be added to the module dependencies. The author has explicitly added the reference and as such has an expectation that it will be included in the dependencies of the current module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions