Skip to content

Directive prologues emitted outside of module wrappers #5059

@weswigham

Description

@weswigham

Given

"use strict";
export function Relation(callback: () => new() => any): PropertyDecorator {
    return function () {
        console.log(callback());
    }
}

we presently emit:

"use strict";
define(["require", "exports"], function (require, exports) {
    function Relation(callback) {
        return function () {
            console.log(callback());
        };
    }
    exports.Relation = Relation;
});

but should emit:

define(["require", "exports"], function (require, exports) {
    "use strict";
    function Relation(callback) {
        return function () {
            console.log(callback());
        };
    }
    exports.Relation = Relation;
});

Our current emit is detrimental to the module concatenation story, as it:

  • Litters the concatenated files with useless string literals.
  • Breaks concatenating strict and non-strict modules together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions