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

feat: add @forbidExtraArgs decorator #72

Merged
merged 5 commits into from
Nov 4, 2021

Conversation

kevinhinterlong
Copy link
Collaborator

  • throws error if unknown arguments are passed (e.g. no corresponding @arg in component)
  • only extend class in debug mode
  • update docs for @forbidExtraArgs

- throws error if unknown arguments are passed (e.g. no corresponding
  @arg in component)
- only extend class in debug mode
- update docs for @@forbidExtraArgs
@kevinhinterlong kevinhinterlong marked this pull request as ready for review October 22, 2021 17:53
addon/-private/closest-string.ts Outdated Show resolved Hide resolved
addon/decorator.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,54 @@
// https://stackoverflow.com/a/36566052
function editDistance(s1: string, s2: string) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can prune this from prod build.

Copy link
Collaborator Author

@kevinhinterlong kevinhinterlong Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to remove the code, but not the module from the prod build using @embroider/macros.

Here's the stats of npm ci && ember build --environment="production"

9dfb367 (origin/main)
dist/assets/vendor-cc4233d3b7e5776c9b844d7c3d4ad987.js: 453.59 KB (127.62 KB gzipped)

0ead844
dist/assets/vendor-745ebb22057b189d3eb1f47842a4565d.js: 455.02 KB (128.07 KB gzipped)

a3cd41a
dist/assets/vendor-c13bd7dc8daa2fed4b29e9042c69bd03.js: 454.52 KB (127.82 KB gzipped)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this is how prop-types does it too. https://github.com/jkusa/ember-arg-types#production

@jkusa
Copy link
Owner

jkusa commented Nov 4, 2021

Closing then opening to trigger build

@jkusa jkusa closed this Nov 4, 2021
@jkusa jkusa reopened this Nov 4, 2021
@jkusa jkusa merged commit 3c05091 into jkusa:main Nov 4, 2021
@kevinhinterlong kevinhinterlong deleted the forbid-extra-args branch November 4, 2021 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants