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.
TSLint version: 5.7.0, whatever the playground uses
TypeScript version: 2.8.3, whatever the playground uses
Running TSLint via: (pick one) CLI / Playground
TypeScript code being linted
// A fake debounce implementation.constdebounce=(fn,delay)=>setTimeout(fn,delay);classC{value=42;returnValue=()=>this.value;debouncedReturnValue=debounce(this.returnValue,1000);}
Declaration of field not allowed after declaration of method. Instead, this should come at the beginning of the class/interface.
Expected behavior
There should be no error.
The problem is TSLint treats class fields defined as functions as methods when they are not methods. This creates problems - for methods, their order doesn't matter. For fields it sometimes does. In my example I have two fields with function values, the second one of them created not directly but by another function. I cannot change the order of those fields as the debounced returnValue function must already be defined when debouncedReturnValue is being defined.
The text was updated successfully, but these errors were encountered:
Bug Report
5.7.0
, whatever the playground uses2.8.3
, whatever the playground usesTypeScript code being linted
with
tslint.json
configuration:See it in the playground: https://palantir.github.io/tslint-playground/?saved=N4Igxg9gJgpiBcID0SAEBBVAzAhgaxlVgCMIBXAOzEIEsBbABwBsY6YKAXHDmiCgOgA6VPgGcORGKUrVUAXlQAKLBQA0kpjgCeASnkA+VKJgcAKvRjkOytRu06A3MOFhNo0agDCqYMNT-UADccJjJCBQAWACYnCgDUACcTMgSKADUQsPklPTlDDgALGlF+YNCYWPiScioYKAAlZNSM8uzqmRhFQuL+JI4U9MyYdQBGAAYJx2EAX2EQVXA+LBoAcwQQXziAwRAEshZRHfgfP3jtkDY6YhgEgFoIBNgEmgoVo9QAbQ494dOzs52wWeOGIB1u1ywDxgtywMh4Yh2fzOAF0kbMKOiQNMgA
Actual behavior
It errors with:
Expected behavior
There should be no error.
The problem is TSLint treats class fields defined as functions as methods when they are not methods. This creates problems - for methods, their order doesn't matter. For fields it sometimes does. In my example I have two fields with function values, the second one of them created not directly but by another function. I cannot change the order of those fields as the debounced
returnValue
function must already be defined whendebouncedReturnValue
is being defined.The text was updated successfully, but these errors were encountered: