main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
621 bytes
|
Line | |
---|
1 | import { Function } from './Function';
|
---|
2 | import { Parameters } from './Parameters';
|
---|
3 | import { Length as LLength } from '../List/Length';
|
---|
4 | /**
|
---|
5 | * Extract arguments' length from a [[Function]]
|
---|
6 | * @param F to extract from
|
---|
7 | * @returns [[String]] or `number`
|
---|
8 | * @example
|
---|
9 | * ```ts
|
---|
10 | * import {F} from 'ts-toolbelt'
|
---|
11 | *
|
---|
12 | * const fn = (a1: any, a2: any) => {}
|
---|
13 | *
|
---|
14 | * type test0 = F.LengthOf<typeof fn> // 2
|
---|
15 | *
|
---|
16 | * type test1 = F.LengthOf<(a1?: any) => any> // 0 | 1
|
---|
17 | *
|
---|
18 | * type test2 = F.LengthOf<(...a: any[]) => any> // number
|
---|
19 | * ```
|
---|
20 | */
|
---|
21 | export declare type Length<Fn extends Function> = LLength<Parameters<Fn>>;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.