We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: 2.1.5
Code
"compilerOptions": { "target": "es5", "module": "commonjs", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strictNullChecks": true }
// In file thing.ts export class Thing {}
// In file thing-holder.ts import {Thing} from "./thing"; function decorator() { return (...v: any[]) => {}; } export class ThingHolder { @decorator() private thing: Thing | null; }
The compiled javascript for ThingHolder looks as follows:
"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); }; function decorator() { return function () { var v = []; for (var _i = 0; _i < arguments.length; _i++) { v[_i] = arguments[_i]; } }; } var ThingHolder = (function () { function ThingHolder() { } return ThingHolder; }()); __decorate([ decorator(), __metadata("design:type", thing_1.Thing) ], ThingHolder.prototype, "thing", void 0); exports.ThingHolder = ThingHolder;
Notice the reference to thing_1 in the call to __decorate which should have been the result of a call to require("./thing").
thing_1
__decorate
require("./thing")
If I change the type of thing in ThingHolder and remove the | null, the call to require("./thing") gets added as expected.
thing
ThingHolder
| null
Expected behavior:
Thing gets imported
Thing
Actual behavior:
Thing is not imported
The text was updated successfully, but these errors were encountered:
Duplicate of #13449
Sorry, something went wrong.
No branches or pull requests
TypeScript Version: 2.1.5
Code
The compiled javascript for ThingHolder looks as follows:
Notice the reference to
thing_1
in the call to__decorate
which should have been the result of a call torequire("./thing")
.If I change the type of
thing
inThingHolder
and remove the| null
, the call torequire("./thing")
gets added as expected.Expected behavior:
Thing
gets importedActual behavior:
Thing
is not importedThe text was updated successfully, but these errors were encountered: