Skip to content

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

Merged
jaredpalmer merged 2 commits intojaredpalmer:masterfrom
agilgur5:more-build-types
Dec 31, 2019
Merged

(types/refactor): be more specific than 'any' in build code#401
jaredpalmer merged 2 commits intojaredpalmer:masterfrom
agilgur5:more-build-types

Conversation

@agilgur5
Copy link
Copy Markdown
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.

Comment thread src/index.ts
- 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
Copy Markdown
Owner

Resolve conflicts and then lgtm

@jaredpalmer
Copy link
Copy Markdown
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