Category: typescript

C# style object initialisation in TypeScript

@RoutingKey(‘abc’) class Foo { public name: string | undefined; public age: number | undefined; public gender: string | undefined; constructor(init?: Partial<Foo>) { if (init) { Object.assign(this, init); } } } const foo = new Foo({ name: ‘something’ }); https://stackoverflow.com/a/72028371/1515209 Read more →

Profile webpack

setup install https://github.com/stephencookdev/speed-measure-webpack-plugin npm install –save-dev speed-measure-webpack-plugin open the webpack config file – for me this was webpack.config.js the file contained the following: module.exports = { // … }; which is changed to const SpeedMeasurePlugin = require(“speed-measure-webpack-plugin”); const smp = new SpeedMeasurePlugin(); module.exports = smp.wrap({ // … }); results for me the biggest win I had this time was with… Read more →