Created
December 19, 2018 08:54
-
-
Save levino/caca90056d6d73821d722d811c346542 to your computer and use it in GitHub Desktop.
Example for linting rules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type standardFunction = (arg1: number, arg2: number) => number | |
// Should be okay | |
const add: standardFunction = (arg1, arg2) => arg1 + arg2 // Types can be inferred from 'standardFunction' | |
const addLater = ( | |
arg1: number, | |
arg2: number | |
): (() => Promise<number>) => async () => arg1 + arg2 // Return type of promise can be inferred from type definition of 'addLater' | |
// Should not be okay | |
const add2 = (arg1: number, arg2: number) => arg1 + arg2 // Return type is not explictly declared. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment