webpack-blocks icon indicating copy to clipboard operation
webpack-blocks copied to clipboard

Add TypeScript typings for core & webpack

Open zcei opened this issue 7 years ago • 4 comments

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 to package.json(should be obsolete, as we comply to index.d.ts convention)
  • [ ] add index.d.ts to webpack-blocks which exports types from sub-modules (should be infered from sub-module typings)
  • [ ] find out which @types/ needs to be installed manually

zcei avatar Jan 07 '18 16:01 zcei

Thanks for starting work on this, @zcei! Will have a deeper look into it :)

andywer avatar Jan 09 '18 09:01 andywer

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 actually entryPoint is the block, not entryPoint(), which could be a BlockInstance or similar.

Then a block is everything that has the signature (...args: any[]): BlockInstance, where BlockInstance = (current) WebpackBlock

If someone has a better naming suggestion for BlockInstance, feel free to share it here 😉

andywer avatar Jan 30 '18 17:01 andywer

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?

andywer avatar Jan 30 '18 17:01 andywer

Update: Let's better discuss this in the issue (#246) than in the PR.

andywer avatar Jan 30 '18 17:01 andywer