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

Refactor/Improve some typings #909

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Oct 15, 2020

  1. types: add remaining external typings

    - added @types/babel__core, @types/babel__traverse, and
      @types/lodash.merge and removed their declarations in env.d.ts
      - also removed rollup-plugin-terser's declaration there because it
        has types built-in
      - remaining actually don't have types per in-line comments
    
    - this improved type-checking allowed TS to do stricter checks and so
      exposed a few type errors that were fixed as well
      - @rollup/plugin-babel depends on @types/babel__core as well, so the
        declaration here had previously overridden it
        - `custom` had to be augmented as it's not an option of
          `@rollup/plugin-babel`
        - `passPerPreset` did too though... it's not in `@types/babel__core`
          but it is a (deprecated) Babel option
          - logs seemed to show it was `false` regardless of what was
            passed in though...
      - Rollup's `plugins` now started complaining that `false` wasn't a
        valid Plugin either, so added a `.filter(Boolean)` but that didn't
        fully fix it so had to type-cast
    agilgur5 committed Oct 15, 2020
    Configuration menu
    Copy the full SHA
    422ca59 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2020

  1. refactor/fix: consistently use capital TSDX everywhere

    - Jared had asked in a review comment back in December to consistently
      use capital TSDX (not `tsdx`) so this establishes that throughout the
      rest of the codebase
      - I don't think any of these lines/files/variables were written by me,
        so I'm just fixing up existing ones
    
    - this came up as I was refactoring typings, so wanted to make sure
      everything was consistent as I went
    
    - rename variable TsdxOptions to TSDXOptions
    - rename babelPluginTsdx to babelPluginTSDX
      - and rename the file to this as well
        - and links to the file in the docs
    - clarify extractErrors error message to specify `tsdx build`, not just
      "tsdx"
    - use TSDX instead of `tsdx` in template docs
      - don't change contributing docs though, because in that one it's
        referring to the bin global or repo `tsdx`, which is correct
    agilgur5 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    6c5da74 View commit details
    Browse the repository at this point in the history
  2. refactor/types: explicitly name "at least one" types

    - previously I had used the `[typeX, ...typeX[]]` TS syntax in types,
      which means an array of at least one of those types
      - I actually had to look up how to do this when I originally wrote it
        and it even confused Shawn when I did
      - now I've looked at a few times and it takes me a second to realize
        what that means again, so hopefully this change makes it easier to
        understand the type at-a-glance and has less mental overhead
    agilgur5 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    ca25438 View commit details
    Browse the repository at this point in the history
  3. refactor/types: add a type for RollupOptionsWithOutput

    - `RollupOptions & { output: OutputOptions }` was used a few times
      in the codebase, so create a type makes this re-usable and consistent
      - so it doesn't have to be augmented everywhere in-line like that
      - and also documents its meaning
    agilgur5 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    b85734b View commit details
    Browse the repository at this point in the history
  4. refactor/types: add a TSDXConfig type

    - another PR by a contributor exposes the types for `tsdx.config.js` in
      order to be used in JSDoc, so this makes it so only a single type is
      needed and exported
      - the exact type needed is the only exported basically
      - and that we're not re-exporting Rollup types directly
    agilgur5 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    7216476 View commit details
    Browse the repository at this point in the history