Typed function parameters using destructuring and rest in TypeScript

To add type declarations to destructured parameters you need to declare the type of the containing object. From the typescript documentation: … Confusingly, the colon here does not indicate the type. The type, if you specify it, still needs to be written after the entire destructuring… let { a, b }: { a: string, b: … Read more

What is the meaning of “…args” (three dots) in a function definition?

With respect to (…args) =>, …args is a rest parameter. It always has to be the last entry in the parameter list and it will be assigned an array that contains all arguments that haven’t been assigned to previous parameters. It’s basically the replacement for the arguments object. Instead of writing function max() { var … Read more

Spread Syntax vs Rest Parameter in ES2015 / ES6

When using spread, you are expanding a single variable into more: var abc = [‘a’, ‘b’, ‘c’]; var def = [‘d’, ‘e’, ‘f’]; var alpha = [ …abc, …def ]; console.log(alpha)// alpha == [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’]; When using rest arguments, you are collapsing all remaining arguments of a function into one array: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)