News for hackers. Stuff that matters.

venfen

Re:Ryanair – when every page is a dark pattern on Friday July 19, 2024 @07:31AM (#41005157)
Because some companies sell more than places in the plane and there are places that same sit is given to more than one person and there are situations when last on the line can not get on the place since all places are occupied. It happened for friends of us.
Actually the Office team is integration more and more React components in the office programs.
Re:Intent to stop using 'null' in my JS code on Sunday November 01, 2020 @11:47AM (#24960661)
In my job I do a lot of code reviews and I notice that by using Typescript, devs tend to write worse JavaScript code. I often see that developers are assigning `undefined` to properties in order to clean value or to satisfy badly written TS interface, instead of just using JS `delete` statement. Also a lot of times I see passing `undefined` to methods with optional params, instead of just skipping them. Here some bad practices:

If there is an interface: `interface ISomething { x?: string };` and obj of this interface to have `obj.x = undefined` instead of `delete obj.x`.

Writing methods: `function x(param0, param1?, param2?) {}` to be used as `x(1, undefined, '2');` instead of creating the func as `function x(param0, option: { param1?, param2? })` and using as `x(1, { param2: '2' })`.

Returning undefined from a function: `function x(): undefined { return undefined; }`, instead of `function x(): void { return; }`.

Mixing the meanings of `undefined` and `null`, can bring a lot of troubles for JS devs when they use `Object.keys` or using `arguments` in function. IMHO If we keep that `undefined` means missing while `null` means no value, then we will have better JS code, using: `'x' in obj` instead of `obj.x === undefined` or `typeof obj.x === 'undefined'`, `delete obj.x` instead of `obj.x = undefined`, `obj.x = null` and then `obj.x === null` instead of `obj.x == null`.