1.0.0 • Published 3 years ago

@kahirokunn/ts-concat v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Install

Install with npm:

$ npm install --save ts-concat

Install with yarn:

$ yarn add ts-concat

Spec

import { concat } from 'ts-concat';

test('basic 1', () => {
  const a = [1, 2, 3, 4] as const
  const b = [5, 6, 7, 8] as const
  const c = concat(a, b);
  const d: [1, 2, 3, 4, 5, 6, 7, 8] = c

  expect(d).toStrictEqual([...a, ...b]);
});

test('basic 2', () => {
  const a = [1, 2, 3, 4] as const
  const b: string[] = ['hello', 'world']
  const c = concat(a, b);
  const d: [1, 2, 3, 4, ...string[]] = c

  expect(d).toStrictEqual([...a, ...b]);
});

test('basic 3', () => {
  const a: string[] = ['hello', 'world']
  const b = [5, 6, 7, 8] as const
  const c = concat(a, b);
  const d: (string | 5 | 6 | 7 | 8)[] = c

  expect(d).toStrictEqual([...a, ...b]);
});