-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Incomplete type cleanup with jsx
set to preserve
#37456
Comments
I'm pretty new to TS and this is the first time I'm trying to do anything with the compiler, but I'll take a crack at this one if you don't think it's beyond a noob. |
I get a much more complex output than the one above. After running the command
Is this expected? I just want to make sure I'm not missing any other configs other than the |
@Davenporten
Also this sample code will be better for debug since this doesn't emit error on types. import * as React from "react";
class Test<P> extends React.Component {
render() {
return "Hello";
}
}
type SomeType = {
foo?: boolean;
};
interface SomeInterface {
bar?: boolean;
}
const usingTest: React.FC = () => (
<>
<Test<{}> />
<Test<SomeType> />
<Test<SomeInterface> />
<Test<unknown> />
<Test<string> />
<Test<boolean> />
<Test<object> />
<Test<null> />
<Test<any> />
<Test<never> />
</>
); |
@davenport - you can see the compiler flags enabled in the playground link (the key one here is Module: ESNext) (heh, looks like @hikarinotomadoi beat me to it) |
I've found two PRs that are related to this issue. In the original PR, I found two comments #22415 (comment), #22415 (comment)
It seems @weswigham Is there any case where |
The emitter pretty prints TS, too, so it should be able to print all nodes. The file |
I think changing transform flags aggregation can fix cases with |
Probably! Call expression type arguments and jsx expression type arguments are essentially similar, so transforming them in the same way makes sense. |
Thanks @a-tarasyuk! |
TypeScript Version: 3.8.3
Search Terms:
Expected behavior:
No types in output when
jsx
is set topreserve
.Actual behavior:
Some types in output, meaning the resulting JSX is invalid.
Related Issues:
Code
Output
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: