Skip to content

Commit

Permalink
Add typedef test (palantir#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
YuichiNukiyama authored and jkillian committed Jun 24, 2016
1 parent 606b94f commit 87adba8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
12 changes: 12 additions & 0 deletions test/rules/typedef/arrow-call-signature-and-parameter/test.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class AComponent {
private _test(): void {
this._foo.test({
callback: () => {
// asd
},
});
}
}

function foo(bar: any) :void {}
foo({bar: ()=>{}});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rules": {
"typedef": [true,
"parameter",
"call-signature"
]
}
}
15 changes: 14 additions & 1 deletion test/rules/typedef/call-signature/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ setTimeout(function() {}, 1000);
~ [expected call-signature to have a typedef]

someFunc(n => n+1);
someFunc(n => {});
someFunc(n => {});

class AComponent {
private _test(): void {
this._foo.test({
callback: () => {
// asd
},
});
}
}

function foo(bar: any) :void {}
foo({bar: ()=>{}});
13 changes: 13 additions & 0 deletions test/rules/typedef/parameter/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,16 @@ var NoTypesFn = function (a, b) {
}

var NoTypesArrowFn = (a, b) => {}

class AComponent {
private _test(): void {
this._foo.test({
callback: () => {
// asd
},
});
}
}

function foo(bar: any) :void {}
foo({bar: ()=>{}});

0 comments on commit 87adba8

Please sign in to comment.