Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
interface ObjectWithFunction {
func: (x: number) => number
}
const objAsVariable: ObjectWithFunction = {
func: x => x + 1
}
const arrAsVariable: ObjectWithFunction[] = [
{
func: x => x + 1
}
]
class Example {
objAsField: ObjectWithFunction = {
func: x => x + 1
}
// all of the above work as expected
arrAsField: ObjectWithFunction[] = [
{
// this should be allowed
func: x => x + 1
}
]
}
ESLint Config
{
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowTypedFunctionExpressions": true
}
]
}
}
tsconfig
No response
Expected Result
The given code sample should lint without errors.
Actual Result
There is a linting error on line 26: Missing return type on function. 25:7 - 25:13
, despite the option allowTypedFunctionExpressions: true
.
Additional Info
I would have liked to check on which version this started occurring, but the online playground apparently doesn't support selecting the tseslint version.