mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 12:32:08 -06:00
Fix 8355: Fix emit metadata different between transpile and tsc --isolatedModule (#9232)
* Instead of returning undefined for unknownSymbol return itself * Add Transpile unittest * Wip - Add project tests * Add project tests and baselines * Update existed tests * Add tests for emitting metadata with module targetting system
This commit is contained in:
parent
fb3f823dde
commit
e182ecf2c9
@ -1265,9 +1265,13 @@ namespace ts {
|
||||
const right = name.kind === SyntaxKind.QualifiedName ? (<QualifiedName>name).right : (<PropertyAccessExpression>name).name;
|
||||
|
||||
const namespace = resolveEntityName(left, SymbolFlags.Namespace, ignoreErrors);
|
||||
if (!namespace || namespace === unknownSymbol || nodeIsMissing(right)) {
|
||||
if (!namespace || nodeIsMissing(right)) {
|
||||
return undefined;
|
||||
}
|
||||
else if (namespace === unknownSymbol) {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning);
|
||||
if (!symbol) {
|
||||
if (!ignoreErrors) {
|
||||
|
||||
@ -46,8 +46,9 @@ var MyClass = (function () {
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof db_1.default !== 'undefined' && db_1.default.db) === 'function' && _a) || Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass = MyClass;
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
define(["require", "exports", "angular2/core"], function (require, exports, ng) {
|
||||
"use strict";
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
define(["require", "exports", "angular2/core"], function (require, exports, ng) {
|
||||
"use strict";
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJS",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
define(["require", "exports", "angular2/core"], function (require, exports, ng) {
|
||||
"use strict";
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJS",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
define(["require", "exports", "angular2/core"], function (require, exports, ng) {
|
||||
"use strict";
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
define(["require", "exports", "angular2/core"], function (require, exports, ng) {
|
||||
"use strict";
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"main.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"main.js"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
foo,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
exports.MyClass1 = MyClass1;
|
||||
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng = require("angular2/core");
|
||||
var MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
fooexport,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
//# sourceMappingURL=file.js.map
|
||||
@ -0,0 +1,35 @@
|
||||
System.register(["angular2/core"], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var ng;
|
||||
var MyClass1;
|
||||
return {
|
||||
setters:[
|
||||
function (ng_1) {
|
||||
ng = ng_1;
|
||||
}],
|
||||
execute: function() {
|
||||
MyClass1 = (function () {
|
||||
function MyClass1(_elementRef) {
|
||||
this._elementRef = _elementRef;
|
||||
}
|
||||
MyClass1 = __decorate([
|
||||
fooexport,
|
||||
__metadata('design:paramtypes', [(typeof (_a = typeof ng !== 'undefined' && ng.ElementRef) === 'function' && _a) || Object])
|
||||
], MyClass1);
|
||||
return MyClass1;
|
||||
var _a;
|
||||
}());
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=file.js.map
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataCommonJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true
|
||||
}
|
||||
6
tests/cases/project/emitDecoratorMetadataSystemJS.json
Normal file
6
tests/cases/project/emitDecoratorMetadataSystemJS.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJS",
|
||||
"baselineCheck": true,
|
||||
"runTest": true
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModule",
|
||||
"baselineCheck": true,
|
||||
"runTest": true
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"scenario": "Emit decorator metadata when commonJS and isolatedModules are on",
|
||||
"projectRoot": "tests/cases/projects/decoratorMetadata/emitDecoratorMetadataSystemJSIsolatedModuleNoResolve",
|
||||
"baselineCheck": true,
|
||||
"runTest": true
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import * as ng from "angular2/core";
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import * as ng from "angular2/core";
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import * as ng from "angular2/core";
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import * as ng from "angular2/core";
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import * as ng from "angular2/core";
|
||||
|
||||
declare function foo(...args: any[]);
|
||||
|
||||
@foo
|
||||
export class MyClass1 {
|
||||
constructor(private _elementRef: ng.ElementRef){}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
@ -429,5 +429,43 @@ var x = 0;`, {
|
||||
transpilesCorrectly("Supports setting 'typeRoots'", "x;", {
|
||||
options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
|
||||
transpilesCorrectly("Correctly serialize metadata when transpile with CommonJS option",
|
||||
`import * as ng from "angular2/core";` +
|
||||
`declare function foo(...args: any[]);` +
|
||||
`@foo` +
|
||||
`export class MyClass1 {` +
|
||||
` constructor(private _elementRef: ng.ElementRef){}` +
|
||||
`}`, {
|
||||
options: {
|
||||
compilerOptions: {
|
||||
target: ScriptTarget.ES5,
|
||||
module: ModuleKind.CommonJS,
|
||||
moduleResolution: ModuleResolutionKind.NodeJs,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
isolatedModules: true,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
transpilesCorrectly("Correctly serialize metadata when transpile with System option",
|
||||
`import * as ng from "angular2/core";` +
|
||||
`declare function foo(...args: any[]);` +
|
||||
`@foo` +
|
||||
`export class MyClass1 {` +
|
||||
` constructor(private _elementRef: ng.ElementRef){}` +
|
||||
`}`, {
|
||||
options: {
|
||||
compilerOptions: {
|
||||
target: ScriptTarget.ES5,
|
||||
module: ModuleKind.System,
|
||||
moduleResolution: ModuleResolutionKind.NodeJs,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
isolatedModules: true,
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user