@kahirokunn/ts-concat
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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]);
});

Package Sidebar

Install

npm i @kahirokunn/ts-concat

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.76 kB

Total Files

7

Last publish

Collaborators

  • k-okina