import {expectType} from 'tsd'; import type {Split} from '../index'; declare function split< S extends string, Delimiter extends string, >(string: S, separator: Delimiter): Split; const items = 'foo,bar,baz,waldo'; // General use. expectType<['foo', 'bar', 'baz', 'waldo']>(split(items, ',')); // Missing replacement character in original string. expectType<['foo,bar,baz,waldo']>(split(items, ' ')); // Empty string split (every character). expectType<[ 'f', 'o', 'o', ',', 'b', 'a', 'r', ',', 'b', 'a', 'z', ',', 'w', 'a', 'l', 'd', 'o', ]>(split(items, '')); // Split single same character. expectType<['', '']>(split(' ', ' ')); // Split empty string by empty string. expectType<[]>(split('', '')); // Split empty string by any string. expectType<['']>(split('', ' '));