ink icon indicating copy to clipboard operation
ink copied to clipboard

declare Item before Focus uses it

Open Silverium opened this issue 3 years ago • 5 comments

Silverium avatar Jul 15 '22 15:07 Silverium

Is there an issue without this change?

vadimdemedes avatar Jul 24 '22 18:07 vadimdemedes

As far as I know, const is not hoisted and this code should blatantly fail. When using var or function this is not a problem, but if I am not mistaken, this is simply an error in the example, which is not run, therefore it's not failing any test

Silverium avatar Jul 25 '22 14:07 Silverium

@Silverium The example is valid. This runs as expected as a smaller example:

const hello = () => console.log(world);
const world = 'Hello world!'
hello();

The reason is the reference to world in the above example isn't actually used until after it's declared & assigned. This would fail with a ReferenceError if hello was called before world was declared & assigned.

mAAdhaTTah avatar Jul 25 '22 16:07 mAAdhaTTah

meh... image https://typescript-eslint.io/rules/no-use-before-define/

Silverium avatar Jul 26 '22 14:07 Silverium

I, male person near 40 years old, could go into a friend's wedding dressed exactly as the bride. I would be in perfect consonance with dressing policies... but it's still morally and ethically wrong ;)

Silverium avatar Jul 26 '22 14:07 Silverium