@@ -37,11 +37,6 @@ interface Options {
3737 */
3838 order ?: Order ;
3939
40- /**
41- * Array shape.
42- */
43- shape ?: Shape ;
44-
4540 /**
4641 * Specifies how to handle indices which exceed array dimensions (default: 'throw').
4742 */
@@ -78,6 +73,63 @@ interface Options {
7873 readonly ?: boolean ;
7974}
8075
76+ /**
77+ * Interface describing function options.
78+ */
79+ interface OptionsWithShape extends Options {
80+ /**
81+ * Array shape.
82+ */
83+ shape : Shape ;
84+
85+ /**
86+ * Data source.
87+ *
88+ * ## Notes
89+ *
90+ * - If provided along with a `buffer` argument, the argument takes precedence.
91+ */
92+ buffer ?: ArrayLike < any > ;
93+ }
94+
95+ /**
96+ * Interface describing function options.
97+ */
98+ interface OptionsWithBuffer extends Options {
99+ /**
100+ * Array shape.
101+ */
102+ shape ?: Shape ;
103+
104+ /**
105+ * Data source.
106+ *
107+ * ## Notes
108+ *
109+ * - If provided along with a `buffer` argument, the argument takes precedence.
110+ */
111+ buffer : ArrayLike < any > ;
112+ }
113+
114+ /**
115+ * Interface describing function options.
116+ */
117+ interface ExtendedOptions extends Options {
118+ /**
119+ * Array shape.
120+ */
121+ shape ?: Shape ;
122+
123+ /**
124+ * Data source.
125+ *
126+ * ## Notes
127+ *
128+ * - If provided along with a `buffer` argument, the argument takes precedence.
129+ */
130+ buffer ?: ArrayLike < any > ;
131+ }
132+
81133/**
82134* Returns a multidimensional array.
83135*
@@ -112,7 +164,7 @@ interface Options {
112164* var v = arr.get( 0 );
113165* // returns [ 1, 2 ]
114166*/
115- declare function array ( options : Options ) : ndarray ;
167+ declare function array ( options : OptionsWithShape | OptionsWithBuffer ) : ndarray ; // tslint:disable-line:max-line-length
116168
117169/**
118170* Returns a multidimensional array.
@@ -168,7 +220,7 @@ declare function array( options: Options ): ndarray;
168220* var v = arr.get( 0, 0 );
169221* // returns 1.0
170222*/
171- declare function array ( buffer : ArrayLike < any > , options ?: Options ) : ndarray ;
223+ declare function array ( buffer : ArrayLike < any > , options ?: ExtendedOptions ) : ndarray ; // tslint:disable-line:max-line-length
172224
173225
174226// EXPORTS //
0 commit comments