Skip to content
New issue

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

add rule to warn about type-only imports of classes with emitDecoratorMetadata #676

Open
ajafff opened this issue Jan 4, 2020 · 0 comments

Comments

@ajafff
Copy link
Member

ajafff commented Jan 4, 2020

// @experimentalDecorators: true
// @emitDecoratorMetadata: true

// @filename: a.ts
export class C {}

// @filename: b.ts
import type { C } from "./a";
declare const decorator: ClassDecorator;

@decorator
export class B {
    constructor(private p: C) {}
}

There should be a finding on the type-only import of C in b.ts as C would be used in the metadata if its type was available.
Since auto-import only appends to existing import statements, it's easy to introduce such an import without noticing. This might cause some hard to debug errors with your favorite dependency-injection library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant