TypeScript

description: Typed JavaScript

lang: ENG

Rest Parameters & Spread syntax

You can copy an object by doing:

const object = { /* Whatever */ };
const copye = { ...object };

To get a part of your object you can do:

const object : MyObject = 
	  {
		  stuff: string,
		  otherStuff: string,
		  other: /* Whatever */
	  };

function doStuff({
	stuff,
	...rest
}: MyObject) {
	console.log(stuff);
	return { ...rest }; /* Contains otherStuff and other */
}

Resources

TS Config

Resources

-TS Config Cheat Sheet