@@ -25,79 +25,124 @@ import decompose = require( './index' );
2525 const initial = [ 3 , 4 , 2 , 5 ] ;
2626 const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
2727
28- decompose ( 12 , initial , out , 1 , 0 ) ; // $ExpectType number
28+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectType number
2929}
3030
3131// The compiler throws an error if the function is provided a sequence length which is not a number...
3232{
3333 const initial = [ 3 , 4 , 2 , 5 ] ;
3434 const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
3535
36- decompose ( '12' , initial , out , 1 , 0 ) ; // $ExpectError
37- decompose ( true , initial , out , 1 , 0 ) ; // $ExpectError
38- decompose ( false , initial , out , 1 , 0 ) ; // $ExpectError
39- decompose ( null , initial , out , 1 , 0 ) ; // $ExpectError
40- decompose ( void 0 , initial , out , 1 , 0 ) ; // $ExpectError
41- decompose ( [ ] , initial , out , 1 , 0 ) ; // $ExpectError
42- decompose ( { } , initial , out , 1 , 0 ) ; // $ExpectError
43- decompose ( ( x : number ) : number => x , initial , out , 1 , 0 ) ; // $ExpectError
36+ decompose ( '12' , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
37+ decompose ( true , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
38+ decompose ( false , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
39+ decompose ( null , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
40+ decompose ( void 0 , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
41+ decompose ( [ ] , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
42+ decompose ( { } , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
43+ decompose ( ( x : number ) : number => x , 4 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
44+ }
45+
46+ // The compiler throws an error if the function is provided a number of trial divisors which is not a number...
47+ {
48+ const initial = [ 3 , 4 , 2 , 5 ] ;
49+ const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
50+
51+ decompose ( 12 , '4' , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
52+ decompose ( 12 , true , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
53+ decompose ( 12 , false , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
54+ decompose ( 12 , null , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
55+ decompose ( 12 , void 0 , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
56+ decompose ( 12 , [ ] , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
57+ decompose ( 12 , { } , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
58+ decompose ( 12 , ( x : number ) : number => x , initial , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
4459}
4560
4661// The compiler throws an error if the function is provided initial trial divisors which is not an array of numbers...
4762{
4863 const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
4964
50- decompose ( 12 , '4,2,3,5' , out , 1 , 0 ) ; // $ExpectError
51- decompose ( 12 , 5 , out , 1 , 0 ) ; // $ExpectError
52- decompose ( 12 , true , out , 1 , 0 ) ; // $ExpectError
53- decompose ( 12 , false , out , 1 , 0 ) ; // $ExpectError
54- decompose ( 12 , null , out , 1 , 0 ) ; // $ExpectError
55- decompose ( 12 , void 0 , out , 1 , 0 ) ; // $ExpectError
56- decompose ( 12 , { } , out , 1 , 0 ) ; // $ExpectError
57- decompose ( 12 , ( x : number ) : number => x , out , 1 , 0 ) ; // $ExpectError
65+ decompose ( 12 , 4 , '4,2,3,5' , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
66+ decompose ( 12 , 4 , 5 , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
67+ decompose ( 12 , 4 , true , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
68+ decompose ( 12 , 4 , false , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
69+ decompose ( 12 , 4 , null , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
70+ decompose ( 12 , 4 , void 0 , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
71+ decompose ( 12 , 4 , { } , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
72+ decompose ( 12 , 4 , ( x : number ) : number => x , 1 , 0 , out , 1 , 0 ) ; // $ExpectError
73+ }
74+
75+ // The compiler throws an error if the function is provided a stride for initial which is not a number...
76+ {
77+ const initial = [ 3 , 4 , 2 , 5 ] ;
78+ const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
79+
80+ decompose ( 12 , 4 , initial , '1' , 0 , out , 1 , 0 ) ; // $ExpectError
81+ decompose ( 12 , 4 , initial , true , 0 , out , 1 , 0 ) ; // $ExpectError
82+ decompose ( 12 , 4 , initial , false , 0 , out , 1 , 0 ) ; // $ExpectError
83+ decompose ( 12 , 4 , initial , null , 0 , out , 1 , 0 ) ; // $ExpectError
84+ decompose ( 12 , 4 , initial , void 0 , 0 , out , 1 , 0 ) ; // $ExpectError
85+ decompose ( 12 , 4 , initial , [ ] , 0 , out , 1 , 0 ) ; // $ExpectError
86+ decompose ( 12 , 4 , initial , { } , 0 , out , 1 , 0 ) ; // $ExpectError
87+ decompose ( 12 , 4 , initial , ( x : number ) : number => x , 0 , out , 1 , 0 ) ; // $ExpectError
88+ }
89+
90+ // The compiler throws an error if the function is provided an offset for initial which is not a number...
91+ {
92+ const initial = [ 3 , 4 , 2 , 5 ] ;
93+ const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
94+
95+ decompose ( 12 , 4 , initial , 1 , '0' , out , 1 , 0 ) ; // $ExpectError
96+ decompose ( 12 , 4 , initial , 1 , true , out , 1 , 0 ) ; // $ExpectError
97+ decompose ( 12 , 4 , initial , 1 , false , out , 1 , 0 ) ; // $ExpectError
98+ decompose ( 12 , 4 , initial , 1 , null , out , 1 , 0 ) ; // $ExpectError
99+ decompose ( 12 , 4 , initial , 1 , void 0 , out , 1 , 0 ) ; // $ExpectError
100+ decompose ( 12 , 4 , initial , 1 , [ ] , out , 1 , 0 ) ; // $ExpectError
101+ decompose ( 12 , 4 , initial , 1 , { } , out , 1 , 0 ) ; // $ExpectError
102+ decompose ( 12 , 4 , initial , 1 , ( x : number ) : number => x , out , 1 , 0 ) ; // $ExpectError
58103}
59104
60105// The compiler throws an error if the function is provided an output array which is not an array...
61106{
62107 const initial = [ 3 , 4 , 2 , 5 ] ;
63108
64- decompose ( 12 , initial , 123 , 1 , 0 ) ; // $ExpectError
65- decompose ( 12 , initial , true , 1 , 0 ) ; // $ExpectError
66- decompose ( 12 , initial , false , 1 , 0 ) ; // $ExpectError
67- decompose ( 12 , initial , null , 1 , 0 ) ; // $ExpectError
68- decompose ( 12 , initial , void 0 , 1 , 0 ) ; // $ExpectError
69- decompose ( 12 , initial , { } , 1 , 0 ) ; // $ExpectError
70- decompose ( 12 , initial , ( x : number ) : number => x , 1 , 0 ) ; // $ExpectError
109+ decompose ( 12 , 4 , initial , 1 , 0 , 123 , 1 , 0 ) ; // $ExpectError
110+ decompose ( 12 , 4 , initial , 1 , 0 , true , 1 , 0 ) ; // $ExpectError
111+ decompose ( 12 , 4 , initial , 1 , 0 , false , 1 , 0 ) ; // $ExpectError
112+ decompose ( 12 , 4 , initial , 1 , 0 , null , 1 , 0 ) ; // $ExpectError
113+ decompose ( 12 , 4 , initial , 1 , 0 , void 0 , 1 , 0 ) ; // $ExpectError
114+ decompose ( 12 , 4 , initial , 1 , 0 , { } , 1 , 0 ) ; // $ExpectError
115+ decompose ( 12 , 4 , initial , 1 , 0 , ( x : number ) : number => x , 1 , 0 ) ; // $ExpectError
71116}
72117
73- // The compiler throws an error if the function is provided a stride which is not a number...
118+ // The compiler throws an error if the function is provided a stride for out which is not a number...
74119{
75120 const initial = [ 3 , 4 , 2 , 5 ] ;
76121 const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
77122
78- decompose ( 12 , initial , out , '1' , 0 ) ; // $ExpectError
79- decompose ( 12 , initial , out , true , 0 ) ; // $ExpectError
80- decompose ( 12 , initial , out , false , 0 ) ; // $ExpectError
81- decompose ( 12 , initial , out , null , 0 ) ; // $ExpectError
82- decompose ( 12 , initial , out , void 0 , 0 ) ; // $ExpectError
83- decompose ( 12 , initial , out , [ ] , 0 ) ; // $ExpectError
84- decompose ( 12 , initial , out , { } , 0 ) ; // $ExpectError
85- decompose ( 12 , initial , out , ( x : number ) : number => x , 0 ) ; // $ExpectError
123+ decompose ( 12 , 4 , initial , 1 , 0 , out , '1' , 0 ) ; // $ExpectError
124+ decompose ( 12 , 4 , initial , 1 , 0 , out , true , 0 ) ; // $ExpectError
125+ decompose ( 12 , 4 , initial , 1 , 0 , out , false , 0 ) ; // $ExpectError
126+ decompose ( 12 , 4 , initial , 1 , 0 , out , null , 0 ) ; // $ExpectError
127+ decompose ( 12 , 4 , initial , 1 , 0 , out , void 0 , 0 ) ; // $ExpectError
128+ decompose ( 12 , 4 , initial , 1 , 0 , out , [ ] , 0 ) ; // $ExpectError
129+ decompose ( 12 , 4 , initial , 1 , 0 , out , { } , 0 ) ; // $ExpectError
130+ decompose ( 12 , 4 , initial , 1 , 0 , out , ( x : number ) : number => x , 0 ) ; // $ExpectError
86131}
87132
88- // The compiler throws an error if the function is provided an offset which is not a number...
133+ // The compiler throws an error if the function is provided an offset for out which is not a number...
89134{
90135 const initial = [ 3 , 4 , 2 , 5 ] ;
91136 const out = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
92137
93- decompose ( 12 , initial , out , 1 , '0' ) ; // $ExpectError
94- decompose ( 12 , initial , out , 1 , true ) ; // $ExpectError
95- decompose ( 12 , initial , out , 1 , false ) ; // $ExpectError
96- decompose ( 12 , initial , out , 1 , null ) ; // $ExpectError
97- decompose ( 12 , initial , out , 1 , void 0 ) ; // $ExpectError
98- decompose ( 12 , initial , out , 1 , [ ] ) ; // $ExpectError
99- decompose ( 12 , initial , out , 1 , { } ) ; // $ExpectError
100- decompose ( 12 , initial , out , 1 , ( x : number ) : number => x ) ; // $ExpectError
138+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , '0' ) ; // $ExpectError
139+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , true ) ; // $ExpectError
140+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , false ) ; // $ExpectError
141+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , null ) ; // $ExpectError
142+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , void 0 ) ; // $ExpectError
143+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , [ ] ) ; // $ExpectError
144+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , { } ) ; // $ExpectError
145+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , ( x : number ) : number => x ) ; // $ExpectError
101146}
102147
103148// The compiler throws an error if the function is provided an unsupported number of arguments...
@@ -107,8 +152,11 @@ import decompose = require( './index' );
107152
108153 decompose ( ) ; // $ExpectError
109154 decompose ( 12 ) ; // $ExpectError
110- decompose ( 12 , initial ) ; // $ExpectError
111- decompose ( 12 , initial , out ) ; // $ExpectError
112- decompose ( 12 , initial , out , 1 ) ; // $ExpectError
113- decompose ( 12 , initial , out , 1 , 0 , 123 ) ; // $ExpectError
155+ decompose ( 12 , 4 ) ; // $ExpectError
156+ decompose ( 12 , 4 , initial ) ; // $ExpectError
157+ decompose ( 12 , 4 , initial , 1 ) ; // $ExpectError
158+ decompose ( 12 , 4 , initial , 1 , 0 ) ; // $ExpectError
159+ decompose ( 12 , 4 , initial , 1 , 0 , out ) ; // $ExpectError
160+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 ) ; // $ExpectError
161+ decompose ( 12 , 4 , initial , 1 , 0 , out , 1 , 0 , 123 ) ; // $ExpectError
114162}
0 commit comments