the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

ESLint explicit-function-return-type rule error #150

Closed VictorienT closed 4 years ago

VictorienT commented 4 years ago

When using as specified in doc :

import { createActionCreator } from 'deox'

const reset = createActionCreator('RESET', resolve => (count: number) =>
  resolve(count)
)

the explicit-function-return-type rule is reported on the (count: number) => function.

How that should be handled?

the-dr-lazy commented 4 years ago

It's related to ESLint. You can disable this rule for a code blocks you want as follows.

/* eslint-disable explicit-function-return-type */
const reset = createActionCreator('RESET', resolve => (count: number) =>
  resolve(count)
)
/* eslint-enable explicit-function-return-type */

You can read more about disabling ESLint in this blog post.

VictorienT commented 4 years ago

Hi, thanks for your prompt response! Yeah I do know it's related to ESLint, I was wondering if there were a way to get the explicit return type rather than just disabling the rule.

the-dr-lazy commented 4 years ago

Sorry about misunderstanding. The purpose of this library is to reduce some redundant type verbosity. BTW, if you want it, here you go:

import { Action } from 'deox'

const reset = createActionCreator('RESET', resolve => (count: number): Action<'RESET', number> =>
  resolve(count)
)
VictorienT commented 4 years ago

Nice, thank you!