我不明白这个语法是怎么回事 javascript

I don't understand what's going on this syntax javascript

如何在下面的代码中在 const { Types, Creators } 中分配我的意思是 Types 将保留什么以及 Creators 将保留什么。

   const { Types, Creators } = createActions({
        userRequest: ['username'],
        userSuccess: ['avatar'],
        userFailure: null
    })



var createActions = (function (config, options) {
  if (R.isNil(config)) {
    throw new Error('an object is required to setup types and creators');
  }
  if (R.isEmpty(config)) {
    throw new Error('empty objects are not supported');
  }

  return {
    Types: convertToTypes(config, options),
    Creators: convertToCreators(config, options)
  };
})

语法是对象解构赋值。 TypesCreators 将定义为从 createActions() 调用返回的对象返回的 TypesCreators 属性。例如

const {Types, Creators} = (() => {
  return {Types:0, Creators:1}
})();

console.log(Types, Creators)

这称为 destructuring assignment,它查看返回的对象并将正确的键分配给变量。将其视为 shorthand 用于:

const createActions = (function (config, options) {
  if (R.isNil(config)) {
    throw new Error('an object is required to setup types and creators');
  }
  if (R.isEmpty(config)) {
    throw new Error('empty objects are not supported');
  }

  return {
    Types: convertToTypes(config, options),
    Creators: convertToCreators(config, options)
  };
})

let results = createActions({
        userRequest: ['username'],
        userSuccess: ['avatar'],
        userFailure: null
    }),
    Types = results.Types,
    Creators = results.Creators;