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
typingstopackage.json(should be obsolete, as we comply toindex.d.tsconvention) - [ ] add
index.d.tstowebpack-blockswhich 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
blockis a self-contained, configurable portion of a Webpack Configuration - so actuallyentryPointis the block, notentryPoint(), which could be aBlockInstanceor similar.Then a
blockis 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.