@@ -54,7 +54,17 @@ import normhermitepoly = require( './index' );
5454
5555// Attached to main export is a `factory` method which returns a function...
5656{
57- normhermitepoly . factory ( 3 ) ; // $ExpectType EvaluationFunction
57+ normhermitepoly . factory ( 3 ) ; // $ExpectType PolynomialFunction
58+ }
59+
60+ // The compiler throws an error if the `factory` method is provided a first argument which is not a number...
61+ {
62+ normhermitepoly . factory ( true ) ; // $ExpectError
63+ normhermitepoly . factory ( false ) ; // $ExpectError
64+ normhermitepoly . factory ( 'abc' ) ; // $ExpectError
65+ normhermitepoly . factory ( [ ] ) ; // $ExpectError
66+ normhermitepoly . factory ( { } ) ; // $ExpectError
67+ normhermitepoly . factory ( ( x : number ) : number => x ) ; // $ExpectError
5868}
5969
6070// The compiler throws an error if the `factory` method is provided an unsupported number of arguments...
@@ -69,7 +79,7 @@ import normhermitepoly = require( './index' );
6979 polyval ( 1.0 ) ; // $ExpectType number
7080}
7181
72- // The `factory` method returns a function which does not compile if provided a first argument which is not a number...
82+ // The compiler throws an error if the function returned by the `factory` method is provided a first argument which is not a number...
7383{
7484 const polyval = normhermitepoly . factory ( 3 ) ;
7585 polyval ( true ) ; // $ExpectError
@@ -79,13 +89,3 @@ import normhermitepoly = require( './index' );
7989 polyval ( { } ) ; // $ExpectError
8090 polyval ( ( x : number ) : number => x ) ; // $ExpectError
8191}
82-
83- // The compiler throws an error if the `factory` method is provided a first argument which is not a number...
84- {
85- normhermitepoly . factory ( true ) ; // $ExpectError
86- normhermitepoly . factory ( false ) ; // $ExpectError
87- normhermitepoly . factory ( 'abc' ) ; // $ExpectError
88- normhermitepoly . factory ( [ ] ) ; // $ExpectError
89- normhermitepoly . factory ( { } ) ; // $ExpectError
90- normhermitepoly . factory ( ( x : number ) : number => x ) ; // $ExpectError
91- }
0 commit comments