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

fix: deep merge user's module options #578

Merged
merged 3 commits into from
Mar 19, 2023
Merged

fix: deep merge user's module options #578

merged 3 commits into from
Mar 19, 2023

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented Mar 19, 2023

User options were overwriting the defaults so it was not possible to override just some of the options.

@rchl rchl requested a review from danielroe March 19, 2023 11:05
@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@e9dbc3d). Click here to learn what that means.
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 38f5c68 differs from pull request most recent head 933a717. Consider uploading reports for the commit 933a717 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             master      #578   +/-   ##
==========================================
  Coverage          ?   100.00%           
==========================================
  Files             ?         2           
  Lines             ?        35           
  Branches          ?         9           
==========================================
  Hits              ?        35           
  Misses            ?         0           
  Partials          ?         0           
Impacted Files Coverage Δ
packages/typescript-build/src/index.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Looks great to me. Only would note that this is probably a 'breaking fix' in case a user is unintentionally relying on this behaviour (= entirely overriding module options). Maybe would be need to be released in a minor?

wdyt?

@rchl
Copy link
Collaborator Author

rchl commented Mar 19, 2023

This module's default options are:

const defaults: Options = {
  ignoreNotFoundWarnings: false,
  typeCheck: true
}

where typeCheck can be an object and can include extra options.

If someone uses object value then before this change the module's defaults for typeCheck, which are:

          configFile: path.resolve(this.options.rootDir!, 'tsconfig.json'),
          extensions: {
            vue: true
          }

would be overwritten completely. So to get things to work currently users need to re-add those manually anyway which with changes in this PR, when merged with defaults, will effectively end up being the same as before.

The case where I've noticed this being an issue was when I set typeCheck: {} which isn't really functional on its own so nobody is doing that now but it will work with those changes.

So I would consider this a bug fix and I can't imagine this causing some breaking behavior.

@rchl rchl changed the title fix: properly merge user's module options fix: deep merge user's module options Mar 19, 2023
@rchl rchl merged commit d95453e into master Mar 19, 2023
@rchl rchl deleted the fix/merge-options branch March 19, 2023 15:57
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.

2 participants