Skip to content

Reasoning for the new decorator import syntax #2122

Answered by justinfagnani
mckamyk asked this question in Q&A
Discussion options

You must be logged in to vote

The only reason is so that non-decorator users don't pay the payload costs of the decorator implementations. This also applies to future transforms that compile the decorators out - once the decorators are removed we can remove the import.

I don't think there are any impacts to TypeScript parsing, but I might not understand the question.

Not loading the files improves native tree-shaking, ie, the browser doesn't load what you don't import. I'm not sure how well code-rewriting tree-shaking worked before, but this is strictly better since it doesn't rely on it.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@mckamyk
Comment options

@mario-d-s
Comment options

@mohe2015
Comment options

@aomarks
Comment options

Answer selected by aomarks
Comment options

You must be logged in to vote
3 replies
@samuelstroschein
Comment options

@justinfagnani
Comment options

@samuelstroschein
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants