-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
[type-annotation-spacing] no distinction between parameters, properties and return types
The type-annotation-spacing
rule only distinguishes between colon
and arrow
rules. The equivalent typedef-whitespace
rule in tslint allowed to define different rules for properties, variables, parameters, index signatures and call signatures (which covered both the function() : void
as well as the () => void
case). While the two rules are supposed to equivalent, their functionality is in practice only vaguely similar.
Can type-annotation-spacing
be extended to at least bring a distinction between variables and parameters, properties, and function call return types, so that it would provide roughly the same configurability as typedef-whitespace
?
Expected behaviour:
interface Person {
firstName : string;
lastName : string;
}
type getFirstName = (person:Person) => string;
function greet(getName:getFirstName) : string {
return `Hi ${ getName() }`;
}
const person:Person = { firstname : 'John', lastName : 'Doe' };
A setup like this is completely acceptable to tslint; I do think that this issue does in the end comes down to preference, while the lack of configurability of type-annotation-spacing
right now means that anybody coming from tslint and having a non-standard setup will have to fix up their whole code base or just disable this test completely.