From 50bafc3c54152ff252560823e64958ccfb3035e4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 20 Sep 2023 14:21:19 -0700 Subject: [PATCH] fix: update import path for `Collection` type definition and refactor to use generics Ref: https://github.com/stdlib-js/stdlib/commit/bde4671201dfa6b510f88bcb60d455f44c0842e1 --- .../nullary-addon-dispatch/docs/types/index.d.ts | 16 ++++++++-------- .../nullary-addon-dispatch/docs/types/test.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/index.d.ts b/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/index.d.ts index e65f41960040..7a4e83532167 100644 --- a/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { Collection } from '@stdlib/types/object'; +import { Collection } from '@stdlib/types/array'; /** * Add-on function. @@ -35,7 +35,7 @@ import { Collection } from '@stdlib/types/object'; * // Call into native add-on... * } */ -type AddonFcn = ( N: number, dtypeX: number, x: Collection, strideX: number ) => any; // tslint:disable-line:max-line-length +type AddonFcn = ( N: number, dtypeX: number, x: Collection, strideX: number ) => U; /** * Fallback function. @@ -50,7 +50,7 @@ type AddonFcn = ( N: number, dtypeX: number, x: Collection, strideX: number ) => * // Fallback JavaScript implementation... * } */ -type FallbackFcn = ( N: number, dtypeX: any, x: Collection, strideX: number ) => any; // tslint:disable-line:max-line-length +type FallbackFcn = ( N: number, dtypeX: any, x: Collection, strideX: number ) => U; /** * Fallback function supporting alternative indexing semantics. @@ -66,7 +66,7 @@ type FallbackFcn = ( N: number, dtypeX: any, x: Collection, strideX: number ) => * // Fallback JavaScript implementation... * } */ -type FallbackFcnWithOffsets = ( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ) => any; // tslint:disable-line:max-line-length +type FallbackFcnWithOffsets = ( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ) => U; /** * Dispatches to a native add-on. @@ -77,7 +77,7 @@ type FallbackFcnWithOffsets = ( N: number, dtypeX: any, x: Collection, strideX: * @param strideX - `x` stride length * @returns `x` */ -type Dispatcher = ( N: number, dtypeX: any, x: Collection, strideX: number ) => Collection; // tslint:disable-line:max-line-length +type Dispatcher = ( N: number, dtypeX: any, x: Collection, strideX: number ) => Collection; /** * Dispatches to a native add-on. @@ -89,7 +89,7 @@ type Dispatcher = ( N: number, dtypeX: any, x: Collection, strideX: number ) => * @param offsetX - starting `x` index * @returns `x` */ -type DispatcherWithOffsets = ( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ) => Collection; // tslint:disable-line:max-line-length +type DispatcherWithOffsets = ( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ) => Collection; /** * Interface for creating a native add-on dispatcher. @@ -119,7 +119,7 @@ interface Dispatch { * // Invoke the dispatch function with strided array arguments: * f( 2, 'generic', [ 1, 2 ], 1 ); */ - ( addon: AddonFcn, fallback: FallbackFcn ): Dispatcher; + ( addon: AddonFcn, fallback: FallbackFcn ): Dispatcher; /** * Returns a function which dispatches to a native add-on applying a nullary function using alternative indexing semantics. @@ -145,7 +145,7 @@ interface Dispatch { * // Invoke the dispatch function with strided array arguments: * f( 2, 'generic', [ 1, 2 ], 1, 0 ); */ - ndarray( addon: AddonFcn, fallback: FallbackFcnWithOffsets ): DispatcherWithOffsets; // tslint:disable-line:max-line-length + ndarray( addon: AddonFcn, fallback: FallbackFcnWithOffsets ): DispatcherWithOffsets; } /** diff --git a/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/test.ts b/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/test.ts index 1a10d9fc98d1..bc6dbb23e544 100644 --- a/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/test.ts +++ b/lib/node_modules/@stdlib/strided/base/nullary-addon-dispatch/docs/types/test.ts @@ -18,7 +18,7 @@ /// -import { Collection } from '@stdlib/types/object'; +import { Collection } from '@stdlib/types/array'; import dispatch = require( './index' ); @@ -32,7 +32,7 @@ import dispatch = require( './index' ); * @param x - output array * @param strideX - `x` stride length */ -function addon( N: number, dtypeX: number, x: Collection, strideX: number ): void { // tslint:disable-line:max-line-length +function addon( N: number, dtypeX: number, x: Collection, strideX: number ): void { let i; if ( dtypeX !== dtypeX ) { throw new Error( 'beep' ); @@ -50,7 +50,7 @@ function addon( N: number, dtypeX: number, x: Collection, strideX: number ): voi * @param x - output array * @param strideX - `x` stride length */ -function fallback( N: number, dtypeX: any, x: Collection, strideX: number ): void { // tslint:disable-line:max-line-length +function fallback( N: number, dtypeX: any, x: Collection, strideX: number ): void { let i; if ( dtypeX !== dtypeX ) { throw new Error( 'beep' ); @@ -69,7 +69,7 @@ function fallback( N: number, dtypeX: any, x: Collection, strideX: number ): voi * @param strideX - `x` stride length * @param offsetX - starting `x` index */ -function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ): void { // tslint:disable-line:max-line-length +function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: number, offsetX: number ): void { let i; if ( dtypeX !== dtypeX ) { throw new Error( 'beep' ); @@ -84,7 +84,7 @@ function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: nu // The function returns a dispatch function... { - dispatch( addon, fallback ); // $ExpectType Dispatcher + dispatch( addon, fallback ); // $ExpectType Dispatcher } // The compiler throws an error if not provided a first argument which is an add-on function... @@ -119,7 +119,7 @@ function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: nu const f = dispatch( addon, fallback ); - f( x.length, 'float64', x, 1 ); // $ExpectType Collection + f( x.length, 'float64', x, 1 ); // $ExpectType Collection } // The compiler throws an error if the returned function is not provided a first argument which is a number... @@ -169,7 +169,7 @@ function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: nu // Attached to the main export is an `ndarray` method which returns a dispatch function... { - dispatch.ndarray( addon, fallbackWithOffsets ); // $ExpectType DispatcherWithOffsets + dispatch.ndarray( addon, fallbackWithOffsets ); // $ExpectType DispatcherWithOffsets } // The compiler throws an error if the `ndarray` method is not provided a first argument which is an add-on function... @@ -204,7 +204,7 @@ function fallbackWithOffsets( N: number, dtypeX: any, x: Collection, strideX: nu const f = dispatch.ndarray( addon, fallbackWithOffsets ); - f( x.length, 'float64', x, 1, 0 ); // $ExpectType Collection + f( x.length, 'float64', x, 1, 0 ); // $ExpectType Collection } // The compiler throws an error if the returned function is not provided a first argument which is a number...