-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Description
I noticed that build 4.0.0-dev.20200520 broke eslint parser (or whatever/however it's called; more info follows).
This build introduced changes that break my eslint parser as well.
TypeScript Version: (versions with ✓ work as expected)
x 4.1.0-dev.20200909 (typescript@next)
x 4.0.2 (latest release)
x 4.0.0-dev.20200520
✓ 4.0.0-dev.20200519
✓ 3.9.7
Search Terms: parsing error, eslint
Code
Here's a rather simple (one of) file that I have where parser throws error:
import React from 'react';
function useFocus(): [
boolean,
{
onFocus: (e: React.FocusEvent) => void;
onBlur: (e: React.FocusEvent) => void;
},
] {
const [isFocused, setFocused] = React.useState(false);
const bind = React.useMemo(
() => ({
onFocus: (): void => setFocused(true),
onBlur: (): void => setFocused(false),
}),
[],
);
return [isFocused, bind];
}
export default useFocus;/Users/viktor/Developer/Ruby/CivicLift/app/javascript/hooks/useFocus.ts
0:0 error Parsing error: Cannot read property 'map' of undefined
EDIT: I managed to shorten this down to this tuple line:
const a = (): [boolean, boolean] => [false, true]This is how I run this from package.json:
{
"scripts": {
"fix-js": "eslint --fix -c .eslintrc.js --ext .jsx,.js,.ts,.tsx app/ spec/"
}
}I tried running this with tsc, (node_modules/.bin/tsc -p tsconfig.json), but then useFocus doesn't come out as one of the errors. Maybe tsc skips useFocus?
Playground Link:
I don't know how to get this working in playground:
https://www.typescriptlang.org/play?noEmitHelpers=true&target=1#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wG4AoczAVwDsNgJa5qBnJAMQjTYAoBKAFxwA2uThwARhAgAbVLQA04uAG8VEplx6thvJMOToYAOm1sAogDcktGPzgBeAHxwrEYABMKEzbQBCstRQegaIxKbmrNa29k6u7l4+cAC+ygC6aipoTKzwIsCsUUieinDsMMWemY7hxiZsSADKMCgwSLyYKLLs-BTZufCSwLSeTnUYDewAskggELwacALxy+q+vlrcbHpCbh5jLuVIldvsnrwwUNRI-MobfoHBu8KJh64VVZ3dvfe+KXcliJ0n8+pQJEQYMFmAUimcSmVhqN0hQUpQkAAPSCwOCeJBdaiyeCNKIUIA
Related Issues:
#38682
@weswigham had some insight into this issue?
Thank you!