Skip to content

Instantly share code, notes, and snippets.

@hhyyg
Created February 12, 2019 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhyyg/0ba05e46e953d4dbab256edfac75b28e to your computer and use it in GitHub Desktop.
Save hhyyg/0ba05e46e953d4dbab256edfac75b28e to your computer and use it in GitHub Desktop.
destructuring.ts
interface ViewModel {
name: string,
nums: number[],
displayName: string,
}
interface Model {
name: string,
nums: number[]
}
interface Item {
name: string,
}
const viewModel = {
name: 'name1', nums: [
{ name: 'child1' },
{ name: 'child2' },
], displayName: 'display'
};
const {
displayName,
...rest
} = viewModel;
console.log(rest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment