-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: DecoratorsThe issue relates to the decorator syntaxThe issue relates to the decorator syntaxRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
π Search Terms
isolatedModules import alias
π Version & Regression Information
- This is the behavior in every version I tried: v5.1.1, v5.2.2, v5.3.0-dev.20230830
β― Playground Link
π» Code
import {Interface} from './types';
import NestedInterface = Interface.NestedInterface;
declare const Input: any;
export class Foo {
@Input prop!: NestedInterface;
}
π Actual behavior
var _a;
import { __decorate, __metadata } from "tslib";
import { Interface } from './types';
var NestedInterface = Interface.NestedInterface; // <-- this can throw at runtime
export class Foo {
}
__decorate([
Input,
__metadata("design:type", typeof (_a = typeof NestedInterface !== "undefined" && NestedInterface) === "function" ? _a : Object)
], Foo.prototype, "prop", void 0);
π Expected behavior
Either of the following would work, I think:
- Make this pattern an error, possibly requiring sth like
import type NestedInterface = Interface.NestedInterface;
- Elide import equals
- Emit
var NestedInterface = ...
using a runtime check, similarly as in the decorator metadata code
Additional information about the issue
Very similar to #49450
erayhanoglu
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: DecoratorsThe issue relates to the decorator syntaxThe issue relates to the decorator syntaxRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone