Closed WhiteAbeLincoln closed 5 years ago
I noticed the same error with the following:
import { getMiddleware } from 'lib/env'
import { createStore as reduxCreateStore, applyMiddleware, StoreCreator, Reducer } from 'redux'
import thunk from 'redux-thunk'
const storeCreator: StoreCreator = <S>(reducer: Reducer<S>) => {
return reduxCreateStore(reducer, applyMiddleware(thunk, ...getMiddleware()))
}
export default storeCreator
lib/create-store.ts
6:4 error Parsing error: Expression expected
Does your configuration have jsx: true
?
If so it is highly likely: https://github.com/eslint/typescript-eslint-parser/issues/517
You can reproduce the same behaviour with the TypeScript parser directly on https://astexplorer.net/
Hopefully this was covered by the resolution to #517, feel free to reopen if not!
What version of TypeScript are you using? ^2.8.3
What version of
typescript-eslint-parser
are you using? ^15.0.0What code were you trying to parse?
What did you expect to happen? There not to be a parse error
What happened? Eslint reported
Parsing error: Identifier expected
onOption<T>
:Changing this to a function statement instead of a arrow function removes the parse error. These are both valid:
Additionally, removing the type from the parameter changes the error to
JSX element 'T' has no corresponding closing tag
on the return typeReadonlyArray<T>
:This is not a .tsx file, so the parser should probably not be attempting to parse types as JSX tags