title: How to deconstruct an object and exclude a property?
body: <p>I want to deconstruct an object and exclude a property.</p>
  
  <p>This is what I'm doing right now:</p>
  
  <pre><code> let x = {a:1, b:2, c:3};
   let y = {...x};
   delete y.c;
   store.setState(y);
  </code></pre>
  
  <p>I found an article about ES7 which states there is a new feature to exclude properties. So the above would be written like this:</p>
  
  <pre><code> let x = {a:1, b:2, c:3};
   store.setState({c, ...x});
  </code></pre>
  
  <p><a href="https://codeburst.io/use-es2015-object-rest-operator-to-omit-properties-38a3ecffe90" rel="nofollow noreferrer">https://codeburst.io/use-es2015-object-rest-operator-to-omit-properties-38a3ecffe90</a></p>
  
  <p>The above doesn't work in Angular 7 and I get the following error:</p>
  
  <pre><code>error TS2663: Cannot find name 'c'. Did you mean the instance member 'this.c'?
  </code></pre>
  
  <p>I'm currently running TypeScript 3.1.6, and my <em>tsconfig.app.json</em> file looks like this.</p>
  
  <pre><code>{
      "extends": "../tsconfig.json",
      "compilerOptions": {
          "outDir": "../out-tsc/app",
          "module": "es2015",
          "types": []
      },
      "exclude": [
          "src/test.ts",
          "**/*.spec.ts"
      ]
  }
  </code></pre>
  
  <p>Here is the parent file.</p>
  
  <pre><code>{
    "compileOnSave": false,
    "compilerOptions": {
      "baseUrl": "./",
      "importHelpers": true,
      "outDir": "./dist/out-tsc",
      "sourceMap": true,
      "declaration": false,
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "es5",
      "typeRoots": [
        "node_modules/@types"
      ],
      "lib": [
        "es2017",
        "dom"
      ]
    }
  }
  </code></pre>
  
  <p>Now I think the issue is that the line <code>"lib": ["es2017"]</code> is for ES6.</p>
  
  <p>What can I do to enable this ES7 feature and will it break targeting ES5 as the compiled output from TypeScript?</p>