Open agilgur5 opened 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/formium/tsdx/nrywlnc8b
✅ Preview: https://tsdx-git-typings-refactor.formium.vercel.app
Description
Commits
types: add remaining external typings
added @types/babelcore, @types/babeltraverse, and @types/lodash.merge and removed their declarations in env.d.ts
this improved type-checking allowed TS to do stricter checks and so exposed a few type errors that were fixed as well
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 optionfalse
regardless of what was passed in though...plugins
now started complaining thatfalse
wasn't a valid Plugin either, so added a.filter(Boolean)
but that didn't fully fix it so had to type-castrefactor/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 codebasethis came up as I was refactoring typings, so wanted to make sure everything was consistent as I went
refactor/types: explicitly name "at least one" types
refactor/types: add a type for RollupOptionsWithOutput
refactor/types: add a TSDXConfig type
tsdx.config.js
in order to be used in JSDoc, so this makes it so only a single type is needed and exportedTags
tsdx
, "tsdx", etc was requested in https://github.com/formium/tsdx/pull/400#discussion_r361858698. Maybe in an earlier issue/PR too, but I couldn't find or remember it.TSDXConfig
type is pretty much just to simplify #823Review Notes
The
passPerPreset
augmentation for@rollup/plugin-babel
/@types/babel__core
that is mentioned above is pretty confusing. I decided to leave it as is for now so as to potentially change anything, but my logs seem to show it isn't used 😕 🤔 :Babel log output:
```ts PartialConfig { options: { sourceMaps: true, caller: { name: '@rollup/plugin-babel', supportsStaticESM: true, supportsDynamicImport: true, supportsTopLevelAwait: true }, filename: '[redacted]/tsdx/stage-build-default/src/syntax/jsx-import/JSX-B.jsx', babelrc: false, configFile: false, passPerPreset: false, envName: 'test', cwd: '[redacted]/tsdx/stage-build-default', root: '[redacted]/tsdx/stage-build-default', plugins: [], presets: [] }, babelignore: undefined, babelrc: undefined, config: undefined } { sourceMaps: true, caller: { name: '@rollup/plugin-babel', supportsStaticESM: true, supportsDynamicImport: true, supportsTopLevelAwait: true }, filename: '[redacted]/tsdx/stage-build-default/src/syntax/jsx-import/JSX-B.jsx', babelrc: false, configFile: false, passPerPreset: false, envName: 'test', cwd: '[redacted]/tsdx/stage-build-default', root: '[redacted]/tsdx/stage-build-default', plugins: [ ConfigItem { value: [Function], options: {}, dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] }, ConfigItem { value: [Function: _default], options: {}, dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] }, ConfigItem { value: [Function], options: {}, dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] }, ConfigItem { value: [Function], options: [Object], dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] }, ConfigItem { value: [Function], options: [Object], dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] } ], presets: [ ConfigItem { value: [Function], options: [Object], dirname: '[redacted]/tsdx/stage-build-default', name: undefined, file: [Object] } ] } PartialConfig { options: { sourceMaps: true, caller: { name: '@rollup/plugin-babel', supportsStaticESM: true, supportsDynamicImport: true, supportsTopLevelAwait: true }, filename: '[redacted]/tsdx/stage-build-default/src/syntax/jsx-import/JSX-B.jsx', babelrc: false, configFile: false, passPerPreset: false, envName: 'test', cwd: '[redacted]/tsdx/stage-build-default', root: '[redacted]/tsdx/stage-build-default', plugins: [], presets: [] }, babelignore: undefined, babelrc: undefined, config: undefined } ```Misc
This will be rebased in as each commit is independent and some have some lengthy messages.