当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript seamless-immutable.default方法代码示例

本文整理汇总了TypeScript中seamless-immutable.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript seamless-immutable.default方法的具体用法?TypeScript seamless-immutable.default怎么用?TypeScript seamless-immutable.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在seamless-immutable的用法示例。


在下文中一共展示了seamless-immutable.default方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: switch

import { ActionReducer, Action } from '@ngrx/store';
import * as SI from 'seamless-immutable';
import { CoreActions } from '../actions/core.actions';
import { CoreUIState } from '../models/core.ui.state';

let initVal: CoreUIState & Immutable.ObjectMethods<CoreUIState> = SI<CoreUIState>( { menuOpen: false } );

export const core_ui: ActionReducer<CoreUIState & Immutable.ObjectMethods<CoreUIState>> = (curr = initVal, action: Action) => {

  switch (action.type) {
    case CoreActions.MENU_TOGGLED:
      return curr.set( 'menuOpen', !curr.menuOpen );

    default:
      return curr;
  }

};
开发者ID:drew-moore,项目名称:universal-starter,代码行数:18,代码来源:core.ui.reducer.ts

示例2: expect

 expect(() => calculateFixedColumnProps(
   { tableColumn: findColumnByName('e1') },
   { leftColumns: ['a', 'b0', 'b1', 'b2', 'c'], rightColumns: ['d', 'e0', 'e1', 'e2', 'f'] },
   Immutable(extendedTableColumns),
   {},
   extendedColumnChains,
 )).not.toThrow();
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:7,代码来源:helpers.test.ts

示例3: it

    it('should work with immutable properties', () => {
      const state = { sorting: Immutable([{ columnName: 'test', direction: 'asc' }]) };

      expect(() => changeColumnSorting(state, { columnName: 'test2', keepOther: true }))
        .not.toThrow();

      expect(() => changeColumnSorting(state, { columnName: 'test2', keepOther: ['test'] }))
        .not.toThrow();
    });
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:9,代码来源:reducers.test.ts

示例4: it

    it('should collapse Immutable rows', () => {
      /* tslint:disable ter-indent align */
      const rows = Immutable([
        { a: 0 },
        { a: 1 },
          { a: 1, b: 1 },
            { a: 1, b: 1, c: 1 },
        { a: 2 },
          { a: 2, b: 1 },
            { a: 2, b: 1, c: 1 },
      ]);
      /* tslint:enable ter-indent align */
      const linearizedRows = {
        rows,
        treeMeta: new Map([
          [rows[0], { level: 0 }],
          [rows[1], { level: 0 }],
          [rows[2], { level: 1 }],
          [rows[3], { level: 2 }],
          [rows[4], { level: 0 }],
          [rows[5], { level: 1 }],
          [rows[6], { level: 2 }],
        ]),
      };
      const getRowId = row => rows.indexOf(row);

      const expandedLinearizedRows = {
        /* tslint:disable ter-indent align */
        rows: [
          { a: 0 },
          { a: 1 },
            { a: 1, b: 1 },
          { a: 2 },
        ],
        /* tslint:enable ter-indent align */
        treeMeta: linearizedRows.treeMeta,
        collapsedRowsMeta: new Map([
          [rows[2], [rows[3]]],
          [rows[4], [rows[5], rows[6]]],
        ]),
      };

      expect(expandedTreeRows(linearizedRows, getRowId, expandedRowIds))
        .toEqual(expandedLinearizedRows);
    });
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:45,代码来源:computeds.test.ts

示例5: Immutable

interface ExtendedUser extends User {
    address: Address;
}

//
// Constructors
// ---------------------------------------------------------------

{
    interface User {
        firstName: string;
        lastName: string;
    }

    const arrayOfNumbers1: Immutable.ImmutableArray<number> = Immutable.from([0, 2]);
    const arrayOfNumbers2: Immutable.ImmutableArray<number> = Immutable([0, 2]);
    const user1: Immutable.ImmutableObject<User> = Immutable.from({
        firstName: 'Angry',
        lastName: 'Monkey'
    });
    const user2: Immutable.ImmutableObject<User> = Immutable({
        firstName: 'Angry',
        lastName: 'Monkey'
    });
    const error: Error = Immutable.ImmutableError('error');
}

//
// Static utilities
// ---------------------------------------------------------------
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:30,代码来源:seamless-immutable-tests.ts


注:本文中的seamless-immutable.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。