SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. declare type MyParameterType = {namedParameter: number};
  2. const myArray: MyParameterType[] = [
  3.   {namedParameter: 1},
  4.   {namedParameter: 4},
  5. ];
  6. function foo(): number[] {
  7.   return myArray.map(({namedParameter}: MyParameterType) => {
  8.     const asdf = Math.pow(namedParameter, 2) - 1;
  9.     return asdf * 10;
  10.   }));
  11. }
  12. function bar(): number[] {
  13.   return myArray.map((params: MyParameterType) => {
  14.     const asdf = Math.pow(params.namedParameter, 2) - 1;
  15.     return asdf * 10;
  16.   });
  17. }
  18. console.log(foo());
  19. console.log(bar());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top