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 RegExp to the include and exclude fields of the WatcherOptions type #3754

Merged
merged 3 commits into from Sep 1, 2020
Merged

add RegExp to the include and exclude fields of the WatcherOptions type #3754

merged 3 commits into from Sep 1, 2020

Conversation

dagda1
Copy link
Contributor

@dagda1 dagda1 commented Aug 29, 2020

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

Description

Currently, both include and exclude of the WatcherOptions type are typed as only allowing an array of strings

export interface WatcherOptions {
  ....     
  exclude?: string[];
  include?: string[];
}

I found this out by trying to do this:

watch: {
  exclude: [/dir/] // Type 'RegExp[]' is not assignable to type 'string[]'

This would wrongly make you think you can only add a string array.

I've changed the type to:

export interface WatcherOptions {
  ...
  exclude?: (string | RegExp)[];
  include?: (string | RegExp)[];
}

@codecov
Copy link

codecov bot commented Aug 29, 2020

Codecov Report

Merging #3754 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3754   +/-   ##
=======================================
  Coverage   97.02%   97.02%           
=======================================
  Files         185      185           
  Lines        6461     6461           
  Branches     1868     1868           
=======================================
  Hits         6269     6269           
  Misses        101      101           
  Partials       91       91           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 379f2d6...4330dcd. Read the comment docs.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Thanks for spotting, this should definitely be changed! We shouldn't forget to update the types in the website documentation as well in docs/999-big-list-of-options.md, though. Here, it only lists string at the moment.

src/rollup/types.d.ts Outdated Show resolved Hide resolved
@dagda1
Copy link
Contributor Author

dagda1 commented Sep 1, 2020

@lukastaegert thanks for looking at this

I have applied your suggestion and updated 99-big-list-of-options.md.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Thanks!

@lukastaegert lukastaegert merged commit 35bdac7 into rollup:master Sep 1, 2020
@dagda1 dagda1 deleted the add-regex-to-exclude-type branch September 1, 2020 08:35
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