Skip to content

Commit 8d852d4

Browse files
author
Mathias Lorenzen
committed
merge.
2 parents 86866d4 + 487d320 commit 8d852d4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ console.log(calculator.add(1337, 3)); //prints undefined since second argument d
6060
console.log(calculator.add(1337, 2)); //prints 10 since second argument matches
6161

6262
//received call with first arg 1 and second arg less than 0
63-
calculator.received().add(1, Arg.is<number>(x => x < 0));
63+
calculator.received().add(1, Arg.is(x => x < 0));
6464
```
6565

6666
## What is this - black magic?

src/Arguments.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
export class Arg {
22
static any()
3+
static any<T extends 'string'>(type: T): Arg & string
4+
static any<T extends 'number'>(type: T): Arg & number
5+
static any<T extends 'boolean'>(type: T): Arg & boolean
6+
static any<T extends 'array'>(type: T): Arg & any[]
7+
static any<T extends 'function'>(type: T): Arg & Function
38
static any<T extends 'string'|'number'|'boolean'|'symbol'|'undefined'|'object'|'function'|'array'>(type: T)
49
static any(type?: string): Argument<any> {
510
const description = !type ? '{any arg}' : '{arg matching ' + type + '}';

0 commit comments

Comments
 (0)