declare module "Iteration/Iteration" { /** An entry of **`IterationMap`** * `[0]`: Prev (<-) * `[1]`: Next (->) * `[2]`: Current **`string`** * `[3]`: Current **`number`** * `[4]`: Current Negative **`string`** * `[5]`: Cumulated Previous **`keys`** (for `Min` & `Max`) * `[6]`: Sign (- / 0 / +) */ export type Iteration = [ string, string, string, number, string, string, '-' | '0' | '+' ]; } declare module "Iteration/Map" { import { Iteration } from "Iteration/Iteration"; /** * Defines a basic map that will be passed to [[CreateMap]] * @hidden */ type RawMap = { [K in string]: Iteration; }; /** * Serves the purpose of completing a [[RawMap]]'s boundaries * @hidden */ type BoundMap = { [K in string]: ['__', '__', string, number, string, string, '-' | '0' | '+']; }; /** * Defines how to define the keys that make a [[RawMap]] * @hidden */ type Keys = { '-': keyof M; '0': keyof M; '+': keyof M; }; /** Describes a map of number relationships */ export type Map = [ Keys, RawMap ]; /** Creates a [[Map]] of number relationships */ export type CreateMap, RM extends RawMap> = [ K, RM & BoundMap ]; } declare module "Iteration/Maps/Number" { import { CreateMap } from "Iteration/Map"; /** * @hidden */ type RawMap = { '-100': ['__', '-99', '-100', -100, '100', '-100', '-']; '-99': ['-100', '-98', '-99', -99, '99', RawMap['-100'][5] | '-99', '-']; '-98': ['-99', '-97', '-98', -98, '98', RawMap['-99'][5] | '-98', '-']; '-97': ['-98', '-96', '-97', -97, '97', RawMap['-98'][5] | '-97', '-']; '-96': ['-97', '-95', '-96', -96, '96', RawMap['-97'][5] | '-96', '-']; '-95': ['-96', '-94', '-95', -95, '95', RawMap['-96'][5] | '-95', '-']; '-94': ['-95', '-93', '-94', -94, '94', RawMap['-95'][5] | '-94', '-']; '-93': ['-94', '-92', '-93', -93, '93', RawMap['-94'][5] | '-93', '-']; '-92': ['-93', '-91', '-92', -92, '92', RawMap['-93'][5] | '-92', '-']; '-91': ['-92', '-90', '-91', -91, '91', RawMap['-92'][5] | '-91', '-']; '-90': ['-91', '-89', '-90', -90, '90', RawMap['-91'][5] | '-90', '-']; '-89': ['-90', '-88', '-89', -89, '89', RawMap['-90'][5] | '-89', '-']; '-88': ['-89', '-87', '-88', -88, '88', RawMap['-89'][5] | '-88', '-']; '-87': ['-88', '-86', '-87', -87, '87', RawMap['-88'][5] | '-87', '-']; '-86': ['-87', '-85', '-86', -86, '86', RawMap['-87'][5] | '-86', '-']; '-85': ['-86', '-84', '-85', -85, '85', RawMap['-86'][5] | '-85', '-']; '-84': ['-85', '-83', '-84', -84, '84', RawMap['-85'][5] | '-84', '-']; '-83': ['-84', '-82', '-83', -83, '83', RawMap['-84'][5] | '-83', '-']; '-82': ['-83', '-81', '-82', -82, '82', RawMap['-83'][5] | '-82', '-']; '-81': ['-82', '-80', '-81', -81, '81', RawMap['-82'][5] | '-81', '-']; '-80': ['-81', '-79', '-80', -80, '80', RawMap['-81'][5] | '-80', '-']; '-79': ['-80', '-78', '-79', -79, '79', RawMap['-80'][5] | '-79', '-']; '-78': ['-79', '-77', '-78', -78, '78', RawMap['-79'][5] | '-78', '-']; '-77': ['-78', '-76', '-77', -77, '77', RawMap['-78'][5] | '-77', '-']; '-76': ['-77', '-75', '-76', -76, '76', RawMap['-77'][5] | '-76', '-']; '-75': ['-76', '-74', '-75', -75, '75', RawMap['-76'][5] | '-75', '-']; '-74': ['-75', '-73', '-74', -74, '74', RawMap['-75'][5] | '-74', '-']; '-73': ['-74', '-72', '-73', -73, '73', RawMap['-74'][5] | '-73', '-']; '-72': ['-73', '-71', '-72', -72, '72', RawMap['-73'][5] | '-72', '-']; '-71': ['-72', '-70', '-71', -71, '71', RawMap['-72'][5] | '-71', '-']; '-70': ['-71', '-69', '-70', -70, '70', RawMap['-71'][5] | '-70', '-']; '-69': ['-70', '-68', '-69', -69, '69', RawMap['-70'][5] | '-69', '-']; '-68': ['-69', '-67', '-68', -68, '68', RawMap['-69'][5] | '-68', '-']; '-67': ['-68', '-66', '-67', -67, '67', RawMap['-68'][5] | '-67', '-']; '-66': ['-67', '-65', '-66', -66, '66', RawMap['-67'][5] | '-66', '-']; '-65': ['-66', '-64', '-65', -65, '65', RawMap['-66'][5] | '-65', '-']; '-64': ['-65', '-63', '-64', -64, '64', RawMap['-65'][5] | '-64', '-']; '-63': ['-64', '-62', '-63', -63, '63', RawMap['-64'][5] | '-63', '-']; '-62': ['-63', '-61', '-62', -62, '62', RawMap['-63'][5] | '-62', '-']; '-61': ['-62', '-60', '-61', -61, '61', RawMap['-62'][5] | '-61', '-']; '-60': ['-61', '-59', '-60', -60, '60', RawMap['-61'][5] | '-60', '-']; '-59': ['-60', '-58', '-59', -59, '59', RawMap['-60'][5] | '-59', '-']; '-58': ['-59', '-57', '-58', -58, '58', RawMap['-59'][5] | '-58', '-']; '-57': ['-58', '-56', '-57', -57, '57', RawMap['-58'][5] | '-57', '-']; '-56': ['-57', '-55', '-56', -56, '56', RawMap['-57'][5] | '-56', '-']; '-55': ['-56', '-54', '-55', -55, '55', RawMap['-56'][5] | '-55', '-']; '-54': ['-55', '-53', '-54', -54, '54', RawMap['-55'][5] | '-54', '-']; '-53': ['-54', '-52', '-53', -53, '53', RawMap['-54'][5] | '-53', '-']; '-52': ['-53', '-51', '-52', -52, '52', RawMap['-53'][5] | '-52', '-']; '-51': ['-52', '-50', '-51', -51, '51', RawMap['-52'][5] | '-51', '-']; '-50': ['-51', '-49', '-50', -50, '50', RawMap['-51'][5] | '-50', '-']; '-49': ['-50', '-48', '-49', -49, '49', RawMap['-50'][5] | '-49', '-']; '-48': ['-49', '-47', '-48', -48, '48', RawMap['-49'][5] | '-48', '-']; '-47': ['-48', '-46', '-47', -47, '47', RawMap['-48'][5] | '-47', '-']; '-46': ['-47', '-45', '-46', -46, '46', RawMap['-47'][5] | '-46', '-']; '-45': ['-46', '-44', '-45', -45, '45', RawMap['-46'][5] | '-45', '-']; '-44': ['-45', '-43', '-44', -44, '44', RawMap['-45'][5] | '-44', '-']; '-43': ['-44', '-42', '-43', -43, '43', RawMap['-44'][5] | '-43', '-']; '-42': ['-43', '-41', '-42', -42, '42', RawMap['-43'][5] | '-42', '-']; '-41': ['-42', '-40', '-41', -41, '41', RawMap['-42'][5] | '-41', '-']; '-40': ['-41', '-39', '-40', -40, '40', RawMap['-41'][5] | '-40', '-']; '-39': ['-40', '-38', '-39', -39, '39', RawMap['-40'][5] | '-39', '-']; '-38': ['-39', '-37', '-38', -38, '38', RawMap['-39'][5] | '-38', '-']; '-37': ['-38', '-36', '-37', -37, '37', RawMap['-38'][5] | '-37', '-']; '-36': ['-37', '-35', '-36', -36, '36', RawMap['-37'][5] | '-36', '-']; '-35': ['-36', '-34', '-35', -35, '35', RawMap['-36'][5] | '-35', '-']; '-34': ['-35', '-33', '-34', -34, '34', RawMap['-35'][5] | '-34', '-']; '-33': ['-34', '-32', '-33', -33, '33', RawMap['-34'][5] | '-33', '-']; '-32': ['-33', '-31', '-32', -32, '32', RawMap['-33'][5] | '-32', '-']; '-31': ['-32', '-30', '-31', -31, '31', RawMap['-32'][5] | '-31', '-']; '-30': ['-31', '-29', '-30', -30, '30', RawMap['-31'][5] | '-30', '-']; '-29': ['-30', '-28', '-29', -29, '29', RawMap['-30'][5] | '-29', '-']; '-28': ['-29', '-27', '-28', -28, '28', RawMap['-29'][5] | '-28', '-']; '-27': ['-28', '-26', '-27', -27, '27', RawMap['-28'][5] | '-27', '-']; '-26': ['-27', '-25', '-26', -26, '26', RawMap['-27'][5] | '-26', '-']; '-25': ['-26', '-24', '-25', -25, '25', RawMap['-26'][5] | '-25', '-']; '-24': ['-25', '-23', '-24', -24, '24', RawMap['-25'][5] | '-24', '-']; '-23': ['-24', '-22', '-23', -23, '23', RawMap['-24'][5] | '-23', '-']; '-22': ['-23', '-21', '-22', -22, '22', RawMap['-23'][5] | '-22', '-']; '-21': ['-22', '-20', '-21', -21, '21', RawMap['-22'][5] | '-21', '-']; '-20': ['-21', '-19', '-20', -20, '20', RawMap['-21'][5] | '-20', '-']; '-19': ['-20', '-18', '-19', -19, '19', RawMap['-20'][5] | '-19', '-']; '-18': ['-19', '-17', '-18', -18, '18', RawMap['-19'][5] | '-18', '-']; '-17': ['-18', '-16', '-17', -17, '17', RawMap['-18'][5] | '-17', '-']; '-16': ['-17', '-15', '-16', -16, '16', RawMap['-17'][5] | '-16', '-']; '-15': ['-16', '-14', '-15', -15, '15', RawMap['-16'][5] | '-15', '-']; '-14': ['-15', '-13', '-14', -14, '14', RawMap['-15'][5] | '-14', '-']; '-13': ['-14', '-12', '-13', -13, '13', RawMap['-14'][5] | '-13', '-']; '-12': ['-13', '-11', '-12', -12, '12', RawMap['-13'][5] | '-12', '-']; '-11': ['-12', '-10', '-11', -11, '11', RawMap['-12'][5] | '-11', '-']; '-10': ['-11', '-9', '-10', -10, '10', RawMap['-11'][5] | '-10', '-']; '-9': ['-10', '-8', '-9', -9, '9', RawMap['-10'][5] | '-9', '-']; '-8': ['-9', '-7', '-8', -8, '8', RawMap['-9'][5] | '-8', '-']; '-7': ['-8', '-6', '-7', -7, '7', RawMap['-8'][5] | '-7', '-']; '-6': ['-7', '-5', '-6', -6, '6', RawMap['-7'][5] | '-6', '-']; '-5': ['-6', '-4', '-5', -5, '5', RawMap['-6'][5] | '-5', '-']; '-4': ['-5', '-3', '-4', -4, '4', RawMap['-5'][5] | '-4', '-']; '-3': ['-4', '-2', '-3', -3, '3', RawMap['-4'][5] | '-3', '-']; '-2': ['-3', '-1', '-2', -2, '2', RawMap['-3'][5] | '-2', '-']; '-1': ['-2', '0', '-1', -1, '1', RawMap['-2'][5] | '-1', '-']; '0': ['-1', '1', '0', 0, '0', RawMap['-1'][5] | '0', '0']; '1': ['0', '2', '1', 1, '-1', RawMap['0'][5] | '1', '+']; '2': ['1', '3', '2', 2, '-2', RawMap['1'][5] | '2', '+']; '3': ['2', '4', '3', 3, '-3', RawMap['2'][5] | '3', '+']; '4': ['3', '5', '4', 4, '-4', RawMap['3'][5] | '4', '+']; '5': ['4', '6', '5', 5, '-5', RawMap['4'][5] | '5', '+']; '6': ['5', '7', '6', 6, '-6', RawMap['5'][5] | '6', '+']; '7': ['6', '8', '7', 7, '-7', RawMap['6'][5] | '7', '+']; '8': ['7', '9', '8', 8, '-8', RawMap['7'][5] | '8', '+']; '9': ['8', '10', '9', 9, '-9', RawMap['8'][5] | '9', '+']; '10': ['9', '11', '10', 10, '-10', RawMap['9'][5] | '10', '+']; '11': ['10', '12', '11', 11, '-11', RawMap['10'][5] | '11', '+']; '12': ['11', '13', '12', 12, '-12', RawMap['11'][5] | '12', '+']; '13': ['12', '14', '13', 13, '-13', RawMap['12'][5] | '13', '+']; '14': ['13', '15', '14', 14, '-14', RawMap['13'][5] | '14', '+']; '15': ['14', '16', '15', 15, '-15', RawMap['14'][5] | '15', '+']; '16': ['15', '17', '16', 16, '-16', RawMap['15'][5] | '16', '+']; '17': ['16', '18', '17', 17, '-17', RawMap['16'][5] | '17', '+']; '18': ['17', '19', '18', 18, '-18', RawMap['17'][5] | '18', '+']; '19': ['18', '20', '19', 19, '-19', RawMap['18'][5] | '19', '+']; '20': ['19', '21', '20', 20, '-20', RawMap['19'][5] | '20', '+']; '21': ['20', '22', '21', 21, '-21', RawMap['20'][5] | '21', '+']; '22': ['21', '23', '22', 22, '-22', RawMap['21'][5] | '22', '+']; '23': ['22', '24', '23', 23, '-23', RawMap['22'][5] | '23', '+']; '24': ['23', '25', '24', 24, '-24', RawMap['23'][5] | '24', '+']; '25': ['24', '26', '25', 25, '-25', RawMap['24'][5] | '25', '+']; '26': ['25', '27', '26', 26, '-26', RawMap['25'][5] | '26', '+']; '27': ['26', '28', '27', 27, '-27', RawMap['26'][5] | '27', '+']; '28': ['27', '29', '28', 28, '-28', RawMap['27'][5] | '28', '+']; '29': ['28', '30', '29', 29, '-29', RawMap['28'][5] | '29', '+']; '30': ['29', '31', '30', 30, '-30', RawMap['29'][5] | '30', '+']; '31': ['30', '32', '31', 31, '-31', RawMap['30'][5] | '31', '+']; '32': ['31', '33', '32', 32, '-32', RawMap['31'][5] | '32', '+']; '33': ['32', '34', '33', 33, '-33', RawMap['32'][5] | '33', '+']; '34': ['33', '35', '34', 34, '-34', RawMap['33'][5] | '34', '+']; '35': ['34', '36', '35', 35, '-35', RawMap['34'][5] | '35', '+']; '36': ['35', '37', '36', 36, '-36', RawMap['35'][5] | '36', '+']; '37': ['36', '38', '37', 37, '-37', RawMap['36'][5] | '37', '+']; '38': ['37', '39', '38', 38, '-38', RawMap['37'][5] | '38', '+']; '39': ['38', '40', '39', 39, '-39', RawMap['38'][5] | '39', '+']; '40': ['39', '41', '40', 40, '-40', RawMap['39'][5] | '40', '+']; '41': ['40', '42', '41', 41, '-41', RawMap['40'][5] | '41', '+']; '42': ['41', '43', '42', 42, '-42', RawMap['41'][5] | '42', '+']; '43': ['42', '44', '43', 43, '-43', RawMap['42'][5] | '43', '+']; '44': ['43', '45', '44', 44, '-44', RawMap['43'][5] | '44', '+']; '45': ['44', '46', '45', 45, '-45', RawMap['44'][5] | '45', '+']; '46': ['45', '47', '46', 46, '-46', RawMap['45'][5] | '46', '+']; '47': ['46', '48', '47', 47, '-47', RawMap['46'][5] | '47', '+']; '48': ['47', '49', '48', 48, '-48', RawMap['47'][5] | '48', '+']; '49': ['48', '50', '49', 49, '-49', RawMap['48'][5] | '49', '+']; '50': ['49', '51', '50', 50, '-50', RawMap['49'][5] | '50', '+']; '51': ['50', '52', '51', 51, '-51', RawMap['50'][5] | '51', '+']; '52': ['51', '53', '52', 52, '-52', RawMap['51'][5] | '52', '+']; '53': ['52', '54', '53', 53, '-53', RawMap['52'][5] | '53', '+']; '54': ['53', '55', '54', 54, '-54', RawMap['53'][5] | '54', '+']; '55': ['54', '56', '55', 55, '-55', RawMap['54'][5] | '55', '+']; '56': ['55', '57', '56', 56, '-56', RawMap['55'][5] | '56', '+']; '57': ['56', '58', '57', 57, '-57', RawMap['56'][5] | '57', '+']; '58': ['57', '59', '58', 58, '-58', RawMap['57'][5] | '58', '+']; '59': ['58', '60', '59', 59, '-59', RawMap['58'][5] | '59', '+']; '60': ['59', '61', '60', 60, '-60', RawMap['59'][5] | '60', '+']; '61': ['60', '62', '61', 61, '-61', RawMap['60'][5] | '61', '+']; '62': ['61', '63', '62', 62, '-62', RawMap['61'][5] | '62', '+']; '63': ['62', '64', '63', 63, '-63', RawMap['62'][5] | '63', '+']; '64': ['63', '65', '64', 64, '-64', RawMap['63'][5] | '64', '+']; '65': ['64', '66', '65', 65, '-65', RawMap['64'][5] | '65', '+']; '66': ['65', '67', '66', 66, '-66', RawMap['65'][5] | '66', '+']; '67': ['66', '68', '67', 67, '-67', RawMap['66'][5] | '67', '+']; '68': ['67', '69', '68', 68, '-68', RawMap['67'][5] | '68', '+']; '69': ['68', '70', '69', 69, '-69', RawMap['68'][5] | '69', '+']; '70': ['69', '71', '70', 70, '-70', RawMap['69'][5] | '70', '+']; '71': ['70', '72', '71', 71, '-71', RawMap['70'][5] | '71', '+']; '72': ['71', '73', '72', 72, '-72', RawMap['71'][5] | '72', '+']; '73': ['72', '74', '73', 73, '-73', RawMap['72'][5] | '73', '+']; '74': ['73', '75', '74', 74, '-74', RawMap['73'][5] | '74', '+']; '75': ['74', '76', '75', 75, '-75', RawMap['74'][5] | '75', '+']; '76': ['75', '77', '76', 76, '-76', RawMap['75'][5] | '76', '+']; '77': ['76', '78', '77', 77, '-77', RawMap['76'][5] | '77', '+']; '78': ['77', '79', '78', 78, '-78', RawMap['77'][5] | '78', '+']; '79': ['78', '80', '79', 79, '-79', RawMap['78'][5] | '79', '+']; '80': ['79', '81', '80', 80, '-80', RawMap['79'][5] | '80', '+']; '81': ['80', '82', '81', 81, '-81', RawMap['80'][5] | '81', '+']; '82': ['81', '83', '82', 82, '-82', RawMap['81'][5] | '82', '+']; '83': ['82', '84', '83', 83, '-83', RawMap['82'][5] | '83', '+']; '84': ['83', '85', '84', 84, '-84', RawMap['83'][5] | '84', '+']; '85': ['84', '86', '85', 85, '-85', RawMap['84'][5] | '85', '+']; '86': ['85', '87', '86', 86, '-86', RawMap['85'][5] | '86', '+']; '87': ['86', '88', '87', 87, '-87', RawMap['86'][5] | '87', '+']; '88': ['87', '89', '88', 88, '-88', RawMap['87'][5] | '88', '+']; '89': ['88', '90', '89', 89, '-89', RawMap['88'][5] | '89', '+']; '90': ['89', '91', '90', 90, '-90', RawMap['89'][5] | '90', '+']; '91': ['90', '92', '91', 91, '-91', RawMap['90'][5] | '91', '+']; '92': ['91', '93', '92', 92, '-92', RawMap['91'][5] | '92', '+']; '93': ['92', '94', '93', 93, '-93', RawMap['92'][5] | '93', '+']; '94': ['93', '95', '94', 94, '-94', RawMap['93'][5] | '94', '+']; '95': ['94', '96', '95', 95, '-95', RawMap['94'][5] | '95', '+']; '96': ['95', '97', '96', 96, '-96', RawMap['95'][5] | '96', '+']; '97': ['96', '98', '97', 97, '-97', RawMap['96'][5] | '97', '+']; '98': ['97', '99', '98', 98, '-98', RawMap['97'][5] | '98', '+']; '99': ['98', '100', '99', 99, '-99', RawMap['98'][5] | '99', '+']; '100': ['99', '__', '100', 100, '-100', RawMap['99'][5] | '100', '+']; }; /** * @hidden */ type MapKeys = { '-': '-100' | '-99' | '-98' | '-97' | '-96' | '-95' | '-94' | '-93' | '-92' | '-91' | '-90' | '-89' | '-88' | '-87' | '-86' | '-85' | '-84' | '-83' | '-82' | '-81' | '-80' | '-79' | '-78' | '-77' | '-76' | '-75' | '-74' | '-73' | '-72' | '-71' | '-70' | '-69' | '-68' | '-67' | '-66' | '-65' | '-64' | '-63' | '-62' | '-61' | '-60' | '-59' | '-58' | '-57' | '-56' | '-55' | '-54' | '-53' | '-52' | '-51' | '-50' | '-49' | '-48' | '-47' | '-46' | '-45' | '-44' | '-43' | '-42' | '-41' | '-40' | '-39' | '-38' | '-37' | '-36' | '-35' | '-34' | '-33' | '-32' | '-31' | '-30' | '-29' | '-28' | '-27' | '-26' | '-25' | '-24' | '-23' | '-22' | '-21' | '-20' | '-19' | '-18' | '-17' | '-16' | '-15' | '-14' | '-13' | '-12' | '-11' | '-10' | '-9' | '-8' | '-7' | '-6' | '-5' | '-4' | '-3' | '-2' | '-1'; '0': '0'; '+': '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32' | '33' | '34' | '35' | '36' | '37' | '38' | '39' | '40' | '41' | '42' | '43' | '44' | '45' | '46' | '47' | '48' | '49' | '50' | '51' | '52' | '53' | '54' | '55' | '56' | '57' | '58' | '59' | '60' | '61' | '62' | '63' | '64' | '65' | '66' | '67' | '68' | '69' | '70' | '71' | '72' | '73' | '74' | '75' | '76' | '77' | '78' | '79' | '80' | '81' | '82' | '83' | '84' | '85' | '86' | '87' | '88' | '89' | '90' | '91' | '92' | '93' | '94' | '95' | '96' | '97' | '98' | '99' | '100'; }; /** Describes a map of number relationships */ export type NumberMap = CreateMap; } declare module "Iteration/Next" { import { Map } from "Iteration/Map"; import { Iteration } from "Iteration/Iteration"; import { NumberMap } from "Iteration/Maps/Number"; /** Move **`I`**'s position forward @param I to move @param IMap to operate with another set of numbers @returns [[Iteration]] @example ```ts import {I} from 'ts-toolbelt' type i = I.IterationOf<'20'> type test0 = I.Pos // 20 type test1 = I.Pos> // 21 ``` */ export type Next = IMap[1][I[1]]; } declare module "List/List" { /** A [[List]] @param A its type @returns [[List]] @example ```ts type list0 = [1, 2, 3] type list1 = number[] ``` */ export type List = ReadonlyArray; } declare module "List/Prepend" { import { List } from "List/List"; /** Add an element **`A`** at the beginning of **`L`** @param L to append to @param A to be added to @returns [[List]] @example ```ts ``` */ export type Prepend = ((head: A, ...args: L) => any) extends ((...args: infer U) => any) ? U : L; } declare module "Number/Number" { /** A [[Number]] @example ```ts type number0 = '-42` type number1 = '420' ``` */ export type Number = string; } declare module "Iteration/IterationOf" { import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** Transform a number into an [[Iteration]] (to use [[Prev]], [[Next]], & [[Pos]]) @param N to transform @param IMap to operate with another set of numbers @returns [[Iteration]] @example ```ts import {I} from 'ts-toolbelt' type i = I.IterationOf<'0'> // ["-1", "1", "0", 0, "0"] type next = I.Next // ["0", "2", "1", 1, "+"] type prev = I.Prev // ["-2", "0", "-1", -1, "-"] type nnext = I.Pos // +1 type nprev = I.Pos // -1 ``` */ export type IterationOf = N extends keyof IMap[1] ? IMap[1][N] : IMap[1]['__']; } declare module "Any/Cast" { /** * Ask TS to re-check that **`A1`** extends **`A2`**. * And if it fails, **`A2`** will be enforced anyway. * Can also be used to add constraints on parameters. * @param A1 to check against * @param A2 to cast **`A1`** to * @returns **`A1`** or **`A2`** * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Cast<'42', string> // '42' * type test1 = A.Cast<'42', number> // number * ``` */ export type Cast = A1 extends A2 ? A1 : A2; } declare module "Iteration/_Internal" { /** Describes compatible type formats * `s`: **`string`** * `n`: **`number`** */ export type Formats = 'n' | 's'; /** Describes how to perform iterations */ export type Way = '->' | '<-'; } declare module "Iteration/Format" { import { Iteration } from "Iteration/Iteration"; import { Formats } from "Iteration/_Internal"; /** Is [[Key]] and [[Pos]] in a single type @param I to query @param fmt output format @returns **`string | number`** @example ```ts import {I} from 'ts-toolbelt' /// Let's make '20' an iteration type i = I.IterationOf<'20'> // [...] type fmtS = I.Fmt // '20' type fmtN = I.Fmt // 20 ``` */ export type Format = { 's': I[2]; 'n': I[3]; }[fmt]; } declare module "Iteration/Key" { import { Iteration } from "Iteration/Iteration"; import { Format } from "Iteration/Format"; /** Get the position of **`I`** (**string**) @param I to query @returns [[String]] @example ```ts import {I} from 'ts-toolbelt' type i = I.IterationOf<'20'> type test0 = I.Key // '20' type test1 = I.Key> // '21' ``` */ export type Key = Format; } declare module "Any/Extends" { /** * Check whether **`A1`** is part of **`A2`** or not. The difference with * `extends` is that it forces a [[Boolean]] return. * @param A1 * @param A2 * @returns [[Boolean]] * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Extends<'a' | 'b', 'b'> // Boolean * type test1 = A.Extends<'a', 'a' | 'b'> // True * * type test2 = A.Extends<{a: string}, {a: any}> // True * type test3 = A.Extends<{a: any}, {a: any, b: any}> // False * * type test4 = A.Extends // False * /// Nothing cannot extend nothing, use `A.Equals` * ``` */ export type Extends = [ A1 ] extends [never] ? 0 : A1 extends A2 ? 1 : 0; } declare module "List/Repeat" { import { Next } from "Iteration/Next"; import { Prepend } from "List/Prepend"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { Cast } from "Any/Cast"; import { Key } from "Iteration/Key"; import { List } from "List/List"; import { Extends } from "Any/Extends"; /** @hidden */ type __Repeat> = { 0: __Repeat, Next>; 1: L; }[Extends, N>]; /** @hidden */ export type _Repeat = __Repeat extends infer X ? Cast : never; /** Fill a [[List]] with **`N`** times **`A`** @param A to fill with @param N to repeat it @param L (?=`[]`) to be filled @returns [[List]] @example ```ts ``` */ export type Repeat = N extends unknown ? L extends unknown ? _Repeat : never : never; } declare module "Any/Equals" { /** * Check whether **`A1`** is equal to **`A2`** or not. * @param A1 * @param A2 * @returns [[Boolean]] * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Equals<42 | 0, 42 | 0> // true * type test1 = A.Equals<{a: string}, {b: string}> // false * type test3 = A.Equals<{a: string}, {readonly a: string}> // false * ``` */ export type Equals = (() => A extends A2 ? 1 : 0) extends (() => A extends A1 ? 1 : 0) ? 1 : 0; } declare module "Object/_Internal" { /** Describes the permissions/modifiers fields can have * `R`: readonly * `W`: writable * `!`: required * `?`: optional */ export type Modx = ['?' | '!', 'W' | 'R']; /** Describes the depth strategy when modifying types */ export type Depth = 'flat' | 'deep'; /** * Describes the merging strategy * `0`: lodash style. Preserves lists, and completes when undefined types * `1`: ramda style. Destroys lists, does not complete if undefined types * `2`: lodash style. Lists are narrowed down, tuples are not preserved * `3`: ramda style. Assumes that we are only working with lists */ export type MergeStyle = 0 | 1 | 2; /** Make an object properties (all) `never`. We use this to intersect `object`s and preserve the combine modifiers like `+readonly` and `?optional`. */ export type Anyfy = { [K in keyof O]: any; } & {}; } declare module "Misc/BuiltInObject" { /** * @hidden */ type Errors = Error; /** * @hidden */ type Numeric = Date; /** * @hidden */ type Textual = RegExp; /** * @hidden */ type Arrays = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; /** * @hidden */ type Maps = ReadonlyMap | ReadonlySet | WeakMap | WeakSet; /** * @hidden */ type Structures = ArrayBuffer | DataView; /** * @hidden */ type Abstractions = Function | Promise | Generator; /** * @hidden */ type WebAssembly = never; /** * Built-in standard library objects */ export type BuiltInObject = Errors | Numeric | Textual | Arrays | Maps | Structures | Abstractions | WebAssembly; } declare module "Any/Compute" { import { Depth } from "Object/_Internal"; import { BuiltInObject } from "Misc/BuiltInObject"; /** * @hidden */ export type ComputeRaw = A extends Function ? A : { [K in keyof A]: A[K]; } & {}; /** * @hidden */ export type ComputeFlat = A extends BuiltInObject ? A : { [K in keyof A]: A[K]; } & {}; /** * @hidden */ export type ComputeDeep = A extends BuiltInObject ? A : { [K in keyof A]: A[K] extends Seen ? A[K] : ComputeDeep; } & {}; /** * Force TS to load a type that has not been computed (to resolve composed * types that TS haven't fully resolved, for display purposes mostly). * @param A to compute * @returns **`A`** * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Compute<{x: 'x'} & {y: 'y'}> // {x: 'x', y: 'y'} * ``` */ export type Compute = { 'flat': ComputeFlat; 'deep': ComputeDeep; }[depth]; } declare module "Boolean/Boolean" { /** A [[Boolean]] */ export type Boolean = True | False; /** 1 */ export type True = 1; /** 0 */ export type False = 0; } declare module "Test" { import { Repeat } from "List/Repeat"; import { Equals } from "Any/Equals"; import { ComputeRaw } from "Any/Compute"; import { True, False, Boolean } from "Boolean/Boolean"; /** Test should pass */ export type Pass = True; /** Test should fail */ export type Fail = False; /** Check or test the validity of a type @param debug to debug with parameter hints (`ctrl+p`, `ctrl+shift+space`) @example ```ts // see in `tst` folder ``` */ export function check(debug?: ComputeRaw): Equals, Outcome>; /** Validates a batch of [[check]] @param checks a batch of [[check]] @example ```ts // see in `tst` folder ``` */ export function checks(checks: Partial>): void; } declare module "Any/Key" { /** * Describes index keys for any type */ export type Key = string | number | symbol; } declare module "Object/Pick" { import { Key } from "Any/Key"; /** @hidden */ type __Pick = { [P in K]: O[P]; } & {}; /** @hidden */ export type _Pick = __Pick; /** Extract out of **`O`** the fields of key **`K`** @param O to extract from @param K to chose fields @returns [[Object]] @example ```ts ``` */ export type Pick = O extends unknown ? _Pick : never; } declare module "Union/Union" { /** A [[Union]] @example ```ts type union0 = 1 | 2 | 3 type union1 = 'a' | 420 ``` */ export type Union = any; } declare module "Union/Exclude" { import { Union } from "Union/Union"; /** Remove **`M`** out of **`U`** @param U to remove from @param M to remove out @returns [[Union]] @example ```ts ``` */ export type Exclude = U extends M ? never : U; } declare module "Object/Omit" { import { _Pick } from "Object/Pick"; import { Exclude } from "Union/Exclude"; import { Key } from "Any/Key"; /** * @hidden */ export type _Omit = _Pick>; /** Remove out of **`O`** the fields of key **`K`** @param O to remove from @param K to chose fields @returns [[Object]] @example ```ts ``` */ export type Omit = O extends unknown ? _Omit : never; } declare module "Object/At" { import { Key } from "Any/Key"; import { Boolean } from "Boolean/Boolean"; /** @hidden */ export type AtBasic = K extends keyof O ? O[K] : never; /** @hidden */ export type AtStrict = O[K & keyof O]; /** @hidden */ export type AtLoose = O extends unknown ? AtStrict : never; /** Get in **`O`** the type of a field of key **`K`** @param O to extract from @param K to extract at @param strict (?=`1`) `0` to work with unions @returns **`any`** @example ```ts import {O} from 'ts-toolbelt' type User = { info: { name: string age: number payment: {} } id: number } type test0 = O.At // number ``` */ export type At = { 1: AtStrict; 0: AtLoose; }[strict]; } declare module "Number/_Internal" { import { Format } from "Iteration/Format"; import { Map } from "Iteration/Map"; import { NumberMap } from "Iteration/Maps/Number"; /** Describes compatible type formats * `b`: **`boolean`** * `n`: **`number`** * `s`: **`string`** */ export type Formats = 'b' | 'n' | 's'; /** * @hidden */ export type KnownIterationMapKeys = IMap[0]['-' | '0' | '+']; /** * @hidden */ export type NegativeIterationKeys = IMap[0]['-']; /** * @hidden */ export type PositiveIterationKeys = IMap[0]['+']; /** * @hidden */ export type NeutralIterationKeys = IMap[0]['0']; /** Describes known values of a **number** @hidden */ export type Numbers = { 'string': { 'all': Format], 's'>; '+': Format], 's'>; '-': Format], 's'>; '0': Format], 's'>; }; 'number': { 'all': Format], 'n'>; '+': Format], 'n'>; '-': Format], 'n'>; '0': Format], 'n'>; }; }; } declare module "Iteration/Pos" { import { Iteration } from "Iteration/Iteration"; import { Format } from "Iteration/Format"; /** Get the position of **`I`** (**number**) @param I to query @param IMap to operate with another set of numbers @returns **`number`** @example ```ts import {I} from 'ts-toolbelt' type i = I.IterationOf<'20'> type test0 = I.Pos // 20 type test1 = I.Pos> // 21 ``` */ export type Pos = Format; } declare module "Number/NumberOf" { import { Key } from "Iteration/Key"; import { Pos } from "Iteration/Pos"; import { Numbers, KnownIterationMapKeys } from "Number/_Internal"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _NumberOf = { [K in keyof IMap[1]]: Pos extends N ? Key : never; }[KnownIterationMapKeys]; /** Transform a **`number`** into a [[Number]] @param N to stringify @param IMap to operate with another set of numbers @returns [[String]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.StringOf<5> // '5' type test1 = N.StringOf<-5> // '-5' ``` */ export type NumberOf = N extends Numbers['number']['all'] ? _NumberOf : string; } declare module "List/Length" { import { NumberOf } from "Number/NumberOf"; import { Formats } from "Iteration/_Internal"; import { List } from "List/List"; /** Get the length of **`L`** @param L to get length @param fmt (?=`'n'`) output format @returns [[String]] or **`number`** @example ```ts ``` */ export type Length = { 's': NumberOf; 'n': L['length']; }[fmt]; } declare module "Object/Overwrite" { /** Update the fields of **`O`** with the ones of **`O1`** (only the existing fields will be updated) @param O to update @param O1 to update with @returns [[Object]] @example ```ts ``` */ export type Overwrite = { [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]; } & {}; } declare module "List/_Internal" { /** @ignore */ /** */ import { Overwrite } from "Object/Overwrite"; import { List } from "List/List"; /** Remove `?` & `readonly` from a [[List]] */ export type Naked = Overwrite, L>; } declare module "List/Reverse" { import { Prepend } from "List/Prepend"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Length } from "List/Length"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Cast } from "Any/Cast"; import { List } from "List/List"; import { Naked } from "List/_Internal"; import { Extends } from "Any/Extends"; /** @hidden */ type __Reverse> = { 0: __Reverse]>, Next>; 1: LO; }[Extends, Length>]; /** @hidden */ export type _Reverse = __Reverse, LO> extends infer X ? Cast : never; /** Turn a [[List]] the other way around @param L to reverse @param LO (?=`[]`) to prepend to @returns [[List]] @example ```ts ``` */ export type Reverse = L extends unknown ? LO extends unknown ? _Reverse : never : never; } declare module "List/Concat" { import { _Reverse } from "List/Reverse"; import { List } from "List/List"; /** @hidden */ export type _Concat = _Reverse<_Reverse, L1>; /** Attach **`L1`** at the end of **`L`** @param L to concat with @param L1 to be attached @returns [[List]] @example ```ts ``` */ export type Concat = L extends unknown ? L1 extends unknown ? _Concat : never : never; } declare module "List/Append" { import { _Concat } from "List/Concat"; import { List } from "List/List"; /** @hidden */ export type _Append = _Concat; /** Add an element **`A`** at the end of **`L`** @param L to append to @param A to be added to @returns [[List]] @example ```ts ``` */ export type Append = L extends unknown ? A extends unknown ? _Append : never : never; } declare module "Object/ListOf" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Key } from "Iteration/Key"; import { Next } from "Iteration/Next"; import { _Append } from "List/Append"; import { Exclude } from "Union/Exclude"; import { List } from "List/List"; import { Extends } from "Any/Extends"; import { At } from "Object/At"; /** @hidden */ type PickIfEntry = Key extends keyof O ? _Append & keyof O]> : LN; /** @hidden */ type ___ListOf> = { 0: ___ListOf>, PickIfEntry, Next>; 1: LN; }[Extends<[K], [never]>]; /** @hidden */ type __ListOf = number extends keyof O ? At[] : string extends keyof O ? At[] : symbol extends keyof O ? At[] : ___ListOf; /** @hidden */ export type _ListOf = __ListOf; /** Transform an [[Object]] into a [[List]] (It will only pick numeric literal indexes) @param O to transform @returns [[List]] @example ```ts ``` */ export type ListOf = O extends unknown ? _ListOf : never; } declare module "Boolean/Not" { import { Boolean } from "Boolean/Boolean"; /** Logical **`!`** operator (behaves like the JS one) @param B to negate @returns [[Boolean]] @example ```ts import {B} from 'ts-toolbelt' type test0 = B.Not // False type test1 = B.Not // True ``` */ export type Not = { 0: 1; 1: 0; }[B]; } declare module "Union/Has" { import { Union } from "Union/Union"; import { Not } from "Boolean/Not"; import { Extends } from "Any/Extends"; /** Check whether **`U`** contains **`U1`** @param U to be inspected @param U1 to check within @returns [[Boolean]] @example ```ts ``` */ export type Has = Not, U1>>; } declare module "Any/Clean" { import { _Omit } from "Object/Omit"; import { _Pick } from "Object/Pick"; import { At } from "Object/At"; import { Exclude } from "Union/Exclude"; import { Numbers } from "Number/_Internal"; import { _ListOf } from "Object/ListOf"; import { Has } from "Union/Has"; /** * @hidden */ type ArrayEntry = Numbers['string']['0' | '+']; /** * @hidden */ type ArrayProps = keyof any[] | ArrayEntry; /** * Sometimes, we can end up with mixed up **`objects`** that do not make sense * visually (or that could at least be simplified for the end user). This will * turn anything that is passed to it into a cleaned up [[Object]]. * * @param O * @returns [[Object]] * @example * ```ts * ``` */ export type Clean = A extends object ? Has extends 1 ? [Exclude] extends [never] ? number extends At ? At[] : A : number extends At ? _Omit & At[] : At extends number ? _Omit & _ListOf<_Pick> : A : A : A; } declare module "Any/Contains" { import { Extends } from "Any/Extends"; /** * Check whether **`A1`** is part of **`A2`** or not. It works like * [[Extends]] but [[Boolean]] results are narrowed to [[False]]. * @param A1 * @param A2 * @returns [[Boolean]] * @example * ```ts * type test0 = A.Contains<'a' | 'b', 'b'> // False * type test1 = A.Contains<'a', 'a' | 'b'> // True * * type test2 = A.Contains<{a: string}, {a: string, b: number}> // False * type test3 = A.Contains<{a: string, b: number}, {a: string}> // True * * type test4 = A.Contains // False * /// Nothing cannot contain nothing, use `A.Equals` * ``` */ export type Contains = Extends extends 1 ? 1 : 0; } declare module "Any/_Internal" { import { _NumberOf } from "Number/NumberOf"; import { NumberMap } from "Iteration/Maps/Number"; /** * Describes the match strategy when matching types * * `default` : `extends->` * * `contains->` : X contains Y ([[Contains]]) * * `extends->` : X extends Y ([[Extends]]) * * `implements->`: X implements Y ([[Implements]]) * * `<-contains` : Y contains X ([[Contains]]) * * `<-extends` : Y extends X ([[Extends]]) * * `<-implements`: Y implements X ([[Implements]]) * * `equals` : X equals Y (([[Equals]])) */ export type Match = 'default' | 'contains->' | 'extends->' | 'implements->' | '<-contains' | '<-extends' | '<-implements' | 'equals'; /** * @hidden */ export type NumberOf = N extends number ? _NumberOf : N; /** * @hidden */ export type _Promise = Promise; } declare module "Any/Is" { import { Match } from "Any/_Internal"; import { Extends } from "Any/Extends"; import { Equals } from "Any/Equals"; import { Contains } from "Any/Contains"; /** * Check whether **`A`** is similar to **`A1`** or not. In other words, it is a * compact type that bundles [[Equals]], [[Extends]], [[Contains]], and * [[Implements]] comparison types. * @param A to be compared * @param A1 to compare to * @param match (?=`'default'`) to change precision * @returns [[Boolean]] * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Is<'a', 'a' | 'b', 'extends->'> // True * type test1 = A.Is<'a' | 'b', 'a', 'extends->'> // Boolean * * type test2 = A.Is<'a', 'a' | 'b', '<-extends'> // Boolean * type test3 = A.Is<'a' | 'b', 'a', '<-extends'> // True * * type test4 = A.Is<'a', 'a' | 'b', 'implements->'> // True * type test5 = A.Is<'a' | 'b', 'a', 'implements->'> // False * * type test6 = A.Is<'a', 'a' | 'b', '<-implements'> // False * type test7 = A.Is<'a' | 'b', 'a', '<-implements'> // True * * type test8 = A.Is<'a', 'a' | 'b', 'equals'> // False * type test9 = A.Is<'b' |'a', 'a' | 'b', 'equals'> // True * ``` */ export type Is = { 'default': Extends; 'contains->': Contains; 'extends->': Extends; 'implements->': Contains; '<-contains': Contains; '<-extends': Extends; '<-implements': Contains; 'equals': Equals; }[match]; } declare module "Boolean/And" { import { Boolean } from "Boolean/Boolean"; /** Logical **`&&`** operator (behaves like the JS one) @param B1 Left-hand side @param B2 Right-hand side @returns [[Boolean]] @example ```ts import {B} from 'ts-toolbelt' type test0 = B.And // False type test1 = B.And // True type test2 = B.And // Boolean ``` */ export type And = { 0: { 0: 0; 1: 0; }; 1: { 0: 0; 1: 1; }; }[B1][B2]; } declare module "Boolean/Or" { import { Boolean } from "Boolean/Boolean"; /** Logical **`||`** operator (behaves like the JS one) @param B1 Left-hand side @param B2 Right-hand side @returns [[Boolean]] @example ```ts import {B} from 'ts-toolbelt' type test0 = B.Or // True type test1 = B.Or // True type test2 = B.Or // Boolean ``` */ export type Or = { 0: { 0: 0; 1: 1; }; 1: { 0: 1; 1: 1; }; }[B1][B2]; } declare module "Any/IsLiteral" { import { And } from "Boolean/And"; import { Or } from "Boolean/Or"; import { Extends } from "Any/Extends"; /** * @hidden */ export type IsStringLiteral = A extends string ? string extends A ? 0 : 1 : 0; /** * @hidden */ export type IsNumberLiteral = A extends number ? number extends A ? 0 : 1 : 0; /** * Literal to restrict against */ export type Kind = string | number; /** * Determine whether **`A`** is literal or not * @param A to be checked * @param kind (?=`'string' | 'number'`) to restrict * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.IsLiteral<1 | 2> // 1 * type test1 = A.IsLiteral<1 | 2, string> // 0 * type test2 = A.IsLiteral<1 | '2', string> // 0 | 1 * type test3 = A.IsLiteral // 0 * ``` */ export type IsLiteral = And, IsNumberLiteral>, Extends>; } declare module "Any/Kind" { import { Extends } from "Any/Extends"; import { List } from "List/List"; /** * @hidden */ type _Kind = Extends extends 1 ? 'function' : Extends extends 1 ? 'array' : Extends extends 1 ? 'object' : Extends extends 1 ? 'string' : Extends extends 1 ? 'number' : Extends extends 1 ? 'boolean' : 'unknown'; /** * Get the literal kind of a type * @param A * @returns **`'string' | 'number' | 'function' | 'array' | 'object' | 'boolean' | 'unknown'`** * @example * ```ts * ``` */ export type Kind = A extends unknown ? _Kind : never; } declare module "Any/Promise" { /** * Create an asynchronous operation like the original `Promise` type but this * one prevents promises to be wrapped within more promises (not possible). * @param A */ export type Promise = globalThis.Promise ? X : A>; } declare module "Any/Promisable" { import { Promise } from "Any/Promise"; /** * A way to say that you can handle **`Promises`** and non-**`Promises`**. This * is often the case if you're a heavy user of `await` and `async`. * @param A **`A`** A type * @returns **`A | Promise`** * @example */ export type Promisable = A | Promise; } declare module "Any/PromiseOf" { /** Get the instance type wrapped within a **`Promise`** @param P **`Promise`** @returns **`any`** @example ```ts import {C} from 'ts-toolbelt' const promise = new Promise((res, rej) => res('x')) type test0 = C.PromiseOf // string type test1 = C.PromiseOf> // number ``` */ export type PromiseOf

= P extends Promise ? A : P; } declare module "Any/Try" { /** * Similar to [[Cast]] but with a custom fallback **`Catch`**. If it fails, * it will enforce **`Catch`** instead of **`A2`**. * @param A1 to check against * @param A2 to try **`A1`** with * @param Catch to fallback (fail) * @returns **`A1`** or **`Catch`** * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Try<'42', string> // '42' * type test1 = A.Try<'42', number> // never * type test1 = A.Try<'42', number, 'tried'> // 'tried' * ``` */ export type Try = A1 extends A2 ? A1 : Catch; } declare module "Any/Type" { import { Key } from "Any/Key"; /** * Create your own opaque sub-type from a type **`A`** * @param A to be personalized * @param Id to name the sub-type * @returns A new type **`Type`** * @example * ```ts * import {A} from 'ts-toolbelt' * * type EUR = Type * type USD = Type * * let eurWallet = 10 as EUR * let usdWallet = 15 as USD * * eurWallet = usdWallet // error * ``` */ export type Type = A & { __type__: Id; }; } declare module "Any/x" { import { Type } from "Any/Type"; /** * A placeholder that is used in various ways */ export type x = Type<{}, 'x'>; } declare module "List/ObjectOf" { import { _Omit } from "Object/Omit"; import { _Pick } from "Object/Pick"; import { List } from "List/List"; /** Transform a [[List]] into an [[Object]] equivalent @param L to transform @returns [[Object]] @example ```ts ``` */ export type ObjectOf = O extends List ? number extends O['length'] ? _Pick : _Omit : O; } declare module "List/Omit" { import { _Omit as _OOmit } from "Object/Omit"; import { _ListOf } from "Object/ListOf"; import { Key } from "Any/Key"; import { List } from "List/List"; import { ObjectOf } from "List/ObjectOf"; import { NumberOf } from "Any/_Internal"; /** @hidden */ export type _Omit = _ListOf<_OOmit, NumberOf>>; /** Remove out of **`L`** the entries of key **`K`** @param L to remove from @param K to chose entries @returns [[List]] @example ```ts ``` */ export type Omit = L extends unknown ? _Omit : never; } declare module "Any/Omit" { import { _Omit as _OOmit } from "Object/Omit"; import { _Omit as _LOmit } from "List/Omit"; import { Key } from "Any/Key"; import { List } from "List/List"; import { Union } from "Union/Union"; /** * Remove out from each member of union **`U`** the fields of key **`K`** * @param U to remove from * @param K to chose fields * @returns [[Union]] * @example * ```ts * import {U} from 'ts-toolbelt' * * type O = {type: 'foo'; other: number} | {type: 'bar'; other: string} | [0, 1] * type test0 = U.Omit // {type: 'foo'} | {type: 'bar'} | [1] * ``` */ export type Omit = U extends object ? U extends List ? _LOmit : _OOmit : U; } declare module "List/Pick" { import { _Pick as _OPick } from "Object/Pick"; import { _ListOf } from "Object/ListOf"; import { Key } from "Any/Key"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; import { NumberOf } from "Any/_Internal"; /** @hidden */ export type _Pick = _ListOf<_OPick, NumberOf>>; /** Extract out of **`L`** the entries of key **`K`** @param L to extract from @param K to chose entries @returns [[List]] @example ```ts ``` */ export type Pick = L extends unknown ? _Pick : never; } declare module "Any/Pick" { import { _Pick as _OPick } from "Object/Pick"; import { _Pick as _LPick } from "List/Pick"; import { Key } from "Any/Key"; import { List } from "List/List"; import { Union } from "Union/Union"; /** * Extract out from each member of union **`U`** the fields of key **`K`** * @param U to remove from * @param K to chose fields * @returns [[Union]] * @example * ```ts * import {U} from 'ts-toolbelt' * * type O = {type: 'foo'; other: number} | {type: 'bar'; other: string} | [0, 1] * type test0 = U.Pick // {type: 'foo'} | {type: 'bar'} | [1] * ``` */ export type Pick = U extends object ? U extends List ? _LPick : _OPick : U; } declare module "Any/_api" { /** @ignore */ /** */ export { Cast } from "Any/Cast"; export { Clean } from "Any/Clean"; export { Compute } from "Any/Compute"; export { Contains } from "Any/Contains"; export { Equals } from "Any/Equals"; export { Extends } from "Any/Extends"; export { Key } from "Any/Key"; export { Is } from "Any/Is"; export { IsLiteral } from "Any/IsLiteral"; export { Kind } from "Any/Kind"; export { Promisable } from "Any/Promisable"; export { Promise } from "Any/Promise"; export { PromiseOf } from "Any/PromiseOf"; export { Try } from "Any/Try"; export { Type } from "Any/Type"; export { x } from "Any/x"; export { Omit } from "Any/Omit"; export { Pick } from "Any/Pick"; export { Contains as Implements } from "Any/Contains"; } declare module "Boolean/BooleanOf" { /** Transform a **`boolean`** into a [[Boolean]] @param B to transform @returns [[Boolean]] @example ```ts type test0 = B.BooleanOf // 1 type test1 = B.BooleanOf // 0 ``` */ export type BooleanOf = B extends true ? 1 : 0; } declare module "Boolean/_Internal" { /** Describes compatible type formats * `b`: **`boolean`** * `n`: **`number`** * `s`: **`string`** */ export type Formats = 'b' | 'n' | 's'; } declare module "Boolean/Format" { import { Boolean } from "Boolean/Boolean"; import { Formats } from "Boolean/_Internal"; /** Change the format of a [[Boolean]] @param B to transform @returns **`string | number | boolean`** @example ```ts import {B} from 'ts-toolbelt' type test0 = B.Format // 'true' type test1 = B.Format // true ``` */ export type Format = { 'b': [false, true][B]; 'n': B; 's': ['false', 'true'][B]; }[fmt]; } declare module "Boolean/Xor" { import { Boolean } from "Boolean/Boolean"; /** Logical **`^`** operator (behaves like the JS one) @param B1 Left-hand side @param B2 Right-hand side @returns [[Boolean]] @example ```ts import {B} from 'ts-toolbelt' type test0 = B.Xor // False type test1 = B.Xor // True type test2 = B.Xor // Boolean ``` */ export type Xor = { 0: { 0: 0; 1: 1; }; 1: { 0: 1; 1: 0; }; }[B1][B2]; } declare module "Boolean/_api" { /** @ignore */ /** */ export { And } from "Boolean/And"; export { True, False, Boolean } from "Boolean/Boolean"; export { BooleanOf } from "Boolean/BooleanOf"; export { Format } from "Boolean/Format"; export { Not } from "Boolean/Not"; export { Or } from "Boolean/Or"; export { Xor } from "Boolean/Xor"; } declare module "Class/Class" { import { List } from "List/List"; /** Alias to create/describe a [[Class]] @param P its constructor parameters @param R the object it constructs */ export type Class

= { new (...args: P): R; }; } declare module "Class/InstanceOf" { import { Class } from "Class/Class"; /** Get the instance type of a **`class`** from a class object @param C **typeof** **`class`** @returns **`class`** @example ```ts import {C} from 'ts-toolbelt' /// `create` takes an instance constructor and creates an instance of it declare function create any)>(c: C): C.InstanceOf class A {} class B {} let a = create(A) // A let b = create(B) // B ``` */ export type InstanceOf = C extends Class ? R : any; } declare module "Class/Parameters" { import { Class } from "Class/Class"; /** Get the parameters of a class constructor @param C **typeof** **`class`** @returns [[List]] @example ```ts ``` */ export type Parameters = C extends Class ? P : never; } declare module "Class/_api" { /** @ignore */ /** */ export { Class } from "Class/Class"; export { InstanceOf } from "Class/InstanceOf"; export { Parameters } from "Class/Parameters"; export { PromiseOf } from "Any/PromiseOf"; } declare module "Object/UnionOf" { import { At } from "Object/At"; /** * @hidden */ export type _UnionOf = At; /** Transform an [[Object]] into an [[Union]] @param O to transform @returns **`any`** @example ```ts ``` */ export type UnionOf = O extends unknown ? _UnionOf : never; } declare module "Iteration/Prev" { import { Map } from "Iteration/Map"; import { Iteration } from "Iteration/Iteration"; import { NumberMap } from "Iteration/Maps/Number"; /** Move **`I`**'s position backwards @param I to move @param IMap to operate with another set of numbers @returns [[Iteration]] @example ```ts import {I} from 'ts-toolbelt' type i = I.IterationOf<'20'> type test0 = I.Pos // 20 type test1 = I.Pos> // 19 ``` */ export type Prev = IMap[1][I[0]]; } declare module "Community/IncludesDeep" { import { Match } from "Any/_Internal"; import { Number } from "Number/Number"; import { UnionOf } from "Object/UnionOf"; import { Next } from "Iteration/Next"; import { Key } from "Iteration/Key"; import { Prev } from "Iteration/Prev"; import { Iteration } from "Iteration/Iteration"; import { IterationOf } from "Iteration/IterationOf"; import { Is } from "Any/Is"; import { Boolean } from "Boolean/Boolean"; import { Cast } from "Any/Cast"; /** * @hidden */ type _IncludesDeep> = { 0: _IncludesDeep : O, M, match, limit, Next>; 1: 1; 2: 0; }[Key> extends limit ? 2 : Is]; /** * Check whether **`O`**, or its sub-objects have fields that match **`M`** * where the maximum allowed depth is set with **`limit`**. * * @param O to be inspected * @param M to check field type * @param match (?=`'default'`) to change precision * @param limit (?=`'10'`) to change the check depth * @returns [[Boolean]] * @example * ```ts * ``` * @author millsp, ctrlplusb */ export type IncludesDeep = _IncludesDeep extends infer X ? Cast : never; } declare module "Community/_api" { /** @ignore */ /** */ export { IncludesDeep } from "Community/IncludesDeep"; } declare module "Function/_Internal" { /** Describes function modes * `sync` : Normal function * `async`: Promised result */ export type Mode = 'sync' | 'async'; /** Describes function parameter input * `multi`: ( a, b, c ... n ) => X * `list` : ([a, b, c ... n]) => X */ export type Input = 'multi' | 'list'; } declare module "Function/Function" { import { List } from "List/List"; /** Alias to create a [[Function]] @param P parameters @param R return type @returns [[Function]] @example ```ts import {F} from 'ts-toolbelt' type test0 = F.Function<[string, number], boolean> /// (args_0: string, args_1: number) => boolean ``` */ export interface Function

{ (...args: P): R; } } declare module "Function/Compose/Multi/Sync" { /** @ignore */ /** */ import { Function } from "Function/Function"; /** @hidden */ export type ComposeMultiSync = { (...fns: [ Function ]): Function; (...fns: [ Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R7], R8>, Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (...fns: [ Function<[R8], R9>, Function<[R7], R8>, Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; }; } declare module "Function/Compose/Multi/Async" { /** @ignore */ /** */ import { Function } from "Function/Function"; import { PromiseOf } from "Any/PromiseOf"; /** @hidden */ export type ComposeMultiAsync = { (...fns: [ Function ]): Function>>; (...fns: [ Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R8>, Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (...fns: [ Function<[PromiseOf], R9>, Function<[PromiseOf], R8>, Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; }; } declare module "Function/Compose/List/Sync" { /** @ignore */ /** */ import { Function } from "Function/Function"; /** @hidden */ export type ComposeListSync = { (fns: [ Function ]): Function; (fns: [ Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R7], R8>, Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; (fns: [ Function<[R8], R9>, Function<[R7], R8>, Function<[R6], R7>, Function<[R5], R6>, Function<[R4], R5>, Function<[R3], R4>, Function<[R2], R3>, Function<[R1], R2>, Function<[R0], R1>, Function ]): Function; }; } declare module "Function/Compose/List/Async" { /** @ignore */ /** */ import { Function } from "Function/Function"; import { PromiseOf } from "Any/PromiseOf"; /** @hidden */ export type ComposeListAsync = { (fns: [ Function ]): Function>>; (fns: [ Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R8>, Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; (fns: [ Function<[PromiseOf], R9>, Function<[PromiseOf], R8>, Function<[PromiseOf], R7>, Function<[PromiseOf], R6>, Function<[PromiseOf], R5>, Function<[PromiseOf], R4>, Function<[PromiseOf], R3>, Function<[PromiseOf], R2>, Function<[PromiseOf], R1>, Function ]): Function>>; }; } declare module "List/Tail" { import { List } from "List/List"; /** Remove the first item out of a [[List]] @param L @returns [[List]] @example ```ts ``` */ export type Tail = ((...t: L) => any) extends ((head: any, ...tail: infer LTail) => any) ? LTail : never; } declare module "List/Last" { import { Tail } from "List/Tail"; import { Length } from "List/Length"; import { List } from "List/List"; /** Get the last entry of **`L`** @param L to extract from @returns **`any`** @example ```ts ``` */ export type Last = L[Length>]; } declare module "String/_Internal" { /** Describes compatible type formats * `b`: **`boolean`** * `s`: **`string`** * `n`: **`number`** */ export type Formats = 'b' | 'n' | 's'; } declare module "String/Format" { import { Formats } from "String/_Internal"; import { Pos } from "Iteration/Pos"; import { IterationOf } from "Iteration/IterationOf"; import { Extends } from "Any/Extends"; /** Change the format of a **`string`** @param S to transform @returns **`string | number | boolean`** @example ```ts import {S} from 'ts-toolbelt' type test0 = S.Format<'30', 'b'> // True type test1 = S.Format<'30', 'n'> // 30 ``` */ export type Format = { 'b': { 1: Boolean; 0: S extends 'false' ? 0 : 1; }[Extends]; 'n': Pos>; 's': S; }[fmt]; } declare module "List/Head" { import { Length } from "List/Length"; import { List } from "List/List"; /** Get the first entry of **`L`** @param L to extract from @returns **`any`** @example ```ts ``` */ export type Head = Length extends 0 ? never : L[0]; } declare module "Function/Return" { import { Function } from "Function/Function"; import { List } from "List/List"; /** Extract the return type of a [[Function]] @param F to extract from @returns **`any`** @example ```ts import {F} from 'ts-toolbelt' const fn = () => true type test0 = F.ReturnOf // boolean type test1 = F.ReturnOf<() => true> // true ``` */ export type Return = F extends ((...args: List) => infer R) ? R : never; } declare module "Function/Parameters" { import { Function } from "Function/Function"; /** Extract parameters from a [[Function]] @param F to extract from @returns [[List]] @example ```ts import {F} from 'ts-toolbelt' const fn = (name: string, age: number) => {} type test0 = F.ParamsOf // [string, number] type test1 = F.ParamsOf<(name: string, age: number) => {}> // [string, number] ``` */ export type Parameters = F extends ((...args: infer L) => any) ? L : never; } declare module "Union/IntersectOf" { import { Union } from "Union/Union"; /** Transform a [[Union]] to an **intersection** @param U to transform @returns **intersection** @example ```ts ``` */ export type IntersectOf = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; } declare module "Function/Compose" { import { Mode, Input } from "Function/_Internal"; import { ComposeMultiSync } from "Function/Compose/Multi/Sync"; import { ComposeMultiAsync } from "Function/Compose/Multi/Async"; import { ComposeListSync } from "Function/Compose/List/Sync"; import { ComposeListAsync } from "Function/Compose/List/Async"; import { Function } from "Function/Function"; import { Pos } from "Iteration/Pos"; import { IterationOf } from "Iteration/IterationOf"; import { Last } from "List/Last"; import { Format } from "String/Format"; import { Length } from "List/Length"; import { Tail } from "List/Tail"; import { Next } from "Iteration/Next"; import { Head } from "List/Head"; import { Return } from "Function/Return"; import { Parameters } from "Function/Parameters"; import { PromiseOf } from "Any/PromiseOf"; import { Or } from "Boolean/Or"; import { Extends } from "Any/Extends"; import { List } from "List/List"; import { IntersectOf } from "Union/IntersectOf"; /** @hidden */ type ComposeFnSync, K extends keyof Fns> = Length> extends Format ? Fns[K] : Function<[ Return>>]> extends infer X ? { 1: any; 0: X; }[Or, Extends>] : never ], Return>]>>; /** @hidden */ type ComposeFnAsync, K extends keyof Fns> = Length> extends Format ? PromiseOf : Function<[ PromiseOf>>]>> extends infer X ? { 1: any; 0: X; }[Or, Extends>] : never ], Return>]>>; /** Compute what the input of [[Compose]] should be @param Fns to compose @param mode (?=`'sync'`) sync/async @example ```ts ``` */ export type Composer, mode extends Mode = 'sync'> = { 'sync': { [K in keyof Fns]: ComposeFnSync; }; 'async': { [K in keyof Fns]: ComposeFnAsync; }; }[mode]; /** Compose [[Function]]s together @param Fns to compose @returns [[Function]] @example ```ts import {F} from 'ts-toolbelt' /// If you are looking for creating types for `compose` /// `Composer` will check for input & `Composed` the output declare function compose(...args: F.Composer): F.Composed const a = (a1: number) => `${a1}` const c = (c1: string[]) => [c1] const b = (b1: string) => [b1] compose(c, b, a)(42) /// And if you are looking for an async `compose` type declare function compose(...args: F.Composer): F.Composed const a = async (a1: number) => `${a1}` const b = async (b1: string) => [b1] const c = async (c1: string[]) => [c1] await compose(c, b, a)(42) */ export type Composed, mode extends Mode = 'sync'> = { 'sync': (...args: Parameters>) => Return>; 'async': (...args: Parameters>) => Promise>>>; }[mode]; /** Compose [[Function]]s together @param mode (?=`'sync'`) sync/async (this depends on your implementation) @param input (?=`'multi'`) whether you want it to take a list or parameters @example ```ts import {F} from 'ts-toolbelt' /// If you are looking for creating types for `compose` /// `Composer` will check for input & `Compose` the output declare const compose: F.Compose const a = (a1: number) => `${a1}` const c = (c1: string[]) => [c1] const b = (b1: string) => [b1] compose(c, b, a)(42) /// And if you are looking for an async `compose` type declare const compose: F.Compose<'async'> const a = async (a1: number) => `${a1}` const b = async (b1: string) => [b1] const c = async (c1: string[]) => [c1] await compose(c, b, a)(42) */ export type Compose = IntersectOf<{ 'sync': { 'multi': ComposeMultiSync; 'list': ComposeListSync; }; 'async': { 'multi': ComposeMultiAsync; 'list': ComposeListAsync; }; }[mode][input]>; } declare module "Union/NonNullable" { import { Exclude } from "Union/Exclude"; import { Union } from "Union/Union"; /** Remove **`undefined`** & **`null`** out of **`U`** @param U to make non-nullable @returns [[Union]] @example ```ts ``` */ export type NonNullable = Exclude; } declare module "Object/Patch" { import { AtBasic } from "Object/At"; import { Key } from "Any/Key"; import { _ListOf } from "Object/ListOf"; import { List } from "List/List"; import { Depth, MergeStyle } from "Object/_Internal"; import { BuiltInObject } from "Misc/BuiltInObject"; import { _Omit } from "Object/Omit"; import { ObjectOf } from "List/ObjectOf"; /** @hidden */ type LibStyle = { 0: [O] extends [List] ? [O1] extends [List] ? _ListOf : O : Merged; 1: Merged; 2: [O] extends [List] ? [O1] extends [List] ? Merged[keyof Merged][] : O : Merged; }[style]; /** @hidden */ type PatchProp = K extends OOK ? OK : O1K; /** @hidden */ type __PatchFlat = { [K in keyof (O & _Omit)]: PatchProp, AtBasic, K, OOK>; } & {}; /** @hidden */ export type _PatchFlat = LibStyle<__PatchFlat, ObjectOf>, O, O1, style>; /** @hidden */ export type PatchFlat = O extends noMerge ? O : O1 extends noMerge ? O : _PatchFlat; /** @hidden */ type __PatchDeep = { [K in keyof (O & _Omit)]: _PatchDeep, AtBasic, K, OOK, style, noMerge>; }; /** @hidden */ type ChoosePatchDeep = OK extends BuiltInObject ? PatchProp : O1K extends BuiltInObject ? PatchProp : OK extends object ? O1K extends object ? __PatchDeep, ObjectOf, style, noMerge> : PatchProp : PatchProp; /** @hidden */ export type _PatchDeep = [ O ] extends [never] ? PatchProp : [O1] extends [never] ? PatchProp : LibStyle, O, O1, style>; /** @hidden */ export type PatchDeep = O extends unknown ? O1 extends unknown ? _PatchDeep : never : never; /** Complete the fields of **`O`** with the ones of **`O1`**. This is a version of [[Merge]] that does NOT handle optional fields, it only completes fields of `O` with the ones of `O1`. @param O to complete @param O1 to copy from @param depth (?=`'flat'`) to do it deeply @param style (?=`1`) 0 = lodash, 1 = ramda @param noMerge (?=`BuiltinObject`) types not to merge @returns [[Object]] @example ```ts import {O} from 'ts-toolbelt' type O = { name?: string age? : number zip? : string pay : { cvv?: number } } type O1 = { age : number zip?: number city: string pay : { cvv : number ccn?: string } } type test = O.Patch // { // name?: string; // age?: number; // zip?: string | number; // pay: { // cvv?: number; // ccn?: string; // }; // city: string; // } ``` */ export type Patch = { 'flat': PatchFlat; 'deep': PatchDeep; }[depth]; } declare module "Object/NonNullable" { import { NonNullable as UNonNullable } from "Union/NonNullable"; import { Depth } from "Object/_Internal"; import { _Pick } from "Object/Pick"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type NonNullableFlat = { [K in keyof O]: UNonNullable; } & {}; /** @hidden */ export type NonNullableDeep = { [K in keyof O]: O[K] extends BuiltInObject ? O[K] : NonNullableDeep>; }; /** @hidden */ export type NonNullablePart = { 'flat': NonNullableFlat; 'deep': NonNullableDeep; }[depth]; /** * @hidden */ export type _NonNullable = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** not nullable (deeply or not) (Optional fields will be left untouched & **`undefined`**) @param O to make non nullable @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type NonNullable = O extends unknown ? _NonNullable : never; } declare module "Function/Curry" { import { Pos } from "Iteration/Pos"; import { _Append } from "List/Append"; import { _Concat } from "List/Concat"; import { Length } from "List/Length"; import { Next } from "Iteration/Next"; import { Cast } from "Any/Cast"; import { Parameters } from "Function/Parameters"; import { Return } from "Function/Return"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { NonNullableFlat } from "Object/NonNullable"; import { x } from "Any/x"; import { List } from "List/List"; import { Function } from "Function/Function"; import { Extends } from "Any/Extends"; import { Tail } from "List/Tail"; /** @hidden */ type GapOf = L1[Pos] extends x ? _Append]> : LN; /** @hidden */ type _GapsOf> = { 0: _GapsOf, Tail, Next>; 1: _Concat; }[Extends, Length>]; /** @hidden */ type GapsOf = _GapsOf extends infer X ? Cast : never; /** @hidden */ type Gaps = Cast, List>; /** Curry a [[Function]] @param F to curry @returns [[Function]] @example ```ts import {F} from 'ts-toolbelt' /// If you are looking for creating types for `curry` /// It handles placeholders and variable arguments declare function curry(fn: Fn): F.Curry ``` */ export type Curry = >, R extends any = Return>(...args: Cast>>) => Length extends 0 ? R : Length extends 1 ? Curry<(...args: G) => R> & ((...args: G) => R) : Curry<(...args: G) => R>; } declare module "Function/Length" { import { Function } from "Function/Function"; import { Parameters } from "Function/Parameters"; import { Formats } from "Iteration/_Internal"; import { Length as LLength } from "List/Length"; /** Extract arguments' length from a [[Function]] @param F to extract from @param fmt (?=`'n'`) output @returns [[String]] or **`number`** @example ```ts import {F} from 'ts-toolbelt' const fn = (a1: any, a2: any) => {} type test0 = F.LengthOf // 2 type test1 = F.LengthOf<(a1?: any) => any> // 0 | 1 type test2 = F.LengthOf<(...a: any[]) => any> // number ``` */ export type Length = LLength, fmt>; } declare module "Function/NoInfer" { /** Explain to TS which function parameter has priority for generic inference @param A to de-prioritize @returns **`A`** @example ```ts import {F} from 'ts-toolbelt' const fn0 = (a0: A, a1: F.NoInfer): A => { return {} as unknown as A // just for the example } const fn1 = (a0: F.NoInfer, a1: A): A => { return {} as unknown as A // just for the example } const fn2 = (a0: F.NoInfer, a1: F.NoInfer): A => { return {} as unknown as A // just for the example } const test0 = fn0('b', 'a') // error: infer priority is `a0` const test1 = fn1('b', 'a') // error: infer priority is `a1` const test2 = fn2('b', 'a') // works: infer priority is `a0` | `a1` ``` @see https://stackoverflow.com/questions/56687668 */ export type NoInfer = [ A ][A extends any ? 0 : never]; } declare module "Function/Pipe/Multi/Sync" { /** @ignore */ /** */ import { Function } from "Function/Function"; /** @hidden */ export type PipeMultiSync = { (...fns: [ Function ]): Function; (...fns: [ Function, Function<[R0], R1> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7>, Function<[R7], R8> ]): Function; (...fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7>, Function<[R7], R8>, Function<[R8], R9> ]): Function; }; } declare module "Function/Pipe/Multi/Async" { /** @ignore */ /** */ import { Function } from "Function/Function"; import { PromiseOf } from "Any/PromiseOf"; /** @hidden */ export type PipeMultiAsync = { (...fns: [ Function ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7>, Function<[PromiseOf], R8> ]): Function>>; (...fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7>, Function<[PromiseOf], R8>, Function<[PromiseOf], R9> ]): Function>>; }; } declare module "Function/Pipe/List/Sync" { /** @ignore */ /** */ import { Function } from "Function/Function"; /** @hidden */ export type PipeListSync = { (fns: [ Function ]): Function; (fns: [ Function, Function<[R0], R1> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7>, Function<[R7], R8> ]): Function; (fns: [ Function, Function<[R0], R1>, Function<[R1], R2>, Function<[R2], R3>, Function<[R3], R4>, Function<[R4], R5>, Function<[R5], R6>, Function<[R6], R7>, Function<[R7], R8>, Function<[R8], R9> ]): Function; }; } declare module "Function/Pipe/List/Async" { /** @ignore */ /** */ import { Function } from "Function/Function"; import { PromiseOf } from "Any/PromiseOf"; /** @hidden */ export type PipeListAsync = { (fns: [ Function ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7>, Function<[PromiseOf], R8> ]): Function>>; (fns: [ Function, Function<[PromiseOf], R1>, Function<[PromiseOf], R2>, Function<[PromiseOf], R3>, Function<[PromiseOf], R4>, Function<[PromiseOf], R5>, Function<[PromiseOf], R6>, Function<[PromiseOf], R7>, Function<[PromiseOf], R8>, Function<[PromiseOf], R9> ]): Function>>; }; } declare module "Function/Pipe" { import { Mode, Input } from "Function/_Internal"; import { PipeMultiSync } from "Function/Pipe/Multi/Sync"; import { PipeMultiAsync } from "Function/Pipe/Multi/Async"; import { PipeListSync } from "Function/Pipe/List/Sync"; import { PipeListAsync } from "Function/Pipe/List/Async"; import { Function } from "Function/Function"; import { Pos } from "Iteration/Pos"; import { IterationOf } from "Iteration/IterationOf"; import { Last } from "List/Last"; import { Prev } from "Iteration/Prev"; import { Head } from "List/Head"; import { Return } from "Function/Return"; import { Parameters } from "Function/Parameters"; import { PromiseOf } from "Any/PromiseOf"; import { Or } from "Boolean/Or"; import { Extends } from "Any/Extends"; import { List } from "List/List"; import { IntersectOf } from "Union/IntersectOf"; /** @hidden */ type PipeFnSync, K extends keyof Fns> = K extends '0' ? Fns[K] : Function<[ Return>>]> extends infer X ? { 1: any; 0: X; }[Or, Extends>] : never ], Return>]>>; /** @hidden */ type PipeFnAsync, K extends keyof Fns> = K extends '0' ? PromiseOf : Function<[ PromiseOf>>]>> extends infer X ? { 1: any; 0: X; }[Or, Extends>] : never ], Return>]>>; /** Compute what the input of [[Pipe]] should be @param Fns to pipe @param mode (?=`'sync'`) sync/async @example ```ts ``` */ export type Piper, mode extends Mode = 'sync'> = { 'sync': { [K in keyof Fns]: PipeFnSync; }; 'async': { [K in keyof Fns]: PipeFnAsync; }; }[mode]; /** Pipe [[Function]]s together @param Fns to pipe @param mode (?=`'sync'`) sync/async @returns [[Function]] @example ```ts import {F} from 'ts-toolbelt' /// If you are looking for creating types for `pipe` /// `Piper` will check for input & `Piped` the output declare function pipe(...args: F.Piper): F.Piped const a = (a1: number) => `${a1}` const b = (b1: string) => [b1] const c = (c1: string[]) => [c1] pipe(a, b, c)(42) /// And if you are looking for an async `pipe` type declare function pipe(...args: F.Piper): F.Piped const a = async (a1: number) => `${a1}` const b = async (b1: string) => [b1] const c = async (c1: string[]) => [c1] await pipe(a, b, c)(42) ``` */ export type Piped, mode extends Mode = 'sync'> = { 'sync': (...args: Parameters>) => Return>; 'async': (...args: Parameters>) => Promise>>>; }[mode]; /** Pipe [[Function]]s together @param mode (?=`'sync'`) sync/async (this depends on your implementation) @param input (?=`'multi'`) whether you want to take a list or multiple parameters @returns [[Function]] @example ```ts import {F} from 'ts-toolbelt' /// If you are looking for creating types for `pipe`: declare const pipe: F.Pipe const a = (a1: number) => `${a1}` const b = (b1: string) => [b1] const c = (c1: string[]) => [c1] pipe(a, b, c)(42) /// And if you are looking for an async `pipe` type: declare const pipe: F.Pipe<'async'> const a = async (a1: number) => `${a1}` const b = async (b1: string) => [b1] const c = async (c1: string[]) => [c1] await pipe(a, b, c)(42) ``` */ export type Pipe = IntersectOf<{ 'sync': { 'multi': PipeMultiSync; 'list': PipeListSync; }; 'async': { 'multi': PipeMultiAsync; 'list': PipeListAsync; }; }[mode][input]>; } declare module "Function/Promisify" { import { Function } from "Function/Function"; import { Parameters } from "Function/Parameters"; import { Return } from "Function/Return"; import { Promise } from "Any/Promise"; /** Creates a promisified version of a **`Function`** **`F`** @param F to promisify @returns async F @example ```ts import {F} from 'ts-toolbelt' type test0 = F.Promisify<(a: number) => number> // (a: number) => Promise ``` */ export type Promisify = (...args: Parameters) => Promise>; } declare module "Function/UnCurry" { import { Curry } from "Function/Curry"; /** Undoes the work that was done by [[Curry]] @param F to uncurry @returns [[Function]] @example @ignore */ export type UnCurry> = F extends Curry ? UF : never; } declare module "Function/_api" { /** @ignore */ /** */ export { Compose, Composed, Composer } from "Function/Compose"; export { Curry } from "Function/Curry"; export { Function } from "Function/Function"; export { Length } from "Function/Length"; export { NoInfer } from "Function/NoInfer"; export { Parameters } from "Function/Parameters"; export { Pipe, Piped, Piper } from "Function/Pipe"; export { Promisify } from "Function/Promisify"; export { Return } from "Function/Return"; export { UnCurry } from "Function/UnCurry"; } declare module "Iteration/Maps/Pixel" { import { CreateMap } from "Iteration/Map"; /** * @hidden */ type RawMap = { '-100px': ['__', '-99px', '-100px', -100, '100px', '-100px', '-']; '-99px': ['-100px', '-98px', '-99px', -99, '99px', RawMap['-100px'][5] | '-99px', '-']; '-98px': ['-99px', '-97px', '-98px', -98, '98px', RawMap['-99px'][5] | '-98px', '-']; '-97px': ['-98px', '-96px', '-97px', -97, '97px', RawMap['-98px'][5] | '-97px', '-']; '-96px': ['-97px', '-95px', '-96px', -96, '96px', RawMap['-97px'][5] | '-96px', '-']; '-95px': ['-96px', '-94px', '-95px', -95, '95px', RawMap['-96px'][5] | '-95px', '-']; '-94px': ['-95px', '-93px', '-94px', -94, '94px', RawMap['-95px'][5] | '-94px', '-']; '-93px': ['-94px', '-92px', '-93px', -93, '93px', RawMap['-94px'][5] | '-93px', '-']; '-92px': ['-93px', '-91px', '-92px', -92, '92px', RawMap['-93px'][5] | '-92px', '-']; '-91px': ['-92px', '-90px', '-91px', -91, '91px', RawMap['-92px'][5] | '-91px', '-']; '-90px': ['-91px', '-89px', '-90px', -90, '90px', RawMap['-91px'][5] | '-90px', '-']; '-89px': ['-90px', '-88px', '-89px', -89, '89px', RawMap['-90px'][5] | '-89px', '-']; '-88px': ['-89px', '-87px', '-88px', -88, '88px', RawMap['-89px'][5] | '-88px', '-']; '-87px': ['-88px', '-86px', '-87px', -87, '87px', RawMap['-88px'][5] | '-87px', '-']; '-86px': ['-87px', '-85px', '-86px', -86, '86px', RawMap['-87px'][5] | '-86px', '-']; '-85px': ['-86px', '-84px', '-85px', -85, '85px', RawMap['-86px'][5] | '-85px', '-']; '-84px': ['-85px', '-83px', '-84px', -84, '84px', RawMap['-85px'][5] | '-84px', '-']; '-83px': ['-84px', '-82px', '-83px', -83, '83px', RawMap['-84px'][5] | '-83px', '-']; '-82px': ['-83px', '-81px', '-82px', -82, '82px', RawMap['-83px'][5] | '-82px', '-']; '-81px': ['-82px', '-80px', '-81px', -81, '81px', RawMap['-82px'][5] | '-81px', '-']; '-80px': ['-81px', '-79px', '-80px', -80, '80px', RawMap['-81px'][5] | '-80px', '-']; '-79px': ['-80px', '-78px', '-79px', -79, '79px', RawMap['-80px'][5] | '-79px', '-']; '-78px': ['-79px', '-77px', '-78px', -78, '78px', RawMap['-79px'][5] | '-78px', '-']; '-77px': ['-78px', '-76px', '-77px', -77, '77px', RawMap['-78px'][5] | '-77px', '-']; '-76px': ['-77px', '-75px', '-76px', -76, '76px', RawMap['-77px'][5] | '-76px', '-']; '-75px': ['-76px', '-74px', '-75px', -75, '75px', RawMap['-76px'][5] | '-75px', '-']; '-74px': ['-75px', '-73px', '-74px', -74, '74px', RawMap['-75px'][5] | '-74px', '-']; '-73px': ['-74px', '-72px', '-73px', -73, '73px', RawMap['-74px'][5] | '-73px', '-']; '-72px': ['-73px', '-71px', '-72px', -72, '72px', RawMap['-73px'][5] | '-72px', '-']; '-71px': ['-72px', '-70px', '-71px', -71, '71px', RawMap['-72px'][5] | '-71px', '-']; '-70px': ['-71px', '-69px', '-70px', -70, '70px', RawMap['-71px'][5] | '-70px', '-']; '-69px': ['-70px', '-68px', '-69px', -69, '69px', RawMap['-70px'][5] | '-69px', '-']; '-68px': ['-69px', '-67px', '-68px', -68, '68px', RawMap['-69px'][5] | '-68px', '-']; '-67px': ['-68px', '-66px', '-67px', -67, '67px', RawMap['-68px'][5] | '-67px', '-']; '-66px': ['-67px', '-65px', '-66px', -66, '66px', RawMap['-67px'][5] | '-66px', '-']; '-65px': ['-66px', '-64px', '-65px', -65, '65px', RawMap['-66px'][5] | '-65px', '-']; '-64px': ['-65px', '-63px', '-64px', -64, '64px', RawMap['-65px'][5] | '-64px', '-']; '-63px': ['-64px', '-62px', '-63px', -63, '63px', RawMap['-64px'][5] | '-63px', '-']; '-62px': ['-63px', '-61px', '-62px', -62, '62px', RawMap['-63px'][5] | '-62px', '-']; '-61px': ['-62px', '-60px', '-61px', -61, '61px', RawMap['-62px'][5] | '-61px', '-']; '-60px': ['-61px', '-59px', '-60px', -60, '60px', RawMap['-61px'][5] | '-60px', '-']; '-59px': ['-60px', '-58px', '-59px', -59, '59px', RawMap['-60px'][5] | '-59px', '-']; '-58px': ['-59px', '-57px', '-58px', -58, '58px', RawMap['-59px'][5] | '-58px', '-']; '-57px': ['-58px', '-56px', '-57px', -57, '57px', RawMap['-58px'][5] | '-57px', '-']; '-56px': ['-57px', '-55px', '-56px', -56, '56px', RawMap['-57px'][5] | '-56px', '-']; '-55px': ['-56px', '-54px', '-55px', -55, '55px', RawMap['-56px'][5] | '-55px', '-']; '-54px': ['-55px', '-53px', '-54px', -54, '54px', RawMap['-55px'][5] | '-54px', '-']; '-53px': ['-54px', '-52px', '-53px', -53, '53px', RawMap['-54px'][5] | '-53px', '-']; '-52px': ['-53px', '-51px', '-52px', -52, '52px', RawMap['-53px'][5] | '-52px', '-']; '-51px': ['-52px', '-50px', '-51px', -51, '51px', RawMap['-52px'][5] | '-51px', '-']; '-50px': ['-51px', '-49px', '-50px', -50, '50px', RawMap['-51px'][5] | '-50px', '-']; '-49px': ['-50px', '-48px', '-49px', -49, '49px', RawMap['-50px'][5] | '-49px', '-']; '-48px': ['-49px', '-47px', '-48px', -48, '48px', RawMap['-49px'][5] | '-48px', '-']; '-47px': ['-48px', '-46px', '-47px', -47, '47px', RawMap['-48px'][5] | '-47px', '-']; '-46px': ['-47px', '-45px', '-46px', -46, '46px', RawMap['-47px'][5] | '-46px', '-']; '-45px': ['-46px', '-44px', '-45px', -45, '45px', RawMap['-46px'][5] | '-45px', '-']; '-44px': ['-45px', '-43px', '-44px', -44, '44px', RawMap['-45px'][5] | '-44px', '-']; '-43px': ['-44px', '-42px', '-43px', -43, '43px', RawMap['-44px'][5] | '-43px', '-']; '-42px': ['-43px', '-41px', '-42px', -42, '42px', RawMap['-43px'][5] | '-42px', '-']; '-41px': ['-42px', '-40px', '-41px', -41, '41px', RawMap['-42px'][5] | '-41px', '-']; '-40px': ['-41px', '-39px', '-40px', -40, '40px', RawMap['-41px'][5] | '-40px', '-']; '-39px': ['-40px', '-38px', '-39px', -39, '39px', RawMap['-40px'][5] | '-39px', '-']; '-38px': ['-39px', '-37px', '-38px', -38, '38px', RawMap['-39px'][5] | '-38px', '-']; '-37px': ['-38px', '-36px', '-37px', -37, '37px', RawMap['-38px'][5] | '-37px', '-']; '-36px': ['-37px', '-35px', '-36px', -36, '36px', RawMap['-37px'][5] | '-36px', '-']; '-35px': ['-36px', '-34px', '-35px', -35, '35px', RawMap['-36px'][5] | '-35px', '-']; '-34px': ['-35px', '-33px', '-34px', -34, '34px', RawMap['-35px'][5] | '-34px', '-']; '-33px': ['-34px', '-32px', '-33px', -33, '33px', RawMap['-34px'][5] | '-33px', '-']; '-32px': ['-33px', '-31px', '-32px', -32, '32px', RawMap['-33px'][5] | '-32px', '-']; '-31px': ['-32px', '-30px', '-31px', -31, '31px', RawMap['-32px'][5] | '-31px', '-']; '-30px': ['-31px', '-29px', '-30px', -30, '30px', RawMap['-31px'][5] | '-30px', '-']; '-29px': ['-30px', '-28px', '-29px', -29, '29px', RawMap['-30px'][5] | '-29px', '-']; '-28px': ['-29px', '-27px', '-28px', -28, '28px', RawMap['-29px'][5] | '-28px', '-']; '-27px': ['-28px', '-26px', '-27px', -27, '27px', RawMap['-28px'][5] | '-27px', '-']; '-26px': ['-27px', '-25px', '-26px', -26, '26px', RawMap['-27px'][5] | '-26px', '-']; '-25px': ['-26px', '-24px', '-25px', -25, '25px', RawMap['-26px'][5] | '-25px', '-']; '-24px': ['-25px', '-23px', '-24px', -24, '24px', RawMap['-25px'][5] | '-24px', '-']; '-23px': ['-24px', '-22px', '-23px', -23, '23px', RawMap['-24px'][5] | '-23px', '-']; '-22px': ['-23px', '-21px', '-22px', -22, '22px', RawMap['-23px'][5] | '-22px', '-']; '-21px': ['-22px', '-20px', '-21px', -21, '21px', RawMap['-22px'][5] | '-21px', '-']; '-20px': ['-21px', '-19px', '-20px', -20, '20px', RawMap['-21px'][5] | '-20px', '-']; '-19px': ['-20px', '-18px', '-19px', -19, '19px', RawMap['-20px'][5] | '-19px', '-']; '-18px': ['-19px', '-17px', '-18px', -18, '18px', RawMap['-19px'][5] | '-18px', '-']; '-17px': ['-18px', '-16px', '-17px', -17, '17px', RawMap['-18px'][5] | '-17px', '-']; '-16px': ['-17px', '-15px', '-16px', -16, '16px', RawMap['-17px'][5] | '-16px', '-']; '-15px': ['-16px', '-14px', '-15px', -15, '15px', RawMap['-16px'][5] | '-15px', '-']; '-14px': ['-15px', '-13px', '-14px', -14, '14px', RawMap['-15px'][5] | '-14px', '-']; '-13px': ['-14px', '-12px', '-13px', -13, '13px', RawMap['-14px'][5] | '-13px', '-']; '-12px': ['-13px', '-11px', '-12px', -12, '12px', RawMap['-13px'][5] | '-12px', '-']; '-11px': ['-12px', '-10px', '-11px', -11, '11px', RawMap['-12px'][5] | '-11px', '-']; '-10px': ['-11px', '-9px', '-10px', -10, '10px', RawMap['-11px'][5] | '-10px', '-']; '-9px': ['-10px', '-8px', '-9px', -9, '9px', RawMap['-10px'][5] | '-9px', '-']; '-8px': ['-9px', '-7px', '-8px', -8, '8px', RawMap['-9px'][5] | '-8px', '-']; '-7px': ['-8px', '-6px', '-7px', -7, '7px', RawMap['-8px'][5] | '-7px', '-']; '-6px': ['-7px', '-5px', '-6px', -6, '6px', RawMap['-7px'][5] | '-6px', '-']; '-5px': ['-6px', '-4px', '-5px', -5, '5px', RawMap['-6px'][5] | '-5px', '-']; '-4px': ['-5px', '-3px', '-4px', -4, '4px', RawMap['-5px'][5] | '-4px', '-']; '-3px': ['-4px', '-2px', '-3px', -3, '3px', RawMap['-4px'][5] | '-3px', '-']; '-2px': ['-3px', '-1px', '-2px', -2, '2px', RawMap['-3px'][5] | '-2px', '-']; '-1px': ['-2px', '0px', '-1px', -1, '1px', RawMap['-2px'][5] | '-1px', '-']; '0': ['-1px', '1px', '0px', 0, '0px', RawMap['-1px'][5] | '0px', '0']; '0px': ['-1px', '1px', '0px', 0, '0px', RawMap['-1px'][5] | '0px', '0']; '1px': ['0px', '2px', '1px', 1, '-1px', RawMap['0px'][5] | '1px', '+']; '2px': ['1px', '3px', '2px', 2, '-2px', RawMap['1px'][5] | '2px', '+']; '3px': ['2px', '4px', '3px', 3, '-3px', RawMap['2px'][5] | '3px', '+']; '4px': ['3px', '5px', '4px', 4, '-4px', RawMap['3px'][5] | '4px', '+']; '5px': ['4px', '6px', '5px', 5, '-5px', RawMap['4px'][5] | '5px', '+']; '6px': ['5px', '7px', '6px', 6, '-6px', RawMap['5px'][5] | '6px', '+']; '7px': ['6px', '8px', '7px', 7, '-7px', RawMap['6px'][5] | '7px', '+']; '8px': ['7px', '9px', '8px', 8, '-8px', RawMap['7px'][5] | '8px', '+']; '9px': ['8px', '10px', '9px', 9, '-9px', RawMap['8px'][5] | '9px', '+']; '10px': ['9px', '11px', '10px', 10, '-10px', RawMap['9px'][5] | '10px', '+']; '11px': ['10px', '12px', '11px', 11, '-11px', RawMap['10px'][5] | '11px', '+']; '12px': ['11px', '13px', '12px', 12, '-12px', RawMap['11px'][5] | '12px', '+']; '13px': ['12px', '14px', '13px', 13, '-13px', RawMap['12px'][5] | '13px', '+']; '14px': ['13px', '15px', '14px', 14, '-14px', RawMap['13px'][5] | '14px', '+']; '15px': ['14px', '16px', '15px', 15, '-15px', RawMap['14px'][5] | '15px', '+']; '16px': ['15px', '17px', '16px', 16, '-16px', RawMap['15px'][5] | '16px', '+']; '17px': ['16px', '18px', '17px', 17, '-17px', RawMap['16px'][5] | '17px', '+']; '18px': ['17px', '19px', '18px', 18, '-18px', RawMap['17px'][5] | '18px', '+']; '19px': ['18px', '20px', '19px', 19, '-19px', RawMap['18px'][5] | '19px', '+']; '20px': ['19px', '21px', '20px', 20, '-20px', RawMap['19px'][5] | '20px', '+']; '21px': ['20px', '22px', '21px', 21, '-21px', RawMap['20px'][5] | '21px', '+']; '22px': ['21px', '23px', '22px', 22, '-22px', RawMap['21px'][5] | '22px', '+']; '23px': ['22px', '24px', '23px', 23, '-23px', RawMap['22px'][5] | '23px', '+']; '24px': ['23px', '25px', '24px', 24, '-24px', RawMap['23px'][5] | '24px', '+']; '25px': ['24px', '26px', '25px', 25, '-25px', RawMap['24px'][5] | '25px', '+']; '26px': ['25px', '27px', '26px', 26, '-26px', RawMap['25px'][5] | '26px', '+']; '27px': ['26px', '28px', '27px', 27, '-27px', RawMap['26px'][5] | '27px', '+']; '28px': ['27px', '29px', '28px', 28, '-28px', RawMap['27px'][5] | '28px', '+']; '29px': ['28px', '30px', '29px', 29, '-29px', RawMap['28px'][5] | '29px', '+']; '30px': ['29px', '31px', '30px', 30, '-30px', RawMap['29px'][5] | '30px', '+']; '31px': ['30px', '32px', '31px', 31, '-31px', RawMap['30px'][5] | '31px', '+']; '32px': ['31px', '33px', '32px', 32, '-32px', RawMap['31px'][5] | '32px', '+']; '33px': ['32px', '34px', '33px', 33, '-33px', RawMap['32px'][5] | '33px', '+']; '34px': ['33px', '35px', '34px', 34, '-34px', RawMap['33px'][5] | '34px', '+']; '35px': ['34px', '36px', '35px', 35, '-35px', RawMap['34px'][5] | '35px', '+']; '36px': ['35px', '37px', '36px', 36, '-36px', RawMap['35px'][5] | '36px', '+']; '37px': ['36px', '38px', '37px', 37, '-37px', RawMap['36px'][5] | '37px', '+']; '38px': ['37px', '39px', '38px', 38, '-38px', RawMap['37px'][5] | '38px', '+']; '39px': ['38px', '40px', '39px', 39, '-39px', RawMap['38px'][5] | '39px', '+']; '40px': ['39px', '41px', '40px', 40, '-40px', RawMap['39px'][5] | '40px', '+']; '41px': ['40px', '42px', '41px', 41, '-41px', RawMap['40px'][5] | '41px', '+']; '42px': ['41px', '43px', '42px', 42, '-42px', RawMap['41px'][5] | '42px', '+']; '43px': ['42px', '44px', '43px', 43, '-43px', RawMap['42px'][5] | '43px', '+']; '44px': ['43px', '45px', '44px', 44, '-44px', RawMap['43px'][5] | '44px', '+']; '45px': ['44px', '46px', '45px', 45, '-45px', RawMap['44px'][5] | '45px', '+']; '46px': ['45px', '47px', '46px', 46, '-46px', RawMap['45px'][5] | '46px', '+']; '47px': ['46px', '48px', '47px', 47, '-47px', RawMap['46px'][5] | '47px', '+']; '48px': ['47px', '49px', '48px', 48, '-48px', RawMap['47px'][5] | '48px', '+']; '49px': ['48px', '50px', '49px', 49, '-49px', RawMap['48px'][5] | '49px', '+']; '50px': ['49px', '51px', '50px', 50, '-50px', RawMap['49px'][5] | '50px', '+']; '51px': ['50px', '52px', '51px', 51, '-51px', RawMap['50px'][5] | '51px', '+']; '52px': ['51px', '53px', '52px', 52, '-52px', RawMap['51px'][5] | '52px', '+']; '53px': ['52px', '54px', '53px', 53, '-53px', RawMap['52px'][5] | '53px', '+']; '54px': ['53px', '55px', '54px', 54, '-54px', RawMap['53px'][5] | '54px', '+']; '55px': ['54px', '56px', '55px', 55, '-55px', RawMap['54px'][5] | '55px', '+']; '56px': ['55px', '57px', '56px', 56, '-56px', RawMap['55px'][5] | '56px', '+']; '57px': ['56px', '58px', '57px', 57, '-57px', RawMap['56px'][5] | '57px', '+']; '58px': ['57px', '59px', '58px', 58, '-58px', RawMap['57px'][5] | '58px', '+']; '59px': ['58px', '60px', '59px', 59, '-59px', RawMap['58px'][5] | '59px', '+']; '60px': ['59px', '61px', '60px', 60, '-60px', RawMap['59px'][5] | '60px', '+']; '61px': ['60px', '62px', '61px', 61, '-61px', RawMap['60px'][5] | '61px', '+']; '62px': ['61px', '63px', '62px', 62, '-62px', RawMap['61px'][5] | '62px', '+']; '63px': ['62px', '64px', '63px', 63, '-63px', RawMap['62px'][5] | '63px', '+']; '64px': ['63px', '65px', '64px', 64, '-64px', RawMap['63px'][5] | '64px', '+']; '65px': ['64px', '66px', '65px', 65, '-65px', RawMap['64px'][5] | '65px', '+']; '66px': ['65px', '67px', '66px', 66, '-66px', RawMap['65px'][5] | '66px', '+']; '67px': ['66px', '68px', '67px', 67, '-67px', RawMap['66px'][5] | '67px', '+']; '68px': ['67px', '69px', '68px', 68, '-68px', RawMap['67px'][5] | '68px', '+']; '69px': ['68px', '70px', '69px', 69, '-69px', RawMap['68px'][5] | '69px', '+']; '70px': ['69px', '71px', '70px', 70, '-70px', RawMap['69px'][5] | '70px', '+']; '71px': ['70px', '72px', '71px', 71, '-71px', RawMap['70px'][5] | '71px', '+']; '72px': ['71px', '73px', '72px', 72, '-72px', RawMap['71px'][5] | '72px', '+']; '73px': ['72px', '74px', '73px', 73, '-73px', RawMap['72px'][5] | '73px', '+']; '74px': ['73px', '75px', '74px', 74, '-74px', RawMap['73px'][5] | '74px', '+']; '75px': ['74px', '76px', '75px', 75, '-75px', RawMap['74px'][5] | '75px', '+']; '76px': ['75px', '77px', '76px', 76, '-76px', RawMap['75px'][5] | '76px', '+']; '77px': ['76px', '78px', '77px', 77, '-77px', RawMap['76px'][5] | '77px', '+']; '78px': ['77px', '79px', '78px', 78, '-78px', RawMap['77px'][5] | '78px', '+']; '79px': ['78px', '80px', '79px', 79, '-79px', RawMap['78px'][5] | '79px', '+']; '80px': ['79px', '81px', '80px', 80, '-80px', RawMap['79px'][5] | '80px', '+']; '81px': ['80px', '82px', '81px', 81, '-81px', RawMap['80px'][5] | '81px', '+']; '82px': ['81px', '83px', '82px', 82, '-82px', RawMap['81px'][5] | '82px', '+']; '83px': ['82px', '84px', '83px', 83, '-83px', RawMap['82px'][5] | '83px', '+']; '84px': ['83px', '85px', '84px', 84, '-84px', RawMap['83px'][5] | '84px', '+']; '85px': ['84px', '86px', '85px', 85, '-85px', RawMap['84px'][5] | '85px', '+']; '86px': ['85px', '87px', '86px', 86, '-86px', RawMap['85px'][5] | '86px', '+']; '87px': ['86px', '88px', '87px', 87, '-87px', RawMap['86px'][5] | '87px', '+']; '88px': ['87px', '89px', '88px', 88, '-88px', RawMap['87px'][5] | '88px', '+']; '89px': ['88px', '90px', '89px', 89, '-89px', RawMap['88px'][5] | '89px', '+']; '90px': ['89px', '91px', '90px', 90, '-90px', RawMap['89px'][5] | '90px', '+']; '91px': ['90px', '92px', '91px', 91, '-91px', RawMap['90px'][5] | '91px', '+']; '92px': ['91px', '93px', '92px', 92, '-92px', RawMap['91px'][5] | '92px', '+']; '93px': ['92px', '94px', '93px', 93, '-93px', RawMap['92px'][5] | '93px', '+']; '94px': ['93px', '95px', '94px', 94, '-94px', RawMap['93px'][5] | '94px', '+']; '95px': ['94px', '96px', '95px', 95, '-95px', RawMap['94px'][5] | '95px', '+']; '96px': ['95px', '97px', '96px', 96, '-96px', RawMap['95px'][5] | '96px', '+']; '97px': ['96px', '98px', '97px', 97, '-97px', RawMap['96px'][5] | '97px', '+']; '98px': ['97px', '99px', '98px', 98, '-98px', RawMap['97px'][5] | '98px', '+']; '99px': ['98px', '100px', '99px', 99, '-99px', RawMap['98px'][5] | '99px', '+']; '100px': ['99px', '__', '100px', 100, '-100px', RawMap['99px'][5] | '100px', '+']; }; /** * @hidden */ type MapKeys = { '-': '-100px' | '-99px' | '-98px' | '-97px' | '-96px' | '-95px' | '-94px' | '-93px' | '-92px' | '-91px' | '-90px' | '-89px' | '-88px' | '-87px' | '-86px' | '-85px' | '-84px' | '-83px' | '-82px' | '-81px' | '-80px' | '-79px' | '-78px' | '-77px' | '-76px' | '-75px' | '-74px' | '-73px' | '-72px' | '-71px' | '-70px' | '-69px' | '-68px' | '-67px' | '-66px' | '-65px' | '-64px' | '-63px' | '-62px' | '-61px' | '-60px' | '-59px' | '-58px' | '-57px' | '-56px' | '-55px' | '-54px' | '-53px' | '-52px' | '-51px' | '-50px' | '-49px' | '-48px' | '-47px' | '-46px' | '-45px' | '-44px' | '-43px' | '-42px' | '-41px' | '-40px' | '-39px' | '-38px' | '-37px' | '-36px' | '-35px' | '-34px' | '-33px' | '-32px' | '-31px' | '-30px' | '-29px' | '-28px' | '-27px' | '-26px' | '-25px' | '-24px' | '-23px' | '-22px' | '-21px' | '-20px' | '-19px' | '-18px' | '-17px' | '-16px' | '-15px' | '-14px' | '-13px' | '-12px' | '-11px' | '-10px' | '-9px' | '-8px' | '-7px' | '-6px' | '-5px' | '-4px' | '-3px' | '-2px' | '-1px'; '0': '0px'; '+': '1px' | '2px' | '3px' | '4px' | '5px' | '6px' | '7px' | '8px' | '9px' | '10px' | '11px' | '12px' | '13px' | '14px' | '15px' | '16px' | '17px' | '18px' | '19px' | '20px' | '21px' | '22px' | '23px' | '24px' | '25px' | '26px' | '27px' | '28px' | '29px' | '30px' | '31px' | '32px' | '33px' | '34px' | '35px' | '36px' | '37px' | '38px' | '39px' | '40px' | '41px' | '42px' | '43px' | '44px' | '45px' | '46px' | '47px' | '48px' | '49px' | '50px' | '51px' | '52px' | '53px' | '54px' | '55px' | '56px' | '57px' | '58px' | '59px' | '60px' | '61px' | '62px' | '63px' | '64px' | '65px' | '66px' | '67px' | '68px' | '69px' | '70px' | '71px' | '72px' | '73px' | '74px' | '75px' | '76px' | '77px' | '78px' | '79px' | '80px' | '81px' | '82px' | '83px' | '84px' | '85px' | '86px' | '87px' | '88px' | '89px' | '90px' | '91px' | '92px' | '93px' | '94px' | '95px' | '96px' | '97px' | '98px' | '99px' | '100px'; }; /** Describes a map of pixel relationships */ export type PixelMap = CreateMap; } declare module "Iteration/Maps/_api" { /** @ignore */ /** */ export { NumberMap as Number } from "Iteration/Maps/Number"; export { PixelMap as Pixel } from "Iteration/Maps/Pixel"; } declare module "Iteration/_api" { /** @ignore */ /** */ import * as Maps from "Iteration/Maps/_api"; export { Maps }; export { Format } from "Iteration/Format"; export { Iteration } from "Iteration/Iteration"; export { IterationOf } from "Iteration/IterationOf"; export { Key } from "Iteration/Key"; export { Next } from "Iteration/Next"; export { Pos } from "Iteration/Pos"; export { Prev } from "Iteration/Prev"; } declare module "Misc/JSON/Primitive" { /** Basic JSON Value */ export type Primitive = string | number | boolean | null; } declare module "Misc/JSON/Object" { import { Value } from "Misc/JSON/Value"; /** An object of JSON [[Value]]s */ export interface Object { [k: string]: Value; } } declare module "Misc/JSON/Value" { import { Primitive } from "Misc/JSON/Primitive"; import { List } from "Misc/JSON/Array"; import { Object } from "Misc/JSON/Object"; /** Any JSON data/value */ export type Value = Primitive | Object | List; } declare module "Misc/JSON/Array" { import { Value } from "Misc/JSON/Value"; /** A list of JSON [[Value]]s */ export interface List extends Array { } } declare module "Misc/JSON/_api" { /** @ignore */ /** */ export { List as Array } from "Misc/JSON/Array"; export { Object } from "Misc/JSON/Object"; export { Primitive } from "Misc/JSON/Primitive"; export { Value } from "Misc/JSON/Value"; } declare module "Misc/Primitive" { /** * All primitive types */ export type Primitive = boolean | string | number | bigint | symbol | undefined | null; } declare module "Misc/_api" { /** @ignore */ /** */ import * as JSON from "Misc/JSON/_api"; export { JSON }; export { BuiltInObject } from "Misc/BuiltInObject"; export { Primitive } from "Misc/Primitive"; import * as Iteration from "Iteration/Maps/_api"; export { Iteration }; export { Promisable } from "Any/Promisable"; } declare module "Number/IsNegative" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _IsNegative = { '-': 1; '+': 0; '0': 0; }[N[6]]; /** Check whether a [[Number]] is negative or not @param N to check @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.IsNegative<'0'> // False type test1 = N.IsNegative<'-7'> // True type test2 = N.IsNegative<'7'> // False ``` */ export type IsNegative = _IsNegative>; } declare module "Number/Minus" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Prev } from "Iteration/Prev"; import { Next } from "Iteration/Next"; import { _IsNegative } from "Number/IsNegative"; import { Cast } from "Any/Cast"; import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ type _MinusPositive = { 0: _MinusPositive, Prev, IMap>; 1: N1; 2: N2; }[Pos extends 0 ? 1 : number extends Pos ? 2 : 0]; /** @hidden */ type MinusPositive = _MinusPositive extends infer X ? Cast : never; /** @hidden */ type _MinusNegative = { 0: _MinusNegative, Next, IMap>; 1: N1; 2: N2; }[Pos extends 0 ? 1 : number extends Pos ? 2 : 0]; /** @hidden */ type MinusNegative = _MinusNegative extends infer X ? Cast : never; /** @hidden */ export type _Minus = { 0: MinusPositive; 1: MinusNegative; }[_IsNegative]; /** @hidden */ export type __Minus = Format<_Minus, IterationOf, IMap>, fmt>; /** Subtract a [[Number]] from another one @param N1 Left-hand side @param N2 Right-hand side @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Minus<'2', '10'> // '-8' type test1 = N.Minus<'0', '40'> // '-40' type test2 = N.Minus<'0', '40', 's'> // '-40' type test3 = N.Minus<'0', '40', 'n'> // -40 type test4 = N.Minus<'-20', '40', 's'> // string type test5 = N.Minus<'-20', '40', 'n'> // number ``` */ export type Minus = N1 extends unknown ? N2 extends unknown ? __Minus : never : never; } declare module "Number/Negate" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _Negate = IterationOf; /** Negate a [[Number]] @param N to negate @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Negate<'-10'> // '10' type test1 = N.Negate<'10'> // '-10' type test2 = N.Negate<'10', 's'> // '-10' type test3 = N.Negate<'10', 'n'> // -10 type test4 = N.Negate<'-100'> // string ``` */ export type Negate = N extends unknown ? Format<_Negate, IMap>, fmt> : never; } declare module "Number/Absolute" { import { _Negate } from "Number/Negate"; import { _IsNegative } from "Number/IsNegative"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _Absolute = { 0: N; 1: _Negate; }[_IsNegative]; /** Get the absolute value of a [[Number]] @param N to absolute @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Absolute<'-20'> // '20' type test1 = N.Absolute<'-20', 's'> // '20' type test2 = N.Absolute<'-20', 'n'> // 20 ``` */ export type Absolute = N extends unknown ? Format<_Absolute, IMap>, fmt> : never; } declare module "Number/IsZero" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _IsZero = { '-': 0; '+': 0; '0': 1; }[N[6]]; /** Check whether a [[Number]] is null or not @param N to check @param IMap to operate with another set of numbers @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.IsZero<'0'> // True type test1 = N.IsZero<'-7'> // False type test2 = N.IsZero<'7'> // False ``` */ export type IsZero = _IsZero>; } declare module "Number/Format" { import { Formats } from "Number/_Internal"; import { Number } from "Number/Number"; import { IsZero } from "Number/IsZero"; import { Not } from "Boolean/Not"; import { Pos } from "Iteration/Pos"; import { IterationOf } from "Iteration/IterationOf"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** Change the format of a [[Number]] @param B to transform @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Format<'30', 'b'> // True type test1 = N.Format<'30', 'n'> // 30 ``` */ export type Format = { 'b': Not>; 'n': Pos>; 's': N; }[fmt]; } declare module "Number/IsPositive" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _IsPositive = { '-': 0; '+': 1; '0': 0; }[N[6]]; /** Check whether a [[Number]] is positive or not @param N to check @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.IsPositive<'0'> // False type test1 = N.IsPositive<'-7'> // False type test2 = N.IsPositive<'7'> // True ``` */ export type IsPositive = _IsPositive>; } declare module "Number/Greater" { import { _Minus } from "Number/Minus"; import { _IsPositive } from "Number/IsPositive"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _Greater = _IsPositive<_Minus>; /** Check if a [[Number]] is bigger than another one @param N1 to compare @param N2 to compare to @param IMap to operate with another set of numbers @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Greater<'7', '5'> // True type test1 = N.Greater<'5', '5'> // False type test2 = N.Greater<'5', '7'> // False ``` */ export type Greater = N1 extends unknown ? N2 extends unknown ? _Greater, IterationOf, IMap> : never : never; } declare module "Number/GreaterEq" { import { Equals } from "Any/Equals"; import { _Greater } from "Number/Greater"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { Or } from "Boolean/Or"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _GreaterEq = Or, _Greater>; /** Check if a [[Number]] is greater or equal to another one @param N1 to compare @param N2 to compare to @param IMap to operate with another set of numbers @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.GreaterEq<'7', '5'> // True type test1 = N.GreaterEq<'5', '5'> // True type test2 = N.GreaterEq<'5', '7'> // False ``` */ export type GreaterEq = N1 extends unknown ? N2 extends unknown ? _GreaterEq, IterationOf, IMap> : never : never; } declare module "Number/Lower" { import { _Greater } from "Number/Greater"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ export type _Lower = _Greater; /** Check if a [[Number]] is lower than another one @param N1 to compare @param N2 to compare to @param IMap to operate with another set of numbers @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Lower<'7', '5'> // False type test1 = N.Lower<'5', '5'> // False type test2 = N.Lower<'5', '7'> // True ``` */ export type Lower = N1 extends unknown ? N2 extends unknown ? _Lower, IterationOf, IMap> : never : never; } declare module "Number/LowerEq" { import { GreaterEq } from "Number/GreaterEq"; import { Number } from "Number/Number"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** Check if a [[Number]] is lower or equal to another one @param N1 to compare @param N2 to compare to @param IMap to operate with another set of numbers @returns [[Boolean]] @example ```ts import {N} from 'ts-toolbelt' type test0 = N.LowerEq<'7', '5'> // False type test1 = N.LowerEq<'5', '5'> // True type test2 = N.LowerEq<'5', '7'> // True ``` */ export type LowerEq = GreaterEq; } declare module "Number/Max" { import { IterationOf } from "Iteration/IterationOf"; import { KnownIterationMapKeys } from "Number/_Internal"; import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; import { Equals } from "Any/Equals"; /** * @hidden */ type UnionizeCumulatedNumberUnions = { [K in keyof IMap[1]]: K extends N ? IMap[1][K][5] : never; }[KnownIterationMapKeys]; /** * @hidden */ type FindMaxNumberInUnion = UnionizeCumulatedNumberUnions extends infer Match ? { [K in keyof IMap[1]]: Equals extends 1 ? K : never; }[KnownIterationMapKeys] : never; /** Get the biggest [[Number]] within an [[Union]] @param N [[Union]] @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Max<'-2' | '10' | '3'> // '10' type test1 = N.Max<'-2' | '10' | '3', 's'> // '10' type test2 = N.Max<'-2' | '10' | '3', 'n'> // 10 type test3 = N.Min<'-2' | '10' | 'oops'> // string ``` */ export type Max = Format, IMap>, fmt>; } declare module "Number/Min" { import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; import { Negate } from "Number/Negate"; import { Max } from "Number/Max"; /** Get the smallest [[Number]] within an [[Union]] @param N [[Union]] @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Min<'-2' | '10' | '3'> // '-2' type test1 = N.Min<'-2' | '10' | '3', 's'> // '-2' type test2 = N.Min<'-2' | '10' | '3', 'n'> // -2 type test3 = N.Min<'-2' | '10' | 'oops'> // string ``` */ export type Min = Negate, 's', IMap>, fmt, IMap>; } declare module "Number/Plus" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Prev } from "Iteration/Prev"; import { Next } from "Iteration/Next"; import { _IsNegative } from "Number/IsNegative"; import { Cast } from "Any/Cast"; import { Number } from "Number/Number"; import { Formats } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ type _PlusPositive = { 0: _PlusPositive, Prev, IMap>; 1: N1; 2: number; }[Pos extends 0 ? 1 : number extends Pos ? 2 : 0]; /** @hidden */ type PlusPositive = _PlusPositive extends infer X ? Cast : never; /** @hidden */ type _PlusNegative = { 0: _PlusNegative, Next, IMap>; 1: N1; 2: number; }[Pos extends 0 ? 1 : number extends Pos ? 2 : 0]; /** @hidden */ type PlusNegative = _PlusNegative extends infer X ? Cast : never; /** @hidden */ export type _Plus = { 0: PlusPositive; 1: PlusNegative; }[_IsNegative]; /** @hidden */ export type __Plus = Format<_Plus, IterationOf, IMap>, fmt>; /** Add a [[Number]] to another one @param N1 Left-hand side @param N2 Right-hand side @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string | number | boolean`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Plus<'2', '10'> // '12' type test1 = N.Plus<'0', '40'> // '40' type test2 = N.Plus<'0', '40', 's'> // '40' type test3 = N.Plus<'0', '40', 'n'> // 40 type test4 = N.Plus<'-20', '40', 's'> // '20' type test5 = N.Plus<'-20', '40', 'n'> // 20 ``` */ export type Plus = N1 extends unknown ? N2 extends unknown ? __Plus : never : never; } declare module "Number/Range" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Prepend } from "List/Prepend"; import { Prev } from "Iteration/Prev"; import { Next } from "Iteration/Next"; import { Number } from "Number/Number"; import { Cast } from "Any/Cast"; import { Formats } from "Iteration/_Internal"; import { Way } from "Iteration/_Internal"; import { Format } from "Iteration/Format"; import { List } from "List/List"; import { Extends } from "Any/Extends"; import { NumberMap } from "Iteration/Maps/Number"; import { Map } from "Iteration/Map"; /** @hidden */ type RangeForth = { 0: RangeForth, To, IMap, fmt, Prepend>>; 1: L; }[Extends]; /** @hidden */ type RangeBack = { 0: RangeBack, To, IMap, fmt, Prepend>>; 1: L; }[Extends]; /** @hidden */ type __Range = { '->': RangeForth, IMap, fmt>; '<-': RangeBack, IMap, fmt>; }[way]; /** @hidden */ export type _Range = __Range, IterationOf, way, fmt, IMap> extends infer X ? Cast : never; /** Create a range of **number**s @param From to start with @param To to end with @param way (?=`'->'`) to reverse it @param fmt (?=`'s'`) output format @param IMap to operate with another set of numbers @returns **`string[] | number[] | boolean[]`** @example ```ts import {N} from 'ts-toolbelt' type test0 = N.Range<'-2', '1'> // ['-2', '-1', '0', '1'] type test1 = N.Range<'-2', '1', '->'> // ['-2', '-1', '0', '1'] type test2 = N.Range<'-2', '1', '<-'> // ['1', '0', '-1', '-2'] type test3 = N.Range<'-2', '1', '<-', 's'> // ['1', '0', '-1', '-2'] type test4 = N.Range<'-2', '1', '->', 'n'> // [-2 , -1 , 0 , 1 ] ``` */ export type Range = From extends unknown ? To extends unknown ? _Range : never : never; } declare module "Number/_api" { /** @ignore */ /** */ export { Absolute } from "Number/Absolute"; export { Format } from "Number/Format"; export { Greater } from "Number/Greater"; export { GreaterEq } from "Number/GreaterEq"; export { IsNegative } from "Number/IsNegative"; export { IsPositive } from "Number/IsPositive"; export { IsZero } from "Number/IsZero"; export { Lower } from "Number/Lower"; export { LowerEq } from "Number/LowerEq"; export { Max } from "Number/Max"; export { Min } from "Number/Min"; export { Minus } from "Number/Minus"; export { Negate } from "Number/Negate"; export { NumberOf } from "Number/NumberOf"; export { Plus } from "Number/Plus"; export { Range } from "Number/Range"; } declare module "Object/OptionalKeys" { /** @hidden */ export type _OptionalKeys = { [K in keyof O]-?: {} extends Pick ? K : never; }[keyof O]; /** Get the keys of **`O`** that are optional @param O @returns [[Key]] @example ```ts ``` */ export type OptionalKeys = O extends unknown ? _OptionalKeys : never; } declare module "Object/Merge" { import { AtBasic } from "Object/At"; import { _OptionalKeys } from "Object/OptionalKeys"; import { Key } from "Any/Key"; import { _ListOf } from "Object/ListOf"; import { List } from "List/List"; import { Depth, Anyfy, MergeStyle } from "Object/_Internal"; import { NonNullable } from "Union/NonNullable"; import { BuiltInObject } from "Misc/BuiltInObject"; import { ObjectOf } from "List/ObjectOf"; /** @hidden */ type LibStyle = { 0: [O] extends [List] ? [O1] extends [List] ? _ListOf : O : Merged; 1: Merged; 2: [O] extends [List] ? [O1] extends [List] ? Merged[keyof Merged][] : O : Merged; }[style]; /** @hidden */ type MergeProp = K extends OOK ? NonNullable | O1K : [OK] extends [never] ? O1K : { 0: OK extends undefined ? O1K : OK; 1: OK; 2: OK extends undefined ? O1K : OK; }[style]; /** @hidden */ type __MergeFlat> = { [K in keyof (Anyfy & O1)]: MergeProp, AtBasic, K, OOK, style>; } & {}; /** @hidden */ export type _MergeFlat = LibStyle<__MergeFlat, ObjectOf, style>, O, O1, style>; /** @hidden */ export type MergeFlat = O extends noMerge ? O : O1 extends noMerge ? O : _MergeFlat; /** @hidden */ type __MergeDeep> = { [K in keyof (Anyfy & O1)]: _MergeDeep, AtBasic, K, OOK, style, noMerge>; }; /** @hidden */ type ChooseMergeDeep = OK extends noMerge ? MergeProp : O1K extends noMerge ? MergeProp : OK extends object ? O1K extends object ? __MergeDeep, ObjectOf, style, noMerge> : MergeProp : MergeProp; /** @hidden */ export type _MergeDeep = [ O ] extends [never] ? MergeProp : [O1] extends [never] ? MergeProp : LibStyle, O, O1, style>; /** @hidden */ export type MergeDeep = O extends unknown ? O1 extends unknown ? _MergeDeep : never : never; /** Accurately merge the fields of **`O`** with the ones of **`O1`**. It is equivalent to the spread operator in JavaScript. [[Union]]s and [[Optional]] fields will be handled gracefully. (⚠️ needs `--strictNullChecks` enabled) @param O to complete @param O1 to copy from @param depth (?=`'flat'`) to do it deeply @param style (?=`1`) 0 = lodash, 1 = ramda @param noMerge (?=`BuiltinObject`) types not to merge @returns [[Object]] @example ```ts import {O} from 'ts-toolbelt' type O = { name?: string age? : number zip? : string pay : { cvv?: number } } type O1 = { age : number zip?: number city: string pay : { cvv : number ccn?: string } } type test = O.Merge // { // name?: string; // age: number; // zip?: string | number; // pay: { // cvv: number; // ccn?: string; // }; // city: string; // } ``` */ export type Merge = { 'flat': MergeFlat; 'deep': MergeDeep; }[depth]; } declare module "Object/P/Merge" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { Merge as OMerge } from "Object/Merge"; import { Length } from "List/Length"; import { List } from "List/List"; import { Depth } from "Object/_Internal"; import { Boolean } from "Boolean/Boolean"; /** @hidden */ type MergeObject, O1 extends object, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? Pos extends Length ? OMerge : { [K in keyof O]: K extends Path[Pos] ? MergeObject> : O[K]; } & {} : O; /** @hidden */ type MergeList, O1 extends object, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? MergeList[] : Pos extends Length ? OMerge : { [K in keyof O]: K extends Path[Pos] ? MergeList> : O[K]; } & {} : O; /** Complete the fields of **`O`** at **`Path`** with the ones of **`O1`** @param O to complete @param Path to be followed @param O1 to copy from @param depth (?=`'flat'`) to do it deeply @param list (?=`0`) `1` to work within object lists @returns [[Object]] @example ```ts ``` */ export type Merge, O1 extends object, depth extends Depth = 'flat', list extends Boolean = 0> = { 0: MergeObject; 1: MergeList; }[list]; } declare module "List/LastIndex" { import { Length } from "List/Length"; import { Formats } from "Iteration/_Internal"; import { Tail } from "List/Tail"; import { List } from "List/List"; /** Get the last index of **`L`** @param L to get from @param fmt (?=`'n'`) output format @returns [[String]] or **`number`** @example ```ts ``` */ export type LastIndex = Length, fmt>; } declare module "Object/P/Omit" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { _Omit as _OOmit } from "Object/Omit"; import { LastIndex } from "List/LastIndex"; import { List } from "List/List"; import { Boolean } from "Boolean/Boolean"; /** @hidden */ type OmitObject, I extends Iteration = IterationOf<'0'>> = O extends object ? Pos extends LastIndex ? _OOmit]> : { [K in keyof O]: K extends Path[Pos] ? OmitObject> : O[K]; } & {} : O; /** @hidden */ type OmitList, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? OmitList[] : Pos extends LastIndex ? _OOmit]> : { [K in keyof O]: K extends Path[Pos] ? OmitList> : O[K]; } & {} : O; /** Remove out of **`O`** the fields at **`Path`** @param O to remove from @param Path to be followed @param list (?=`0`) `1` to work within object lists @returns [[Object]] @example ```ts ``` */ export type Omit, list extends Boolean = 0> = { 0: OmitObject; 1: OmitList; }[list]; } declare module "Object/P/Pick" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { _Pick as _OPick } from "Object/Pick"; import { LastIndex } from "List/LastIndex"; import { List } from "List/List"; import { Boolean } from "Boolean/Boolean"; /** @hidden */ type PickObject, I extends Iteration = IterationOf<'0'>> = O extends object ? _OPick]> extends infer Picked ? Pos extends LastIndex ? Picked : { [K in keyof Picked]: PickObject>; } & {} : never : O; /** @hidden */ type PickList, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? PickList[] : _OPick]> extends infer Picked ? Pos extends LastIndex ? Picked : { [K in keyof Picked]: PickList>; } & {} : never : O; /** Extract out of **`O`** the fields at **`Path`** @param O to extract from @param Path to be followed @param list (?=`0`) `1` to work within object lists @returns [[Object]] @example ```ts ``` */ export type Pick, list extends Boolean = 0> = { 0: PickObject; 1: PickList; }[list]; } declare module "Object/Readonly" { import { _Pick } from "Object/Pick"; import { Depth } from "Object/_Internal"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type ReadonlyFlat = { +readonly [K in keyof O]: O[K]; } & {}; /** @hidden */ export type ReadonlyDeep = { +readonly [K in keyof O]: O[K] extends BuiltInObject ? O[K] : ReadonlyDeep; }; /** @hidden */ export type ReadonlyPart = { 'flat': ReadonlyFlat; 'deep': ReadonlyDeep; }[depth]; /** * @hidden */ export type _Readonly = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** readonly (deeply or not) @param O to make readonly @param K (?=`Key`) to choose fields @param depth (?=`'default'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Readonly = O extends unknown ? _Readonly : never; } declare module "Object/P/Readonly" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { Readonly as OReadonly } from "Object/Readonly"; import { LastIndex } from "List/LastIndex"; import { List } from "List/List"; import { Depth } from "Object/_Internal"; import { Boolean } from "Boolean/Boolean"; /** @hidden */ type ReadonlyObject, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? Pos extends LastIndex ? OReadonly], depth> : { [K in keyof O]: K extends Path[Pos] ? ReadonlyObject> : O[K]; } & {} : O; /** @hidden */ type ReadonlyArrays, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? ReadonlyArrays[] : Pos extends LastIndex ? OReadonly], depth> : { [K in keyof O]: K extends Path[Pos] ? ReadonlyArrays> : O[K]; } & {} : O; /** Make some fields of **`O`** readonly at **`Path`** (deeply or not) @param O to make readonly @param Path to be followed @param depth (?=`'flat'`) to do it deeply @param list (?=`0`) `1` to work within object lists @returns [[Object]] @example ```ts ``` */ export type Readonly, depth extends Depth = 'flat', list extends Boolean = 0> = { 0: ReadonlyObject; 1: ReadonlyArrays; }[list]; } declare module "Object/Record" { import { Modx } from "Object/_Internal"; import { Key } from "Any/Key"; /** Create an object filled with **`A`** for the fields **`K`** @param K to choose fields @param A to fill fields with @param modx (?=`['!', 'W']`) to set modifiers @returns [[Object]] @example ```ts ``` */ export type Record = { '!': { 'R': { readonly [P in K]: A; }; 'W': { [P in K]: A; }; }; '?': { 'R': { readonly [P in K]?: A; }; 'W': { [P in K]?: A; }; }; }[modx[0]][modx[1]]; } declare module "Object/P/Update" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { LastIndex } from "List/LastIndex"; import { List } from "List/List"; import { Record } from "Object/Record"; import { Patch } from "Object/Patch"; /** @hidden */ type _Update, A, I extends Iteration = IterationOf<'0'>> = O extends object ? Pos extends LastIndex ? Patch], A>, O> : (O & Record], keyof O>, {}>) extends infer O ? { [K in keyof O]: K extends Path[Pos] ? _Update> : O[K]; } & {} : never : O; /** Update in **`O`** the fields at **`Path`** with **`A`** @param O to update @param Path to be followed @param A to update with @returns [[Object]] @example ```ts ``` */ export type Update, A extends any> = _Update; } declare module "Object/P/Record" { import { Modx } from "Object/_Internal"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Key } from "Any/Key"; import { LastIndex } from "List/LastIndex"; import { List } from "List/List"; /** @hidden */ type _Record_RR, A, I extends Iteration = IterationOf<'0'>> = { readonly [Key in Path[Pos]]: Pos extends LastIndex ? A : _Record_RR>; } & {}; /** @hidden */ export type _Record_RW, A, I extends Iteration = IterationOf<'0'>> = { [Key in Path[Pos]]: Pos extends LastIndex ? A : _Record_RW>; } & {}; /** @hidden */ type _Record_OR, A, I extends Iteration = IterationOf<'0'>> = { readonly [Key in Path[Pos]]?: Pos extends LastIndex ? A : _Record_OR>; } & {}; /** @hidden */ type _Record_OW, A, I extends Iteration = IterationOf<'0'>> = { [Key in Path[Pos]]?: Pos extends LastIndex ? A : _Record_OW>; } & {}; /** Create an object filled with **`A`** for the fields at the end of **`Path`** @param Path to choose fields @param A to fill fields with @param modx (?=`['!', 'W']`) to set modifiers @returns [[Object]] @example ```ts ``` */ export type Record, A, modx extends Modx = ['!', 'W']> = { '!': { 'R': _Record_RR; 'W': _Record_RW; }; '?': { 'R': _Record_OR; 'W': _Record_OW; }; }[modx[0]][modx[1]]; } declare module "Object/P/_api" { /** @ignore */ /** */ export { Merge } from "Object/P/Merge"; export { Omit } from "Object/P/Omit"; export { Pick } from "Object/P/Pick"; export { Readonly } from "Object/P/Readonly"; export { Update } from "Object/P/Update"; export { Record } from "Object/P/Record"; } declare module "Object/Assign" { import { Iteration } from "Iteration/Iteration"; import { IterationOf } from "Iteration/IterationOf"; import { Merge } from "Object/Merge"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Length } from "List/Length"; import { Cast } from "Any/Cast"; import { List } from "List/List"; import { Extends } from "Any/Extends"; import { Depth, MergeStyle } from "Object/_Internal"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ type __Assign, depth extends Depth, style extends MergeStyle, noMerge extends any, I extends Iteration = IterationOf<'0'>> = { 0: __Assign], O, depth, style, noMerge>, Os, depth, style, noMerge, Next>; 1: O; }[Extends, Length>]; /** @hidden */ export type _Assign, depth extends Depth, style extends MergeStyle, noMerge extends any> = __Assign extends infer X ? Cast : never; /** Assign a list of [[Object]] into **`O`** with [[Merge]]. Merges from right to left, first items get overridden by the next ones (last-in overrides). @param O to assign to @param Os to assign @param depth (?=`'flat'`) to do it deeply @param style (?=`1`) 0 = lodash, 1 = ramda @param noMerge (?=`BuiltinObject`) types not to merge @returns [[Object]] @example ```ts ``` */ export type Assign, depth extends Depth = 'flat', style extends MergeStyle = 2, noMerge extends any = BuiltInObject> = O extends unknown ? Os extends unknown ? _Assign : never : never; } declare module "Union/Keys" { import { Union } from "Union/Union"; /** Get the keys of a [[Union]] @param U @returns [[Key]] @example ```ts ``` */ export type Keys = U extends unknown ? keyof U : never; } declare module "Object/Keys" { import { Keys as UKeys } from "Union/Keys"; /** Get the keys of an [[Object]] @param O @returns [[Key]] @example ```ts ``` */ export type Keys = UKeys; } declare module "Object/Required" { import { _Pick } from "Object/Pick"; import { Depth } from "Object/_Internal"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type RequiredFlat = { [K in keyof O]-?: O[K]; } & {}; /** @hidden */ export type RequiredDeep = { [K in keyof O]-?: O[K] extends BuiltInObject ? O[K] : RequiredDeep; }; /** @hidden */ export type RequiredPart = { 'flat': RequiredFlat; 'deep': RequiredDeep; }[depth]; /** * @hidden */ export type _Required = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** required (deeply or not) @param O to make required @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Required = O extends unknown ? _Required : never; } declare module "Object/Optional" { import { _Pick } from "Object/Pick"; import { Depth } from "Object/_Internal"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type OptionalFlat = { [K in keyof O]?: O[K]; } & {}; /** @hidden */ export type OptionalDeep = { [K in keyof O]?: O[K] extends BuiltInObject ? O[K] : OptionalDeep; }; /** @hidden */ export type OptionalPart = { 'flat': OptionalFlat; 'deep': OptionalDeep; }[depth]; /** * @hidden */ export type _Optional = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** optional (deeply or not) @param O to make optional @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Optional = O extends unknown ? _Optional : never; } declare module "Object/AtLeast" { import { _Pick } from "Object/Pick"; import { Key } from "Any/Key"; import { Keys } from "Object/Keys"; import { RequiredFlat } from "Object/Required"; import { Extends } from "Any/Extends"; import { ComputeRaw } from "Any/Compute"; import { OptionalFlat } from "Object/Optional"; /** @hidden */ type RequiredIfKeys = Extends extends 1 ? RequiredFlat : O; /** @hidden */ type __AtLeast = K extends keyof O ? _Pick & OptionalFlat : O; /** @hidden */ type _AtLeast = ComputeRaw<__AtLeast, K>>; /** Make that at least one of the keys **`K`** are required in **`O`** at a time. @param O to make required @param K (?=`keyof O`) to choose fields @returns [[Object]] [[Union]] @example ```ts ``` */ export type AtLeast> = O extends unknown ? _AtLeast : never; } declare module "Object/Compulsory" { import { _Pick } from "Object/Pick"; import { Depth } from "Object/_Internal"; import { Key } from "Any/Key"; import { NonNullable } from "Union/NonNullable"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type CompulsoryFlat = { [K in keyof O]-?: NonNullable; } & {}; /** @hidden */ export type CompulsoryDeep = { [K in keyof O]-?: O[K] extends BuiltInObject ? O[K] : CompulsoryDeep>; }; /** @hidden */ export type CompulsoryPart = { 'flat': CompulsoryFlat; 'deep': CompulsoryDeep; }[depth]; /** * @hidden */ export type _Compulsory = _PatchFlat, depth>, O, 2>; /** Make that **`O`**'s fields cannot be [[Nullable]] or [[Optional]] (it's like [[Required]] & [[NonNullable]] at once). @param O to make compulsory @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Compulsory = O extends unknown ? _Compulsory : never; } declare module "Object/CompulsoryKeys" { /** @hidden */ export type _CompulsoryKeys = { [K in keyof O]-?: [O[K] & (undefined | null)] extends [never] ? K : never; }[keyof O]; /** Get the keys of **`O`** that are [[Compulsory]] (⚠️ needs `--strictNullChecks` enabled) @param O @returns [[Key]] @example ```ts ``` */ export type CompulsoryKeys = O extends unknown ? _CompulsoryKeys : never; } declare module "Object/ExcludeKeys" { import { Exclude } from "Union/Exclude"; import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; import { At } from "Object/At"; import { Keys } from "Object/Keys"; /** @hidden */ export type _ExcludeMatch = { [K in keyof O]-?: { 1: never; 0: K; }[Is, match>]; }[keyof O]; /** @hidden */ type ExcludeMatch = O extends unknown ? _ExcludeMatch : never; /** Exclude the keys of **`O1`** out of the keys of **`O`** (If `match = 'default'`, no type checks are done) @param O to remove the keys from @param O1 to remove the keys out @param match (?=`'default'`) to change precision @returns [[Key]] @example ```ts ``` */ export type ExcludeKeys = { 'default': Exclude, Keys>; 'contains->': ExcludeMatch'>; 'extends->': ExcludeMatch'>; 'implements->': ExcludeMatch'>; '<-contains': ExcludeMatch; '<-extends': ExcludeMatch; '<-implements': ExcludeMatch; 'equals': ExcludeMatch; }[match]; } declare module "Object/Exclude" { import { ExcludeKeys } from "Object/ExcludeKeys"; import { Match } from "Any/_Internal"; import { Pick } from "Object/Pick"; /** Exclude the fields of **`O1`** out of **`O`** (If `match = 'default'`, no type checks are done) @param O to remove from @param O1 to remove out @param match (?=`'default'`) to change precision @returns [[Object]] @example ```ts ``` */ export type Exclude = Pick>; } declare module "Object/Diff" { import { Exclude } from "Object/Exclude"; import { Match } from "Any/_Internal"; import { PatchFlat } from "Object/Patch"; /** Get an [[Object]] that is the difference between **`O`** & **`O1`** (**`O`**'s differences have priority over **`O1`**'s if fields overlap) (If `match = 'default'`, no type checks are done) @param O to check differences with @param O1 to check differences against @param match (?=`'default'`) to change precision @returns [[Object]] @example ```ts import {O} from 'ts-toolbelt' type Person0 = { name: string age: string } type Person1 = { name: string age: number | string nick: string } type test0 = O.Diff // {nick: string} type test1 = O.Diff'> // {nick: string; age: string | number} type test2 = O.Diff // {nick: string; age: string} type test3 = O.Diff // {nick: string; age: string} ``` */ export type Diff = PatchFlat, Exclude>; } declare module "Union/Strict" { import { ComputeRaw } from "Any/Compute"; import { Keys } from "Union/Keys"; import { OptionalFlat } from "Object/Optional"; import { Record } from "Object/Record"; /** @hidden */ type _Strict = U extends unknown ? U & OptionalFlat, keyof U>, never>> : never; /** Make a [[Union]] not allow excess properties (https://github.com/Microsoft/TypeScript/issues/20863) @param U to make strict @returns [[Union]] @example ```ts ``` */ export type Strict = ComputeRaw<_Strict>; } declare module "Object/Either" { import { _Omit } from "Object/Omit"; import { _Pick } from "Object/Pick"; import { Key } from "Any/Key"; import { Strict } from "Union/Strict"; import { Boolean } from "Boolean/Boolean"; import { ComputeRaw } from "Any/Compute"; /** @hidden */ type __Either = _Omit & ({ [P in K]: _Pick; }[K]); /** @hidden */ type EitherStrict = Strict<__Either>; /** @hidden */ type EitherLoose = ComputeRaw<__Either>; /** @hidden */ export type _Either = { 1: EitherStrict; 0: EitherLoose; }[strict]; /** Split **`O`** into a [[Union]] with **`K`** keys in such a way that none of the keys are ever present with one another within the different unions. @param O to split @param K to split with @param strict (?=`1`) to force excess property checks https://github.com/microsoft/TypeScript/issues/20863 @returns [[Object]] [[Union]] @example ```ts ``` */ export type Either = O extends unknown ? _Either : never; } declare module "Object/FilterKeys" { import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; /** @hidden */ export type _FilterKeys = { [K in keyof O]-?: { 1: never; 0: K; }[Is]; }[keyof O]; /** Filter out the keys of **`O`** which fields match **`M`** @param O to remove from @param M to select fields @param match (?=`'default'`) to change precision @returns [[Key]] @example ```ts ``` */ export type FilterKeys = O extends unknown ? _FilterKeys : never; } declare module "Object/Filter" { import { FilterKeys } from "Object/FilterKeys"; import { Match } from "Any/_Internal"; import { Pick } from "Object/Pick"; /** Filter out of **`O`** the fields that match **`M`** @param O to remove from @param M to select fields @param match (?=`'default'`) to change precision @returns [[Object]] @example ```ts ``` */ export type Filter = Pick>; } declare module "Object/Has" { import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; import { At } from "Object/At"; import { Key } from "Any/Key"; /** Check whether **`O`** has a field of key **`K`** that matches **`M`** @param O to be inspected @param K to choose field @param M (?=`any`) to check field type @param match (?=`'default'`) to change precision @returns [[Boolean]] @example ```ts ``` */ export type Has = Is, M, match>; } declare module "Object/Path" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Next } from "Iteration/Next"; import { Pos } from "Iteration/Pos"; import { Length } from "List/Length"; import { At } from "Object/At"; import { Cast } from "Any/Cast"; import { NonNullable } from "Union/NonNullable"; import { Key } from "Any/Key"; import { List } from "List/List"; import { Boolean } from "Boolean/Boolean"; import { Extends } from "Any/Extends"; /** @hidden */ type __Path, strict extends Boolean, I extends Iteration = IterationOf<'0'>> = { 0: __Path & {}, Path[Pos], strict>, Path, strict, Next>; 1: O; }[Extends, Length>]; /** @hidden */ export type _Path, strict extends Boolean> = __Path extends infer X ? Cast : never; /** Get in **`O`** the type of nested properties @param O to be inspected @param Path to be followed @param strict (?=`1`) `0` to work with unions @returns **`any`** @example ```ts ``` */ export type Path, strict extends Boolean = 1> = Path extends unknown ? _Path : never; } declare module "Object/HasPath" { import { Match } from "Any/_Internal"; import { Path as OPath } from "Object/Path"; import { Is } from "Any/Is"; import { Key } from "Any/Key"; import { List } from "List/List"; /** Check whether **`O`** has nested properties that match **`M`** @param O to be inspected @param Path to be followed @param M (?=`any`) to check field type @param match (?=`'default'`) to change precision @returns [[Boolean]] @example ```ts ``` */ export type HasPath, M extends any = any, match extends Match = 'default'> = Is, M, match>; } declare module "Object/SelectKeys" { import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; /** @hidden */ export type _SelectKeys = { [K in keyof O]-?: { 1: K; 0: never; }[Is]; }[keyof O]; /** Get the keys of **`O`** which fields match **`M`** @param O to extract from @param M to select fields @param match (?=`'default'`) to change precision @returns [[Key]] @example ```ts ``` */ export type SelectKeys = O extends unknown ? _SelectKeys : never; } declare module "Object/Includes" { import { SelectKeys } from "Object/SelectKeys"; import { Match } from "Any/_Internal"; /** Check whether **`O`** has fields that match **`M`** @param O to be inspected @param M to check field type @param match (?=`'default'`) to change precision @returns [[Boolean]] @example ```ts ``` */ export type Includes = [ SelectKeys ] extends [never] ? 0 : 1; } declare module "Union/Intersect" { import { Union } from "Union/Union"; /** Get the intersection of **`U1`** & **`U2`** @param U1 to check similarities with @param U2 to check similarities against @returns [[Union]] @example ```ts ``` */ export type Intersect = U1 & U2; } declare module "Object/IntersectKeys" { import { Intersect } from "Union/Intersect"; import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; import { At } from "Object/At"; import { Keys } from "Object/Keys"; /** @hidden */ export type _IntersectMatch = { [K in keyof O]-?: { 1: K; 0: never; }[Is, match>]; }[keyof O]; /** @hidden */ type IntersectMatch = O extends unknown ? _IntersectMatch : never; /** Get the intersecting keys of **`O`** & **`O1`** (If `match = 'default'`, no type checks are done) @param O to check similarities with @param O1 to check similarities against @returns [[Key]] @example ```ts ``` */ export type IntersectKeys = { 'default': Intersect, Keys>; 'contains->': IntersectMatch'>; 'extends->': IntersectMatch'>; 'implements->': IntersectMatch'>; '<-contains': IntersectMatch; '<-extends': IntersectMatch; '<-implements': IntersectMatch; 'equals': IntersectMatch; }[match]; } declare module "Object/Intersect" { import { IntersectKeys } from "Object/IntersectKeys"; import { Match } from "Any/_Internal"; import { Pick } from "Object/Pick"; /** Get the intersecting fields of **`O`** & **`O1`** (If `match = 'default'`, no type checks are done) @param O to check similarities with @param O1 to check similarities against @returns [[Object]] @example ```ts ``` */ export type Intersect = Pick>; } declare module "Object/Invert" { import { Record } from "Object/Record"; import { Key } from "Any/Key"; import { IntersectOf } from "Union/IntersectOf"; import { ComputeRaw } from "Any/Compute"; /** @hidden */ export type _Invert> = ComputeRaw; }[keyof O]>>; /** Swaps the keys and values of an [[Object]] (if applicable) @param O @returns [[Object]] @example ```ts import {O} from 'ts-toolbelt' enum E { A = 'Av', B = 'Bv', C = 'Cv', D = 'Dv', X = 1 } type O = { A: 'Av' B: 'Bv' C: 'Cv' D: 'Dv' X: 1 } type test0 = O.Invert type test1 = O.Invert ``` */ export type Invert> = O extends unknown ? _Invert : never; } declare module "Object/MergeAll" { import { Iteration } from "Iteration/Iteration"; import { IterationOf } from "Iteration/IterationOf"; import { Merge } from "Object/Merge"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Length } from "List/Length"; import { Cast } from "Any/Cast"; import { List } from "List/List"; import { Extends } from "Any/Extends"; import { Depth, MergeStyle } from "Object/_Internal"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ type __MergeAll, depth extends Depth, style extends MergeStyle, noMerge extends any, I extends Iteration = IterationOf<'0'>> = { 0: __MergeAll], depth, style, noMerge>, Os, depth, style, noMerge, Next>; 1: O; }[Extends, Length>]; /** @hidden */ export type _MergeAll, depth extends Depth, style extends MergeStyle, noMerge extends any> = __MergeAll extends infer X ? Cast : never; /** [[Merge]] a list of [[Object]]s into **`O`**. Merges from left to right, first items get completed by the next ones (last-in completes). @param O to start with @param Os to merge @param depth (?=`'flat'`) to do it deeply @param style (?=`1`) 0 = lodash, 1 = ramda @param noMerge (?=`BuiltinObject`) types not to merge @returns [[Object]] @example ```ts ``` */ export type MergeAll, depth extends Depth = 'flat', style extends MergeStyle = 2, noMerge extends any = BuiltInObject> = O extends unknown ? Os extends unknown ? _MergeAll : never : never; } declare module "Union/Replace" { import { Union } from "Union/Union"; /** Replace **`M`** with **`A`** in **`U`** @param U to update @param M to select @param A to update with @returns [[Union]] @example ```ts ``` */ export type Replace = U extends M ? A : U; } declare module "Object/Modify" { import { At } from "Object/At"; import { Replace } from "Union/Replace"; import { x } from "Any/x"; import { Exclude } from "Union/Exclude"; /** Modify **`O`** with **`OMod`** & the [[x]] placeholder @param O to copy from @param OMod to copy to @returns [[Object]] @example ```ts ``` */ export type Modify = { [K in keyof OMod]: Replace, undefined>>; } & {}; } declare module "Object/NonNullableKeys" { /** @hidden */ export type _NonNullableKeys = { [K in keyof O]-?: [O[K] & (undefined | null)] extends [never] ? K : never; }[keyof O]; /** Get the keys of **`O`** that are non-nullable (⚠️ needs `--strictNullChecks` enabled) @param O @returns [[Key]] @example ```ts ``` */ export type NonNullableKeys = O extends unknown ? _NonNullableKeys : never; } declare module "Union/Nullable" { import { Union } from "Union/Union"; /** Add **`undefined | null`** to **`U`** @param U to make nullable @returns [[Union]] @example ```ts ``` */ export type Nullable = U | undefined | null; } declare module "Object/Nullable" { import { Nullable as UNullable } from "Union/Nullable"; import { Depth } from "Object/_Internal"; import { _Pick } from "Object/Pick"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; /** @hidden */ export type NullableFlat = { [K in keyof O]: UNullable; } & {}; /** @hidden */ export type NullableDeep = { [K in keyof O]: NullableDeep>; }; /** @hidden */ type NullablePart = { 'flat': NullableFlat; 'deep': NullableDeep; }[depth]; /** * @hidden */ export type _Nullable = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** nullable (deeply or not) @param O to make nullable @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Nullable = O extends unknown ? _Nullable : never; } declare module "Object/NullableKeys" { /** @hidden */ export type _NullableKeys = { [K in keyof O]-?: [O[K] & (undefined | null)] extends [never] ? never : K; }[keyof O]; /** Get the keys of **`O`** that are nullable (⚠️ needs `--strictNullChecks` enabled) @param O @returns [[Key]] @example ```ts ``` */ export type NullableKeys = O extends unknown ? _NullableKeys : never; } declare module "Object/Object" { /** An [[Object]] @example ```ts type object0 = {a: "hello"} type string1 = {b: "world"} ``` */ export type Object = object; } declare module "Object/Partial" { import { OptionalPart } from "Object/Optional"; import { Depth } from "Object/_Internal"; /** Make all fields of **`O`** optional (deeply or not) @param O to make optional @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts import {O} from 'ts-toolbelt' type L = {a: {b: {c: 2}}, b: 1} type test0 = O.Partial type test1 = O.Partial ``` */ export type Partial = OptionalPart; } declare module "Object/PatchAll" { import { Iteration } from "Iteration/Iteration"; import { IterationOf } from "Iteration/IterationOf"; import { Pos } from "Iteration/Pos"; import { Next } from "Iteration/Next"; import { Length } from "List/Length"; import { Cast } from "Any/Cast"; import { List } from "List/List"; import { Extends } from "Any/Extends"; import { Depth, MergeStyle } from "Object/_Internal"; import { Patch } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ type __PatchAll, depth extends Depth, style extends MergeStyle, noMerge extends any, I extends Iteration = IterationOf<'0'>> = { 0: __PatchAll], depth, style, noMerge>, Os, depth, style, noMerge, Next>; 1: O; }[Extends, Length>]; /** @hidden */ export type _PatchAll, depth extends Depth, style extends MergeStyle, noMerge extends any> = __PatchAll extends infer X ? Cast : never; /** [[Patch]] a list of [[Object]]s into **`O`**. Patches from left to right, first items get completed by the next ones (last-in completes). @param O to start with @param Os to patch @param depth (?=`'flat'`) to do it deeply @param style (?=`1`) 0 = lodash, 1 = ramda @param noMerge (?=`BuiltinObject`) types not to merge @returns [[Object]] @example ```ts ``` */ export type PatchAll, depth extends Depth = 'flat', style extends MergeStyle = 2, noMerge extends any = BuiltInObject> = O extends unknown ? Os extends unknown ? _PatchAll : never : never; } declare module "Object/Paths" { import { OptionalFlat } from "Object/Optional"; import { Key } from "Any/Key"; import { NonNullableFlat } from "Object/NonNullable"; import { _Concat } from "List/Concat"; import { Cast } from "Any/Cast"; import { Equals } from "Any/Equals"; import { List } from "List/List"; import { _Append } from "List/Append"; /** @hidden */ type __Paths = []> = { 0: { [K in keyof O]: __Paths>; }[keyof O]; 1: NonNullableFlat>; 2: NonNullableFlat>>; }[Equals extends 1 ? 2 : O extends object ? [keyof O] extends [never] ? 1 : 0 : 1]; /** @hidden */ export type _Paths = __Paths extends infer X ? Cast> : never; /** Get all the possible paths of **`O`** (⚠️ this won't work with circular-refs) @param O to be inspected @returns **`string[]`** @example ```ts ``` */ export type Paths = O extends unknown ? _Paths : never; } declare module "Object/Update" { import { Key } from "Any/Key"; import { x } from "Any/x"; import { Replace } from "Union/Replace"; import { Depth } from "Object/_Internal"; /** * @hidden */ type UpdateFlat = { [P in keyof O]: P extends K ? Replace : O[P]; } & {}; /** * @hidden */ type __UpdateDeep = { [K in keyof O]: Replace extends infer X ? X extends object ? __UpdateDeep : X : never; }; /** * @hidden */ type _UpdateDeep> = { [K in keyof OU]: __UpdateDeep; } & {}; /** * @hidden */ export type UpdateDeep = _UpdateDeep; /** Update in **`O`** the fields of key **`K`** with **`A`**. Use the [[x]] placeholder to get the current field type. @param O to update @param K to chose fields @param A to update with @returns [[Object]] @example ```ts import {A, O} from 'ts-toolbelt' type User = { info: { name: string age: number payment: {} } id: number } type test0 = Update // { // info: { // name: string; // age: number; // payment: {}; // } | null; // id: number | null; // } ``` */ export type Update = { 'flat': UpdateFlat; 'deep': UpdateDeep; }[depth]; } declare module "List/Update" { import { Key } from "Any/Key"; import { List } from "List/List"; import { Update as OUpdate } from "Object/Update"; import { Depth } from "Object/_Internal"; /** Update in **`L`** the entries of key **`K`** with **`A`**. Use the [[x]] placeholder to get the current field type. @param L to update @param K to chose fields @param A to update with @returns [[List]] @example ```ts ``` */ export type Update = OUpdate; } declare module "Object/PathValid" { import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Next } from "Iteration/Next"; import { Pos } from "Iteration/Pos"; import { At } from "Object/At"; import { Cast } from "Any/Cast"; import { NonNullable } from "Union/NonNullable"; import { Update } from "List/Update"; import { Key } from "Iteration/Key"; import { Key as AKey } from "Any/Key"; import { List } from "List/List"; import { Length } from "List/Length"; import { Extends } from "Any/Extends"; /** @hidden */ type ValidatePath, I extends Iteration> = Update, [ At]> ] extends [never] ? keyof O : Path[Pos]>; /** @hidden */ type __PathValid, I extends Iteration = IterationOf<'0'>> = { 0: __PathValid]>>, ValidatePath, Next>; 1: Path; }[Extends, Length>]; /** @hidden */ export type _PathValid> = __PathValid extends infer X ? Cast> : never; /** * Replaces invalid parts of a path with `never` * @param O to be inspected * @param Path to be validated * @returns **`Index[]`** * @example * ```ts * import {A, L, O} from 'ts-toolbelt' * * // Get a property in an object `o` at any depth with `path` * // `A.Cast>` makes sure `path` is valid * const getAt = < * O extends object, * P extends L.List * >(o: O, path: A.Cast>): O.Path => { * let valueAt = o * * for (const p of path) * valueAt = valueAt[p] * * return valueAt as any * } * * const test0 = getAt({a: {b: {c: 1}}}, ['a', 'b'] as const) // {c: number} * const test1 = getAt({a: {b: {c: 1}}} as const, ['a', 'b'] as const) // {c: 1} * const test2 = getAt({a: {b: {c: 1}}}, ['x'] as const) // error * ``` */ export type PathValid> = O extends unknown ? Path extends unknown ? _PathValid : never : never; } declare module "Object/ReadonlyKeys" { import { Equals } from "Any/Equals"; /** @hidden */ export type _ReadonlyKeys = { [K in keyof O]-?: { 1: never; 0: K; }[Equals<{ -readonly [Q in K]: O[K]; }, { [Q in K]: O[K]; }>]; }[keyof O]; /** Get the keys of **`O`** that are readonly @param O @returns [[Key]] @example ```ts ``` */ export type ReadonlyKeys = O extends unknown ? _ReadonlyKeys : never; } declare module "Object/Replace" { import { Match } from "Any/_Internal"; import { Is } from "Any/Is"; /** @hidden */ export type _Replace = { [K in keyof O]: { 1: A; 0: O[K]; }[Is]; } & {}; /** Update with **`A`** the fields of **`O`** that match **`M`** @param O to update @param M to select fields @param A to update with @param match (?=`'default'`) to change precision @returns [[Object]] @example ```ts ``` */ export type Replace = O extends unknown ? _Replace : never; } declare module "Object/RequiredKeys" { /** @hidden */ export type _RequiredKeys = { [K in keyof O]-?: {} extends Pick ? never : K; }[keyof O]; /** Get the keys of **`O`** that are required @param O @returns [[Key]] @example ```ts ``` */ export type RequiredKeys = O extends unknown ? _RequiredKeys : never; } declare module "Object/Select" { import { SelectKeys } from "Object/SelectKeys"; import { Match } from "Any/_Internal"; import { Pick } from "Object/Pick"; /** Extract the fields of **`O`** that match **`M`** @param O to extract from @param M to select fields @param match (?=`'default'`) to change precision @returns [[Object]] @example ```ts ``` */ export type Select = Pick>; } declare module "Object/Undefinable" { import { Depth } from "Object/_Internal"; import { _Pick } from "Object/Pick"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type UndefinableFlat = { [K in keyof O]: O[K] | undefined; } & {}; /** @hidden */ export type UndefinableDeep = { [K in keyof O]: O[K] extends BuiltInObject ? O[K] : UndefinableDeep; }; /** @hidden */ type UndefinablePart = { 'flat': UndefinableFlat; 'deep': UndefinableDeep; }[depth]; /** * @hidden */ export type _Undefinable = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** **`undefined`** (deeply or not) @param O to make undefinable @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Undefinable = O extends unknown ? _Undefinable : never; } declare module "Object/UndefinableKeys" { /** @hidden */ export type _UndefinableKeys = { [K in keyof O]-?: [O[K] & (undefined)] extends [never] ? never : K; }[keyof O]; /** Get the keys of **`O`** that are **`undefined`** (⚠️ needs `--strictNullChecks` enabled) @param O @returns [[Key]] @example ```ts ``` */ export type UndefinableKeys = O extends unknown ? _UndefinableKeys : never; } declare module "Object/Unionize" { import { At } from "Object/At"; import { Key } from "Any/Key"; /** Make the fields of **`O`** union the ones of **`O1`** @param O to union from @param O1 to union with @param K (?=`Key`) to chose fields @returns [[Object]] @example ```ts ``` */ export type Unionize = { [P in keyof O]: P extends K ? O[P] | At : O[P]; } & {}; } declare module "Object/Writable" { import { _Pick } from "Object/Pick"; import { Depth } from "Object/_Internal"; import { Key } from "Any/Key"; import { _PatchFlat } from "Object/Patch"; import { BuiltInObject } from "Misc/BuiltInObject"; /** @hidden */ export type WritableFlat = { -readonly [K in keyof O]: O[K]; } & {}; /** @hidden */ export type WritableDeep = { -readonly [K in keyof O]: O[K] extends BuiltInObject ? O[K] : WritableDeep; }; /** @hidden */ export type WritablePart = { 'flat': WritableFlat; 'deep': WritableDeep; }[depth]; /** @hidden */ export type _Writable = _PatchFlat, depth>, O, 2>; /** Make some fields of **`O`** writable (deeply or not) @param O to make writable @param K (?=`Key`) to choose fields @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Writable = O extends unknown ? _Writable : never; } declare module "Object/WritableKeys" { import { Equals } from "Any/Equals"; /** @hidden */ export type _WritableKeys = { [K in keyof O]-?: { 1: K; 0: never; }[Equals<{ -readonly [Q in K]: O[K]; }, { [Q in K]: O[K]; }>]; }[keyof O]; /** Get the keys of **`O`** that are writable @param O @returns [[Key]] @example ```ts ``` */ export type WritableKeys = O extends unknown ? _WritableKeys : never; } declare module "Object/_api" { /** @ignore */ /** */ import * as P from "Object/P/_api"; export { P }; export { Assign } from "Object/Assign"; export { At } from "Object/At"; export { AtLeast } from "Object/AtLeast"; export { Compulsory } from "Object/Compulsory"; export { CompulsoryKeys } from "Object/CompulsoryKeys"; export { Diff } from "Object/Diff"; export { Either } from "Object/Either"; export { Exclude } from "Object/Exclude"; export { ExcludeKeys } from "Object/ExcludeKeys"; export { Filter } from "Object/Filter"; export { FilterKeys } from "Object/FilterKeys"; export { Has } from "Object/Has"; export { HasPath } from "Object/HasPath"; export { Includes } from "Object/Includes"; export { Intersect } from "Object/Intersect"; export { IntersectKeys } from "Object/IntersectKeys"; export { Invert } from "Object/Invert"; export { Keys } from "Object/Keys"; export { ListOf } from "Object/ListOf"; export { Patch as Merge } from "Object/Patch"; export { MergeAll } from "Object/MergeAll"; export { Modify } from "Object/Modify"; export { NonNullable } from "Object/NonNullable"; export { NonNullableKeys } from "Object/NonNullableKeys"; export { Nullable } from "Object/Nullable"; export { NullableKeys } from "Object/NullableKeys"; export { Object } from "Object/Object"; export { Omit } from "Object/Omit"; export { Optional } from "Object/Optional"; export { OptionalKeys } from "Object/OptionalKeys"; export { Overwrite } from "Object/Overwrite"; export { Partial } from "Object/Partial"; export { Patch } from "Object/Patch"; export { PatchAll } from "Object/PatchAll"; export { Path } from "Object/Path"; export { Paths } from "Object/Paths"; export { PathValid } from "Object/PathValid"; export { Pick } from "Object/Pick"; export { Readonly } from "Object/Readonly"; export { ReadonlyKeys } from "Object/ReadonlyKeys"; export { Record } from "Object/Record"; export { Replace } from "Object/Replace"; export { Required } from "Object/Required"; export { RequiredKeys } from "Object/RequiredKeys"; export { Select } from "Object/Select"; export { SelectKeys } from "Object/SelectKeys"; export { Undefinable } from "Object/Undefinable"; export { UndefinableKeys } from "Object/UndefinableKeys"; export { Unionize } from "Object/Unionize"; export { UnionOf } from "Object/UnionOf"; export { Update } from "Object/Update"; export { Writable } from "Object/Writable"; export { WritableKeys } from "Object/WritableKeys"; export { Merge as MergeUp } from "Object/Merge"; export { Assign as AssignUp } from "Object/Assign"; export { PatchAll as Compact } from "Object/PatchAll"; export { MergeAll as CompactUp } from "Object/MergeAll"; } declare module "String/String" { /** A [[String]] @example ```ts type string0 = "hello" type string1 = "world" ``` */ export type String = string; } declare module "String/_api" { /** @ignore */ /** */ export { Format } from "String/Format"; export { String } from "String/String"; } declare module "List/Assign" { import { Assign as OAssign } from "Object/Assign"; import { List } from "List/List"; import { ObjectOf } from "List/ObjectOf"; import { ListOf } from "Object/ListOf"; import { Depth } from "Object/_Internal"; /** Assign a list of [[List]] into **`L`** with [[Merge]]. Merges from left to right, first items get overridden by the next ones (last-in overrides). @param L to assign to @param Ls to assign @param depth (?=`'flat'`) to do it deeply @returns [[Object]] @example ```ts ``` */ export type Assign, depth extends Depth = 'flat'> = ListOf, { [K in keyof Ls]: ObjectOf; }, depth>>; } declare module "List/At" { import { At as OAt } from "Object/At"; import { Key } from "Any/Key"; import { List } from "List/List"; import { Boolean } from "Boolean/Boolean"; /** Get in **`L`** the type of an entry of key **`K`** @param L to extract from @param K to extract at @param strict (?=`1`) `0` to work with unions @returns **`any`** @example */ export type At = OAt; } declare module "List/Keys" { import { Exclude } from "Union/Exclude"; import { List } from "List/List"; import { Keys as UKeys } from "Union/Keys"; /** Get the keys of a [[List]] @param L @returns [[Key]] @example ```ts ``` */ export type Keys = Exclude, keyof any[]> | number; } declare module "List/AtLeast" { import { Key } from "Any/Key"; import { AtLeast as OAtLeast } from "Object/AtLeast"; import { ObjectOf } from "List/ObjectOf"; import { _ListOf } from "Object/ListOf"; import { List } from "List/List"; import { NumberOf } from "Any/_Internal"; import { Keys } from "List/Keys"; /** Make that at least one of the keys **`K`** are required in **`L`** at a time. @param L to make required @param K (?=`keyof L`) to choose fields @returns [[List]] [[Union]] @example ```ts ``` */ export type AtLeast> = OAtLeast, NumberOf> extends infer U ? U extends unknown ? _ListOf : never : never; } declare module "List/Compulsory" { import { Depth } from "Object/_Internal"; import { CompulsoryPart } from "Object/Compulsory"; import { List } from "List/List"; /** Make that **`L`**'s fields cannot be [[Nullable]] or [[Optional]] (it's like [[Required]] & [[NonNullable]] at once). @param L to make compulsory @param depth (?=`'flat'`) to do it deeply @returns [[List]] @example ```ts ``` */ export type Compulsory = CompulsoryPart; } declare module "List/CompulsoryKeys" { import { Compulsory as OCompulsory } from "Object/Compulsory"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Get the keys of **`L`** that are [[Compulsory]] (⚠️ needs `--strictNullChecks` enabled) @param L @returns [[Key]] @example ```ts ``` */ export type CompulsoryKeys = OCompulsory>; } declare module "List/Diff" { import { Diff as ODiff } from "Object/Diff"; import { ListOf } from "Object/ListOf"; import { Match } from "Any/_Internal"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Get a [[List]] that is the difference between **`L`** & **`L1`** (**`L`**'s differences have priority over **`L1`**'s if entries overlap) (If `match = 'default'`, no type checks are done) @param L to check differences with @param L1 to check differences against @param match (?=`'default'`) to change precision @returns [[List]] @example ```ts ``` */ export type Diff = ListOf, ObjectOf, match>>; } declare module "List/Drop" { import { Tail } from "List/Tail"; import { Cast } from "Any/Cast"; import { IterationOf } from "Iteration/IterationOf"; import { Iteration } from "Iteration/Iteration"; import { Number } from "Number/Number"; import { Way } from "Iteration/_Internal"; import { List } from "List/List"; import { Pos } from "Iteration/Pos"; import { Prev } from "Iteration/Prev"; import { Prepend } from "List/Prepend"; import { Naked } from "List/_Internal"; import { Extends } from "Any/Extends"; /** @hidden */ type DropForth = { 0: DropForth, Prev>; 1: L; }[Extends<0, Pos>]; /** @hidden */ type DropBack, LN extends List = []> = { 0: DropBack, Prepend]>>; 1: LN; }[Extends<-1, Pos>]; /** @hidden */ type __Drop = { '->': DropForth; '<-': DropBack; }[way]; /** @hidden */ export type _Drop = __Drop, IterationOf, way> extends infer X ? Cast : never; /** Remove **`N`** entries out of **`L`** @param L to remove from @param N to remove out @param way (?=`'->'`) from front: '->', from end: '<-' @returns [[List]] @example ```ts ``` */ export type Drop = L extends unknown ? N extends unknown ? _Drop : never : never; } declare module "List/Either" { import { Key } from "Any/Key"; import { Either as OEither } from "Object/Either"; import { ObjectOf } from "List/ObjectOf"; import { _ListOf } from "Object/ListOf"; import { List } from "List/List"; import { Boolean } from "Boolean/Boolean"; import { NumberOf } from "Any/_Internal"; /** Split **`L`** into a [[Union]] with **`K`** keys in such a way that none of the keys are ever present with one another within the different unions. @param L to split @param K to split with @param strict (?=`1`) to force excess property checks https://github.com/microsoft/TypeScript/issues/20863 @returns [[List]] [[Union]] @example ```ts ``` */ export type Either = OEither, NumberOf, strict> extends infer OE ? OE extends unknown ? _ListOf : never : never; } declare module "List/Exclude" { import { Match } from "Any/_Internal"; import { ListOf } from "Object/ListOf"; import { Exclude as OExclude } from "Object/Exclude"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Exclude the entries of **`L1`** out of **`L`** (If `match = 'default'`, no type checks are done) @param L to remove from @param L1 to remove out @param match (?=`'default'`) to change precision @returns [[List]] @example ```ts ``` */ export type Exclude = ListOf, ObjectOf, match>>; } declare module "List/ExcludeKeys" { import { ExcludeKeys as OExcludeKeys } from "Object/ExcludeKeys"; import { Match } from "Any/_Internal"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Exclude the keys of **`L1`** out of the keys of **`L`** (If `match = 'default'`, no type checks are done) @param L to remove the keys from @param L1 to remove the keys out @param match (?=`'default'`) to change precision @returns [[Key]] @example ```ts ``` */ export type ExcludeKeys = OExcludeKeys, ObjectOf, match>; } declare module "List/UnionOf" { import { List } from "List/List"; /** Transform a [[List]] into an [[Union]] @param L to transform @returns **`any`** @example ```ts ``` */ export type UnionOf = L[number]; } declare module "List/KeySet" { import { Number } from "Number/Number"; import { Range } from "Number/Range"; import { UnionOf } from "List/UnionOf"; /** Create a set of keys @param From to start with @param To to end with @returns [[Key]] @example ```ts ``` */ export type KeySet = UnionOf'>>; } declare module "List/Extract" { import { KeySet } from "List/KeySet"; import { Number } from "Number/Number"; import { Pick } from "List/Pick"; import { List } from "List/List"; /** Pick a range of entries (portion) from **`L`** @param L to pick from @param From to start with @param To to end with @returns [[List]] @example ```ts ``` */ export type Extract = Pick>; } declare module "List/Filter" { import { Filter as OFilter } from "Object/Filter"; import { ListOf } from "Object/ListOf"; import { Match } from "Any/_Internal"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Filter out of **`L`** the entries that match **`M`** @param L to remove from @param M to select entries @param match (?=`'default'`) to change precision @returns [[List]] @example ```ts ``` */ export type Filter = ListOf, M, match>>; } declare module "List/FilterKeys" { import { FilterKeys as OFilterKeys } from "Object/FilterKeys"; import { Match } from "Any/_Internal"; import { ObjectOf } from "List/ObjectOf"; import { List } from "List/List"; /** Filter out the keys of **`L`** which entries match **`M`** @param L to remove from @param M to select entries @param match (?=`'default'`) to change precision @returns [[Key]] @example ```ts ``` */ export type FilterKeys = OFilterKeys, M, match>; } declare module "List/UnNest" { import { _Concat } from "List/Concat"; import { _Append } from "List/Append"; import { Cast } from "Any/Cast"; import { Length } from "List/Length"; import { Iteration } from "Iteration/Iteration"; import { IterationOf } from "Iteration/IterationOf"; import { Next } from "Iteration/Next"; import { Pos } from "Iteration/Pos"; import { List } from "List/List"; import { UnionOf } from "List/UnionOf"; import { Naked } from "List/_Internal"; import { Extends } from "Any/Extends"; import { Boolean } from "Boolean/Boolean"; import { Not } from "Boolean/Not"; import { And } from "Boolean/And"; /** @hidden */ type UnNestLoose = (UnionOf extends infer UL ? UL extends unknown ? UL extends List ? UnionOf