You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
We've such rule internally and I believe it might be useful for someone else and we can provide such rule in TSLint.
Is your rule for a general problem or is it specific to your development style? For a general problem.
What does your suggested rule do?
Restrict invalid usage of void type. For example, as property type or in type enumerations. I believe the void type should be used as return type only and be alone (without any kind of intersection types - see examples below).
List several examples where your rule could be used
functionfunc(): void{}typeNormalType=()=>void;interfaceInterface{lambda: ()=>void;voidProp: void;~~~~[voidasnon-returntype is forbidden]}classClassName{privatereadonlypropName: void;~~~~[voidasnon-returntype is forbidden]}letletVoid: void;~~~~[voidasnon-returntype is forbidden]typeVoidType=void;~~~~[voidasnon-returntype is forbidden]classOtherClassName{privatepropName: VoidType;}typeUnionType=string|number;typeUnionType2=string|number|void;~~~~[voidasnon-returntype is forbidden]typeUnionType3=string|(number&any|(string|void));~~~~[voidasnon-returntype is forbidden]typeIntersectionType=string&number&void;~~~~[voidasnon-returntype is forbidden]
The text was updated successfully, but these errors were encountered:
* [new-rule] Added new no-invalid-void rule
Fixes#4732
* [no-invalid-void] Fixed lint error
* [no-invalid-void] Changed copyright year
* [no-invalid-void] Removed unnecessary checking parent of the node
* [no-invalid-void] Fixed a long string
* [invalid-void] Renamed no-invalid-void rule to invalid-void
* [invalid-void] Added rationale
* [invalid-void] Changed failure string
* [invalid-void] Changed failedKinds type from Array to Set
* [invalid-void] Added new kinds to fail
* [invalid-void] Fixed build for TypeScript < 2.3
https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#generic-parameter-defaults
* [invalid-void] Replaced default generic type of WalkContext and AbstractWalker to undefined from {}
Rule Suggestion
We've such rule internally and I believe it might be useful for someone else and we can provide such rule in TSLint.
Is your rule for a general problem or is it specific to your development style? For a general problem.
What does your suggested rule do?
Restrict invalid usage of
void
type. For example, as property type or in type enumerations. I believe thevoid
type should be used as return type only and be alone (without any kind of intersection types - see examples below).List several examples where your rule could be used
The text was updated successfully, but these errors were encountered: