
Description
TypeScript Version: 2.1.4
Code
Interface definition:
export interface Event { title: string };
Decorated property:
import { Event } from './event.ts';
import { Input } from '@angular/core';
export class SomeClass {
@Input() event: Event;
}
Expected behavior:
In the generated code it should be able to find the event module.
Actual behavior:
It compiles and in the browser, the Input function is looking for a variable named Event which doesn't exist on the module.
The error is this:
Uncaught ReferenceError: event_1 is not defined
And the code generated looks like this:
__decorate([
core_1.Input(),
__metadata("design:type", event_1.Event)
]
Leaving out the type declaration for the decorated property or declare it as an any
type works. Is there a better workaround than this? Perhaps declaring the type of that property in a declarations file?
edit: I found another workaround, I can declare an extra variable, export it from the event.ts and then import it and do a console.log (just to make sure it isn't compiled out). There's a bunch of logs in the console but it does load up.