webpack-blocks
webpack-blocks copied to clipboard
Add TypeScript typings for core & webpack
Hej guys 👋
I started tackling #246, for now only @webpack-blocks/core
& @webpack-blocks/webpack
to have a foundation, so we can discuss naming etc.
Afterwards we just need to add the proper index.d.ts
to the blocks.
If I'm not mistaken there shouldn't be other changes necessary, at least VSCode gave me type hints in the sample app already, but I'll list some here for research:
- [ ] add
typings
topackage.json
(should be obsolete, as we comply toindex.d.ts
convention) - [ ] add
index.d.ts
towebpack-blocks
which exports types from sub-modules (should be infered from sub-module typings) - [ ] find out which
@types/
needs to be installed manually
Thanks for starting work on this, @zcei! Will have a deeper look into it :)
We need to discuss terminology here, since most terms haven't ever been clearly defined. Current state of affairs is:
Initially I was thinking that a
block
is a self-contained, configurable portion of a Webpack Configuration - so actuallyentryPoint
is the block, notentryPoint()
, which could be aBlockInstance
or similar.Then a
block
is everything that has the signature(...args: any[]): BlockInstance
, whereBlockInstance = (current) WebpackBlock
If someone has a better naming suggestion for BlockInstance
, feel free to share it here 😉
Another term that might be discussable is WebpackBlockUpdater
.
Maybe it's rather a WebpackConfigUpdater
: It's actually so generic that it's not webpack-blocks-specific. And this name might transport more information. Objections?
Update: Let's better discuss this in the issue (#246) than in the PR.