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

(types/refactor): be more specific than 'any' in build code #401

Merged
merged 2 commits into from
Dec 31, 2019

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Dec 28, 2019

  • add types for all options and use those types throughout the
    build/watch code

  • fix some incorrect types in a few places that became more obvious
    or errors once types were added

  • fix default target from 'web' (not an option) to 'browser'

  • extract createBuildConfigs into a separate file as it's fairly long
    and has some relatively complex code

    • and refactor it a bit to make it a bit easier to read as well as
      easier to type (and type cast)

Follow-up to #371 , which was extracted out of this before I finished. I originally started this after #367 as the added types would give a lot of extra confidence around options, which were previously any everywhere. This is also going to merge conflict quite hard against #367 .

Review Notes

There are two type casts I couldn't seem to get around here (guess it hits the limits of TypeScript's inference?), but this is still much better than all the anys, and now new options must be typed and then used properly.

Future Work

createAllFormats (and possibly some of the code around it) is one of those things that could probably be split into a separate rollup plugin.

src/index.ts Show resolved Hide resolved
- add types for all options and use those types throughout the
  build/watch code
- fix some incorrect types in a few places that became more obvious
  or errors once types were added
- fix default target from 'web' (not an option) to 'browser'

- extract createBuildConfigs into a separate file as it's fairly long
  and has some relatively complex code
  - and refactor it a bit to make it a bit easier to read as well as
    easier to type (and type cast)
@jaredpalmer
Copy link
Owner

Resolve conflicts and then lgtm

@jaredpalmer
Copy link
Owner

will merge when the tests pass

@jaredpalmer jaredpalmer merged commit 158ee9a into jaredpalmer:master Dec 31, 2019
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.

3 participants