Skip to content

undefined namespace property will compile to "error" code since typescript v2.9.1 #25391

@linxiaowu66

Description

@linxiaowu66

Hi guys,
A "error" will be happened when there is have a undefined namespace property, for example, I have such a namespace definition, but lack of some property:

export namespace com {
     export namespace alibaba {
         export namespace constant{
             export interface Constant{}
         }
     } 
}

above example I am forgetting to define a namespace test and the interface demo.

Then I use the v2.9.1 to compile this segment code:

function A(a: com.alibaba.test.demo) {}

Ts will generate the "error" code,

var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
function A([typeof (_e = ((_c = ((_d = (typeof com !== "undefined" && com).alibaba) && _d).test) && _c).demo)) === "function" && _e || Object)

the above code can not run.

I test other versions, only the version which > 2.9.0 will compile to this style.

< 2.9.1, eg, 2.9.0, will compile to :

function A(Object)

Any guys who know this compile rule is based on which feature, I read the changeLog but can not find any change which is related to this.

Thanks in advance.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: DecoratorsThe issue relates to the decorator syntaxFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions