New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@babel/preset-typescript and generic arrow function (<T extends {}>) #9086
Comments
Hey @Tsury! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
This seems to work on master |
Have the same issue, we had to return to react-native-typescript-transformer. #7504 is probably related. |
I'm not able to reproduce this with 7.1.6. Would you be able to paste the complete stacktrace? |
@danez Im running it using react-native. Seems like metro is stingy with its stacktrace but here it is:
I checked the version written in package.json of node_mules/@babel and its "version": "7.1.6", |
If it helps, I've come across this issue too: const someFunc = () => Promise.resolve(1);
export const worksFine = async <T>(thing: T): Promise<T> => {
return someFunc().then(() => thing);
};
export const itsBroken = async <T>(thing: T): Promise<T> => {
return await someFunc().then(() => thing);
}; Seems to break when you have the |
The problem with typescript and async/await has been fixed in #9055 and will be released with 7.2.0. |
Please try again. It should work now with 7.2.0, as we fixed several issues mentioned in this issue. If there are still problems please open new issues for them. Thank you. |
Bug Report
Current Behavior
I have an anonymous generic arrow function which looks like this:
const myFunc = <T extends {}>(params: any): any => { }
I'm using
vscode
and everything is fine, but when I try to build, I get this error frombabel-loader
:Unexpected token, expected ";"
Input Code
`const myFunc = <T extends {}>(params: any): any => { }`
Expected behavior/code
Should just build my code
Babel Configuration (.babelrc, package.json, cli command)
My
.babelrc
has this global preset:and this env preset:
["@babel/preset-react", { "development": true }]
These global plugins:
And these env plugins:
babel-loader
in webpack has no additional settings to the.babelrc
file.Environment
Possible Solution
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
The text was updated successfully, but these errors were encountered: