add annotation to undocumnted inner fn of curry
This commit is contained in:
parent
1884f59229
commit
9dc971fbf6
2 changed files with 4 additions and 2 deletions
|
@ -48,19 +48,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {any[]} P, R
|
* @template {any[]} P, R
|
||||||
* @typedef {<T extends any[]>(...args: Cast<T, Partial<P>>) => Drop<Length<T>, P> extends [any, ...any[]] ? Curry<Cast<Drop<Length<T>, P>, any[]>, R> : R} Curry
|
* @typedef {<T extends any[]>(...args: Cast<T, Partial<P>>) => Drop<Length<T>, P> extends [any, ...any[]] ? Curried<Cast<Drop<Length<T>, P>, any[]>, R> : R} Curried
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {any[]} P, R
|
* @template {any[]} P, R
|
||||||
* @param {(...args: P) => R} func
|
* @param {(...args: P) => R} func
|
||||||
* @returns {Curry<P, R>}
|
* @returns {Curried<P, R>}
|
||||||
*/
|
*/
|
||||||
export function curry(func) {
|
export function curry(func) {
|
||||||
return function curried(...args) {
|
return function curried(...args) {
|
||||||
if (args.length >= func.length) {
|
if (args.length >= func.length) {
|
||||||
return func.apply(this, args)
|
return func.apply(this, args)
|
||||||
} else {
|
} else {
|
||||||
|
/** @type {Curried<P, R>} */
|
||||||
return function(...args2) {
|
return function(...args2) {
|
||||||
return curried.apply(this, args.concat(args2))
|
return curried.apply(this, args.concat(args2))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
export * from './algebra/index.js'
|
export * from './algebra/index.js'
|
||||||
export * from './curry.js'
|
export * from './curry.js'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue